24#ifndef STORAGE_REGION_H
25#define STORAGE_REGION_H
28#include <libxml/tree.h>
32#include "storage/Utils/Exception.h"
33#include "storage/Utils/Swig.h"
44 enum ull_hack_t { ULL_HACK };
89 Region(
unsigned long long start,
unsigned long long length,
unsigned int block_size);
90 Region(
unsigned long long start,
unsigned long long length,
unsigned long long block_size, ull_hack_t);
142 unsigned int get_block_size()
const;
143 unsigned long long get_block_size(ull_hack_t)
const;
144 void set_block_size(
unsigned int block_size);
145 void set_block_size(
unsigned long long block_size, ull_hack_t);
147 unsigned long long to_bytes(
unsigned long long blocks)
const;
148 unsigned long long to_blocks(
unsigned long long bytes)
const;
214 std::vector<Region>
unused_regions(
const std::vector<Region>& used_regions)
const;
216 friend std::ostream& operator<<(std::ostream& s,
const Region& region);
223 const Impl& get_impl()
const;
225 friend bool getChildValue(
const xmlNode* node,
const char* name,
Region& value);
226 friend void setChildValue(xmlNode* node,
const char* name,
const Region& value);
230 const std::unique_ptr<Impl> impl;
Base class for storage exceptions.
Definition Exception.h:114
A start/length pair with a block size.
Definition Region.h:85
std::vector< Region > unused_regions(const std::vector< Region > &used_regions) const
Returns all regions not included in used_regions.
void adjust_start(long long delta)
Adjusts the start while keeping the length.
unsigned long long get_end() const
Returns the end of the region.
unsigned long long get_length() const
Returns the length of the region.
void set_length(unsigned long long length)
Sets the length while keeping the start.
bool operator==(const Region &rhs) const
Compare start and length of two regions.
bool operator<=(const Region &rhs) const
Compare start of two regions.
bool operator>=(const Region &rhs) const
Compare start of two regions.
bool operator<(const Region &rhs) const
Compare start of two regions.
bool inside(const Region &rhs) const
Check whether the region is contained inside other.
unsigned long long get_start() const
Returns the start of the region.
void adjust_length(long long delta)
Adjusts the length while keeping the start.
bool operator>(const Region &rhs) const
Compare start of two regions.
bool intersect(const Region &rhs) const
Check whether the region intersects with other.
bool operator!=(const Region &rhs) const
Compare start and length of two regions.
void set_start(unsigned long long start)
Sets the start while keeping the length.
The storage namespace.
Definition Actiongraph.h:40