|
| Domain (int size=0, int min=0) |
| Constructs a Domain with size Entry objects having IDs ranging from min to min + size - 1 . More...
|
|
| Domain (const Domain< M, V > &d) |
| Constructs a Domain that is a copy of d . More...
|
|
template<typename InputIterator > |
| Domain (InputIterator first, InputIterator last, int min=0) |
| Iterates from first to last and stores a copy of each element in the sequence as a member value of an Entry in this Domain. More...
|
|
virtual | ~Domain () |
| Destructs the Domain, removing all Entry objects from all Groups, calling the destructor for each Entry member, and deallocating all memory currently allocated for internal storage. More...
|
|
int | size () const |
| Returns the number of Entry objects in this Domain. More...
|
|
int | min () const |
| Returns the lowest numbered ID of this Domain. More...
|
|
Group< M, V > * | getGroup (int id) |
| Returns a pointer to the Group to which the Entry with the given id belongs or NULL if that member belongs to no Group. More...
|
|
const Group< M, V > * | getGroup (int id) const |
| Returns a pointer to the const Group to which the Entry with the given id belongs or NULL if that member belongs to no Group. More...
|
|
V & | getValue (int id) |
| Returns a reference to the value of the Group to which the Entry with the given id belongs. More...
|
|
const V & | getValue (int id) const |
| Returns a const reference to the value of the Group to which the Entry with the given id belongs. More...
|
|
M & | getMember (int id) |
| Returns a reference to the member object associated with the given id . More...
|
|
const M & | getMember (int id) const |
| Returns a const reference to the member object associated with the given id . More...
|
|
void | setMember (int id, const M &m) |
| Finds the Entry in this Domain with the given id and sets its member field to m . More...
|
|
Entry & | getEntry (int id) |
| Returns a reference to the Entry with the given id . More...
|
|
const Entry & | getEntry (int id) const |
| Returns a const reference to the Entry with the given id . More...
|
|
void | addEntry (int id, const M &member=M()) |
| Similar to setMember but will resize this Domain as neccessary to accomodate the given id . More...
|
|
void | resize (int newSize) |
| Equivalent to resize(newSize, min()) More...
|
|
void | resize (int newSize, int newMin) |
| Resizes this Domain to contain newSize Entry objects with IDs ranging from newMin to newMin + newSize - 1 . More...
|
|
int | high () const |
| Returns one plus the highest numbered ID that can be added to the Domain without memory reallocation. More...
|
|
int | low () const |
| Returns the lowest numbered ID that can be added to the Domain without memory reallocation. More...
|
|
int | capacity () const |
| Returns high() - low() . More...
|
|
void | reserve (int high) |
| Equivalent to reserve(newHigh, low()). More...
|
|
void | reserve (int high, int low) |
| If either high() < newHigh or low() > newLow , then the internal array is reallocated so that high() is increased to at least newHigh and low() is reduced to at most newLow . More...
|
|
void | compact () |
| If the capacity of the Domain exceeds its size, then compact reallocates internal storage reducing capacity to match the current size of the Domain. More...
|
|
template<typename M, typename V>
class partition::Domain< M, V >
A resizable array of Entry objects having sequentially numbered IDs which may be partitioned across an arbitrary number of associated Groups.
Read the package summary for introductory information about Domain and its related classes.
The ID of the first Entry object (being the Entry with the lowest numbered ID in the Domain's internal array) may have an arbitrary value and is tracked by min()
. The ID of the last Entry object (being the Entry with the highest numbered ID in the Domain's internal array) is given by min() + size() - 1
. This internal array may be dynamically resized in either direction (either by adding entries after the end of the array which increases the maximum ID or by adding entries before the beginning of the array which decreases the minimum ID).
The methods addEntry()
, compact()
, reserve()
, and resize()
(and their overloaded variants) are the operations that can result in memory reallocation. Memory reallocation does not disturb Group membership, but does invalidate all Iterators on all Groups.
- Parameters
-
template<typename M , typename V >
Constructs a Domain with size
Entry objects having IDs ranging from min
to min + size - 1
.
All Entry member fields are assigned default values.
- Exceptions
-
PartitionException | if size is negative.
This validation is only included if the following preprocessor directive evaluates to true during compilation: #if PARTITION_SL >= PARTITION_ST_DOMAIN_CONSTRUCTOR
|
If size is zero, the value of min does not affect subsequent behavior of addEntry: min always matches the id of the lowest numbered field in the Domain, so a subsequent call to addEntry with an id of any value N will always reset the min to N. The min value is set however, so a subsequent call to resize(int size) will function with the previously set min value.
template<typename M , typename V >
template<typename InputIterator >
Iterates from first to last and stores a copy of each element in the sequence as a member value of an Entry in this Domain.
The first entry is given an ID of min and each subsequent entry is given a sequentially increasing integer id
.
template<typename M , typename V >
Resizes this Domain to contain newSize Entry objects with IDs ranging from newMin
to newMin + newSize - 1
.
Previously existing Entry objects having IDs that fall in this newly defined range have both their member fields as well as their group memberships preserved.
Previously existing Entry objects having IDs that fall outside this newly defined range are removed from their Groups, and each such Entry member's destructor is invoked.
If newMin < low()
or newMin + newSize > high()
then resize also causes a memory reallocation to accomodate the requested Entry range.
- Exceptions
-
PartitionException | if newSize is negative.
This validation is only included if the following preprocessor directive evaluates to true during compilation: #if PARTITION_SL >= PARTITION_ST_DOMAIN_MEMORY
|