faudes::TaIndexSet< Attr > Class Template Reference Set of indices with attributes. More...
Detailed Descriptiontemplate<class Attr>
|
mAttributeMap | STL map of type std::map<Idx,Attr> to hold attributes |
The copy constructor copies attributes; the methods InsertSet(), EraseSet() and RestrictSet() maintain attributes; all other set operations derived from IndexSet either return a IndexSet (no attributes) or set all attributes to the dafault value. To set or get an attribute of an index that does not exist in the set is considered as an error and triggers an exception (id 60) when the macro FAUDES_CHECKED is defined.
The format for token IO is demonstrated by the following example of a set with name "MySet" consisting of indices 17, 25, 40, where index 25 has a nontrivial attribute attached:
Note that attributes may be either subsections or tokens of type different from integer and string. This is to allow reading a token stream to a class with incompatible (or no) attributes.
Definition at line 316 of file cfl_indexset.h.
faudes::TaIndexSet< Attr >::TaIndexSet | ( | void | ) |
Constructor.
Definition at line 574 of file cfl_indexset.h.
faudes::TaIndexSet< Attr >::TaIndexSet | ( | const TaIndexSet< Attr > & | rOtherSet | ) |
Copy-constructor (from TaIndexSet, incl attributes)
Definition at line 583 of file cfl_indexset.h.
faudes::TaIndexSet< Attr >::TaIndexSet | ( | const IndexSet & | rOtherSet | ) |
Copy-constructor (from IndexSet, sets attributes to default)
Definition at line 594 of file cfl_indexset.h.
faudes::TaIndexSet< Attr >::TaIndexSet | ( | const std::string & | rFilename, |
const std::string & | rLabel = "" |
||
) |
Construct from file.
This constructor uses the Read(TokenReader&, const std::string&) function to read.
rFilename | Name of file |
rLabel | Section for the set in file |
Exception |
|
Definition at line 606 of file cfl_indexset.h.
|
inlinevirtual |
Virtual destructor.
Definition at line 362 of file cfl_indexset.h.
|
virtual |
Relaxed assignment method.
Maintain attributes provided they can be casted.
rSrc | Source from which to assign |
Definition at line 625 of file cfl_indexset.h.
|
inline |
Get attribute by element.
This function returns a const reference to the attribute of the specified element.
rElem | Specify element |
Exception |
|
Reimplemented from faudes::TAttrMap< Idx, Attr >.
Definition at line 528 of file cfl_indexset.h.
|
inline |
Set attribute.
This method sets the attribute of the sepcified element to the given value.
rElem | Specify element |
attr | Attribute value. |
Exception |
|
Reimplemented from faudes::TAttrMap< Idx, Attr >.
Definition at line 529 of file cfl_indexset.h.
|
inline |
Set attribute.
Provided that the attribute can be casted to the appropriate type, this method sets the attribute of the sepcified element to the given value.
rElem | Specify element |
attr | Attribute value. |
Exception |
|
Reimplemented from faudes::TAttrMap< Idx, Attr >.
Definition at line 530 of file cfl_indexset.h.
|
inline |
Get attribute reference by element.
Note that in order to produce a non-const reference this method will insert an explicit default attribute if necessary. If a const reference is sufficient, you should use Attribute(rElem) const instead.
rElem | Specify element |
Exception |
|
Reimplemented from faudes::TAttrMap< Idx, Attr >.
Definition at line 527 of file cfl_indexset.h.
|
inline |
Set attribute.
Provided that the attribute can be casted to the appropriate type, this method sets the attribute of the sepcified element to the given value. If the cast fails, this method does nothing.
rElem | Specify element |
attr | Attribute value. |
Exception |
|
Reimplemented from faudes::TAttrMap< Idx, Attr >.
Definition at line 531 of file cfl_indexset.h.
|
inline |
resolve ambiguities from attribute interface ("using" wont do the job)
Reimplemented from faudes::TAttrMap< Idx, Attr >.
Definition at line 526 of file cfl_indexset.h.
|
protected |
Assign my members.
This method maintains attributes.
rSource | Source to copy from |
Definition at line 617 of file cfl_indexset.h.
bool faudes::TaIndexSet< Attr >::Erase | ( | const Idx & | rIndex | ) |
Erase Element (incl its attribute)
rIndex | Index to specify element |
Reimplemented from faudes::TAttrMap< Idx, Attr >.
Definition at line 704 of file cfl_indexset.h.
|
virtual |
Erase element by iterator (incl attribute)
pos | Iterator to specify element |
Reimplemented from faudes::TBaseSet< Idx >.
Definition at line 710 of file cfl_indexset.h.
void faudes::TaIndexSet< Attr >::EraseSet | ( | const IndexSet & | rOtherSet | ) |
Erase elements given by other set.
This function ignores the attributes of the other set and maintains the attributes of the remaining elements in this set.
rOtherSet | Elements to erase |
Definition at line 717 of file cfl_indexset.h.
|
virtual |
Erase elements given by other set.
This variant uses a runtime cast to access attributes.
rOtherSet | Other IndexSet |
Exception |
|
Definition at line 724 of file cfl_indexset.h.
Idx faudes::TaIndexSet< Attr >::Insert | ( | void | ) |
Insert new index to set using default attribute.
Reimplemented from faudes::IndexSet.
Definition at line 647 of file cfl_indexset.h.
Idx faudes::TaIndexSet< Attr >::Insert | ( | const Attr & | rAttr | ) |
Insert new index with attribute.
If the index allready exists, the attribute is overwritten by rAttr.
rAttr | Specify attribute of new element |
Definition at line 663 of file cfl_indexset.h.
|
virtual |
Insert element.
If the element exists, the attribute is maintained. If the element does not exist, it is inserted with default attribute.
rIndex | Index to specify element |
Reimplemented from faudes::IndexSet.
Definition at line 656 of file cfl_indexset.h.
bool faudes::TaIndexSet< Attr >::Insert | ( | const Idx & | rIndex, |
const Attr & | attr | ||
) |
Insert element with attribute.
rIndex | Index to specify element |
attr | Specify attribute of (new) element |
Reimplemented from faudes::TAttrMap< Idx, Attr >.
Definition at line 674 of file cfl_indexset.h.
|
virtual |
Inserts elements of rOtherSet.
Attributes of this set are maintained, newly inserted elements attain the attribute from rOtherSet if it can be casted appropriately.
rOtherSet | Other IndexSet |
Definition at line 682 of file cfl_indexset.h.
|
virtual |
Inserts elements of rOtherSet.
This variant uses a runtime cast to access attributes.
rOtherSet | Other IndexSet |
Exception |
|
Definition at line 689 of file cfl_indexset.h.
|
inlinevirtual |
Relaxed assignment operator.
Maintain attributes provided they can be casted.
rSrc | Source from which to assign |
Definition at line 380 of file cfl_indexset.h.
void faudes::TaIndexSet< Attr >::RestrictSet | ( | const IndexSet & | rOtherSet | ) |
Restrict to specified subset.
Erases any elements no in the specified set. This function ignores the attributes of the other set and maintains the attributes of the remaining elements in this set.
rOtherSet | Elements to erase |
Definition at line 739 of file cfl_indexset.h.
|
virtual |
Restrict to specified subset.
This variant uses a runtime cast to access attributes.
rOtherSet | Other IndexSet |
Exception |
|
Definition at line 746 of file cfl_indexset.h.
|
friend |
We implement "protected privacy for template classes" by friendship.
This is used for the pragmatic implemention conversion constructors.
Definition at line 326 of file cfl_indexset.h.
libFAUDES 2.28a --- 2016.09.13 --- c++ api documentaion by doxygen