24 #ifndef STORAGE_REGION_H 25 #define STORAGE_REGION_H 28 #include <libxml/tree.h> 32 #include "storage/Utils/Exception.h" 78 Region(
unsigned long long start,
unsigned long long length,
unsigned int block_size);
104 unsigned long long get_end()
const;
109 void set_start(
unsigned long long start);
130 unsigned int get_block_size()
const;
131 void set_block_size(
unsigned int block_size);
133 unsigned long long to_bytes(
unsigned long long blocks)
const;
134 unsigned long long to_blocks(
unsigned long long bytes)
const;
200 std::vector<Region>
unused_regions(
const std::vector<Region>& used_regions)
const;
202 friend std::ostream& operator<<(std::ostream& s,
const Region& region);
209 const Impl& get_impl()
const;
211 friend bool getChildValue(
const xmlNode* node,
const char* name,
Region& value);
212 friend void setChildValue(xmlNode* node,
const char* name,
const Region& value);
216 const std::unique_ptr<Impl> impl;
std::vector< Region > unused_regions(const std::vector< Region > &used_regions) const
Returns all regions not included in used_regions.
bool operator>(const Region &rhs) const
Compare start of two regions.
unsigned long long get_start() const
Returns the start of the region.
bool operator>=(const Region &rhs) const
Compare start of two regions.
A start/length pair with a block size.
Definition: Region.h:73
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_length() const
Returns the length of the region.
unsigned long long get_end() const
Returns the end of the region.
bool operator!=(const Region &rhs) const
Compare start and length of two regions.
bool operator<=(const Region &rhs) const
Compare start of two regions.
void adjust_start(long long delta)
Adjusts the start while keeping the length.
void adjust_length(long long delta)
Adjusts the length while keeping the start.
void set_length(unsigned long long length)
Sets the length while keeping the start.
Base class for storage exceptions.
Definition: Exception.h:113
The storage namespace.
Definition: Actiongraph.h:37
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.