srecord
1.65.0
|
The interval class is used to represent a set of integer values, usually composed of runs of adjacent value. More...
#include <interval.h>
Public Types | |
typedef uint32_t | data_t |
The data_t type is used to parameterize the integr type used in the interval. More... | |
typedef uint64_t | long_data_t |
Public Member Functions | |
~interval () | |
The destructor. More... | |
interval () | |
The default constructor. More... | |
interval (data_t val) | |
The constructor. More... | |
interval (data_t lo, data_t hi) | |
The constructor. More... | |
interval (const interval &) | |
The copy constructor. More... | |
interval & | operator= (const interval &) |
The assignment operator. More... | |
bool | member (data_t val) const |
The member method is used to test whether a given value is a member of the interval. More... | |
bool | empty () const |
The empty method is used to test whether the interval is empty. More... | |
void | first_interval_only () |
The first_interval_only method is used to crop the interval to the first (numerically least) run of consecutive integers in the set. More... | |
void | scan_begin () |
The interval_scan_begin method is used to start traversing every integer value in the interval. More... | |
bool | scan_next (data_t &) |
The interval_scan_next method is used to traverse every integer value in the interval. More... | |
void | scan_end () |
The interval_scan_end method is used to finish traversing every integer value in the interval. More... | |
data_t | get_lowest () const |
The get_lowest method is used to obtain the lower bound of the interval. More... | |
data_t | get_highest () const |
The get_highest method is used to obtain the upper bound of the interval. More... | |
void | print (std::ostream &) const |
The print method is used to print an interval on an output stream. More... | |
interval | pad (int x) const |
The pad method is used to expand an interval by padding each sub-interval. More... | |
std::string | representation () const |
The representation method is used to manufacture a textural representation of this interval. More... | |
interval | flatten () const |
The flatten method is used to convert an interval with holes in it to a simple interval with no holes in it, by using the mimimum and maximum values. More... | |
long_data_t | coverage () const |
The coverage method is used to obtain the size of the interval in bytes. More... | |
Static Public Member Functions | |
static interval | union_ (const interval &, const interval &) |
The union_ class method is used to calculate the set union of two intervals. More... | |
static interval | intersection (const interval &, const interval &) |
The intersection class method is used to calculate the set intersection of two intervals. More... | |
static interval | difference (const interval &, const interval &) |
The difference class method is used to calculate the set difference of two intervals. More... | |
static bool | equal (const interval &, const interval &) |
The equal class method is used to test the equality of two intervals. More... | |
The interval class is used to represent a set of integer values, usually composed of runs of adjacent value.
Set arithmetic is implemented on these intervals.
Definition at line 35 of file interval.h.
typedef uint32_t srecord::interval::data_t |
The data_t type is used to parameterize the integr type used in the interval.
Definition at line 47 of file interval.h.
typedef uint64_t srecord::interval::long_data_t |
Definition at line 48 of file interval.h.
srecord::interval::~interval | ( | ) |
The destructor.
It isn't virtual, so don't derive from this class.
srecord::interval::interval | ( | ) |
The default constructor.
The interval is empty.
srecord::interval::interval | ( | data_t | val | ) |
The constructor.
The interval contains the single integer supplied.
val | The interval is constructed to contain the single interger value supplied. |
The constructor.
The interval contains all values >= lo and < hi.
lo | The lower bound of the integers in the initial interval. |
hi | The upper bound of the integers in the initial interval; this value is not included. |
srecord::interval::interval | ( | const interval & | ) |
The copy constructor.
The union_ class method is used to calculate the set union of two intervals.
Referenced by srecord::operator+(), and srecord::operator+=().
The intersection class method is used to calculate the set intersection of two intervals.
Referenced by srecord::operator*(), and srecord::operator*=().
The difference class method is used to calculate the set difference of two intervals.
Referenced by srecord::operator-(), and srecord::operator-=().
The equal class method is used to test the equality of two intervals.
Referenced by srecord::operator!=(), and srecord::operator==().
bool srecord::interval::member | ( | data_t | val | ) | const |
The member method is used to test whether a given value is a member of the interval.
val | The value to test for membership |
bool srecord::interval::empty | ( | ) | const |
The empty method is used to test whether the interval is empty.
void srecord::interval::first_interval_only | ( | ) |
The first_interval_only method is used to crop the interval to the first (numerically least) run of consecutive integers in the set.
void srecord::interval::scan_begin | ( | ) |
The interval_scan_begin method is used to start traversing every integer value in the interval.
bool srecord::interval::scan_next | ( | data_t & | ) |
The interval_scan_next method is used to traverse every integer value in the interval.
void srecord::interval::scan_end | ( | ) |
The interval_scan_end method is used to finish traversing every integer value in the interval.
data_t srecord::interval::get_lowest | ( | ) | const |
The get_lowest method is used to obtain the lower bound of the interval.
It is inclusive.
data_t srecord::interval::get_highest | ( | ) | const |
The get_highest method is used to obtain the upper bound of the interval.
It is exclusive (i.e. one beyond the highest integer in the set).
void srecord::interval::print | ( | std::ostream & | ) | const |
The print method is used to print an interval on an output stream.
Referenced by srecord::operator<<().
interval srecord::interval::pad | ( | int | x | ) | const |
The pad method is used to expand an interval by padding each sub-interval.
For each sub-interval the minimum is rounded down to a multiple of x, and the upper bound is rounded up to a multiple of x.
x | The multiple to expand to. No action is taken if x < 2. |
std::string srecord::interval::representation | ( | ) | const |
The representation method is used to manufacture a textural representation of this interval.
interval srecord::interval::flatten | ( | ) | const |
The flatten method is used to convert an interval with holes in it to a simple interval with no holes in it, by using the mimimum and maximum values.
long_data_t srecord::interval::coverage | ( | ) | const |
The coverage method is used to obtain the size of the interval in bytes.