faudes::TaIndexSet< Attr > Class Template Reference
|
Public Types | |
typedef IndexSet::Iterator | Iterator |
Iterators on indexset. | |
Public Member Functions | |
TaIndexSet (void) | |
Constructor. | |
TaIndexSet (const TaIndexSet &rOtherSet) | |
Copy-constructor (from TaIndexSet, incl attributes). | |
TaIndexSet (const IndexSet &rOtherSet) | |
Copy-constructor (from IndexSet, sets attributes to default). | |
TaIndexSet (const std::string &rFilename, const std::string &rLabel="") | |
Construct from file. | |
virtual | ~TaIndexSet (void) |
Virtual destructor. | |
virtual TaIndexSet & | Assign (const IndexSet &rSrc) |
Relaxed assignment method. | |
virtual TaIndexSet & | operator= (const IndexSet &rSrc) |
Relaxed assignment operator. | |
virtual void | Attributes (const IndexSet &rOtherSet) |
Set attributes. | |
virtual void | Attributes (const TaIndexSet &rOtherSet) |
Set attributes. | |
bool | Erase (const Idx &rIndex) |
Erase Element (incl its attribute). | |
Iterator | Erase (const Iterator &pos) |
Erase element by iterator (incl attribute). | |
void | EraseSet (const IndexSet &rOtherSet) |
Erase elements given by other set. | |
void | RestrictSet (const IndexSet &rOtherSet) |
Restrict to specified subset. | |
Idx | Insert (void) |
Insert new index to set using default attribute. | |
Idx | Insert (const Attr &rAttr) |
Insert new index with attribute. | |
bool | Insert (const Idx &rIndex) |
Insert element. | |
bool | Insert (const Idx &rIndex, const Attr &attr) |
Insert element with attribute. | |
virtual void | InsertSet (const IndexSet &rOtherSet) |
Inserts elements of rOtherSet. | |
virtual void | InsertSet (const TaIndexSet &rOtherSet) |
Inserts elements of rOtherSet. | |
virtual void | Clear (void) |
Clear all set. | |
Protected Member Functions | |
virtual void | DoAssign (const TaIndexSet &rSource) |
Assign my members. | |
Friends | |
class | IndexSet |
We implement "protected privacy for template classes" by friendship. |
Set of indices with attributes.
A TaIndexSet<Attr> is a template derived from IndexSet, such that each set element has an Attribute of class Attr. The template parameter Attr must provide basic functions for file IO and must define a default value, see AttributeVoid and AttributeFlags for an examples. Attributes are maintained by an STL map to associate indices with attributes different from the default value. Thus, attributes with default value do not take up any memeory.
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:
<Myset>
17
25 <AValue> "Some Value" </AValue>
40
</MySet>
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.
typedef IndexSet::Iterator faudes::TaIndexSet< Attr >::Iterator |
Iterators on indexset.
Reimplemented from faudes::IndexSet.
Definition at line 407 of file cfl_indexset.h.
faudes::TaIndexSet< Attr >::TaIndexSet | ( | void | ) | [inline] |
Constructor.
Definition at line 562 of file cfl_indexset.h.
faudes::TaIndexSet< Attr >::TaIndexSet | ( | const TaIndexSet< Attr > & | rOtherSet | ) | [inline] |
Copy-constructor (from TaIndexSet, incl attributes).
Definition at line 572 of file cfl_indexset.h.
faudes::TaIndexSet< Attr >::TaIndexSet | ( | const IndexSet & | rOtherSet | ) | [inline] |
Copy-constructor (from IndexSet, sets attributes to default).
Definition at line 584 of file cfl_indexset.h.
faudes::TaIndexSet< Attr >::TaIndexSet | ( | const std::string & | rFilename, | |
const std::string & | rLabel = "" | |||
) | [inline] |
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 597 of file cfl_indexset.h.
virtual faudes::TaIndexSet< Attr >::~TaIndexSet | ( | void | ) | [inline, virtual] |
Virtual destructor.
Definition at line 362 of file cfl_indexset.h.
TaIndexSet< Attr > & faudes::TaIndexSet< Attr >::Assign | ( | const IndexSet & | rSrc | ) | [inline, virtual] |
Relaxed assignment method.
Maintain attributes provided they can be casted.
rSrc | Source from which to assign |
Definition at line 617 of file cfl_indexset.h.
void faudes::TaIndexSet< Attr >::Attributes | ( | const TaIndexSet< Attr > & | rOtherSet | ) | [inline, virtual] |
Set attributes.
Attributes are copied per element from rOtherSet. Elements of this set which are not in rOtherSet maintain their attribute.
rOtherSet | Other IndexSet |
Definition at line 636 of file cfl_indexset.h.
void faudes::TaIndexSet< Attr >::Attributes | ( | const IndexSet & | rOtherSet | ) | [inline, virtual] |
Set attributes.
Provided that rOtherSet has attributes that can be casted to the appropriate type, attributes are copied per element from rOtherSet. Elements of this set which are not in rOtherSet maintain their attribute.
rOtherSet | Other IndexSet |
Exception |
|
Definition at line 643 of file cfl_indexset.h.
void faudes::TaIndexSet< Attr >::Clear | ( | void | ) | [inline, virtual] |
Clear all set.
Reimplemented from faudes::TaBaseSet< Idx, Attr >.
Definition at line 651 of file cfl_indexset.h.
void faudes::TaIndexSet< Attr >::DoAssign | ( | const TaIndexSet< Attr > & | rSource | ) | [inline, protected, virtual] |
Assign my members.
This method maintains attributes.
rSource | Source to copy from |
Definition at line 609 of file cfl_indexset.h.
TaIndexSet< Attr >::Iterator faudes::TaIndexSet< Attr >::Erase | ( | const Iterator & | pos | ) | [inline, virtual] |
Erase element by iterator (incl attribute).
pos | Iterator to specify element |
Reimplemented from faudes::TaBaseSet< Idx, Attr >.
Definition at line 714 of file cfl_indexset.h.
bool faudes::TaIndexSet< Attr >::Erase | ( | const Idx & | rIndex | ) | [inline] |
Erase Element (incl its attribute).
rIndex | Index to specify element |
Reimplemented from faudes::TaBaseSet< Idx, Attr >.
Definition at line 708 of file cfl_indexset.h.
void faudes::TaIndexSet< Attr >::EraseSet | ( | const IndexSet & | rOtherSet | ) | [inline] |
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 721 of file cfl_indexset.h.
bool faudes::TaIndexSet< Attr >::Insert | ( | const Idx & | rIndex, | |
const Attr & | attr | |||
) | [inline] |
Insert element with attribute.
rIndex | Index to specify element | |
attr | Specify attribute of (new) element |
Reimplemented from faudes::TaBaseSet< Idx, Attr >.
Definition at line 686 of file cfl_indexset.h.
bool faudes::TaIndexSet< Attr >::Insert | ( | const Idx & | rIndex | ) | [inline, 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 667 of file cfl_indexset.h.
Idx faudes::TaIndexSet< Attr >::Insert | ( | const Attr & | rAttr | ) | [inline] |
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 675 of file cfl_indexset.h.
Idx faudes::TaIndexSet< Attr >::Insert | ( | void | ) | [inline] |
Insert new index to set using default attribute.
Reimplemented from faudes::IndexSet.
Definition at line 658 of file cfl_indexset.h.
void faudes::TaIndexSet< Attr >::InsertSet | ( | const TaIndexSet< Attr > & | rOtherSet | ) | [inline, virtual] |
Inserts elements of rOtherSet.
Attributes of this set are maintained, new elements are inserted with attribute.
rOtherSet | Other IndexSet |
Definition at line 694 of file cfl_indexset.h.
void faudes::TaIndexSet< Attr >::InsertSet | ( | const IndexSet & | rOtherSet | ) | [inline, virtual] |
Inserts elements of rOtherSet.
Attributes of this set are maintained, newly inserted elements have default attribute.
rOtherSet | Other IndexSet |
Definition at line 701 of file cfl_indexset.h.
TaIndexSet< Attr > & faudes::TaIndexSet< Attr >::operator= | ( | const IndexSet & | rSrc | ) | [inline, virtual] |
Relaxed assignment operator.
Maintain attributes provided they can be casted.
rSrc | Source from which to assign |
Definition at line 629 of file cfl_indexset.h.
void faudes::TaIndexSet< Attr >::RestrictSet | ( | const IndexSet & | rOtherSet | ) | [inline] |
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 728 of file cfl_indexset.h.
friend class IndexSet [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.23h --- 2014.04.03 --- c++ api documentaion by doxygen