#include <indexset.h>
Inheritance diagram for faudes::TaIndexSet< Attr >:
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 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>
Definition at line 259 of file indexset.h.
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="IndexSet") | |
Construct from file. | |
virtual | ~TaIndexSet (void) |
Virtual destructor. | |
template<class OtherAttr> | |
void | CopyWithoutAttributes (TaIndexSet< OtherAttr > &rSet) const |
Copy to any other TaIndexSet. | |
Idx | AttributesSize (void) const |
Get number of explicit (presumably non-default) attributes. | |
Attr * | Attributep (Idx idx) |
Get attribute reference by index. | |
const Attr & | Attribute (Idx idx) const |
Get attribute by index. | |
void | Attribute (Idx idx, const Attr &attr) |
Set attribute. | |
void | ClrAttribute (Idx idx) |
Clear attribute to default value. | |
void | ClearAttributes (void) |
Clear all attributes to default value. | |
bool | Erase (Idx idx) |
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. | |
Idx | Insert (void) |
Insert new index to set using default attribute. | |
Idx | Insert (const Attr &attr) |
Insert new index with attribute. | |
bool | Insert (Idx idx) |
Insert element. | |
bool | Insert (Idx idx, const Attr &attr) |
Insert element with attribute. | |
void | InsertSet (const IndexSet &rOtherSet) |
Inserts elements of rOtherSet. | |
void | InsertSet (const TaIndexSet &rOtherSet) |
Inserts elements of rOtherSet. | |
virtual void | Clear (void) |
Clear all set. | |
void | SetUnion (const TaIndexSet &rOtherSet) |
Set union. | |
void | SetUnion (const IndexSet &rOtherSet) |
Set union. | |
void | SetIntersection (const TaIndexSet &rOtherSet) |
Set intersection. | |
void | SetIntersection (const IndexSet &rOtherSet) |
Set intersection. | |
Protected Member Functions | |
virtual void | DoWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const |
Write to TokenWriter, see TBaseSet for public wrappers. | |
virtual void | DoRead (TokenReader &rTr, const std::string &rLabel="", const Type *pContext=0) |
Read from TokenReader. | |
Protected Attributes | |
std::map< Idx, Attr > | mAttributeMap |
Stored attributes. | |
Static Protected Attributes | |
static Attr | mDefAttribute |
Statics per template parameter. | |
Friends | |
class | IndexSet |
We implement "protected privacy for template classes" by friendship. |
|
Constructor.
Definition at line 586 of file indexset.h. |
|
Copy-constructor (from TaIndexSet, incl attributes).
Definition at line 593 of file indexset.h. |
|
Copy-constructor (from IndexSet, sets attributes to default).
Definition at line 602 of file indexset.h. |
|
Construct from file. This constructor uses the Read(TokenReader&, const std::string&) function to read.
Definition at line 611 of file indexset.h. |
|
Virtual destructor.
Definition at line 301 of file indexset.h. |
|
Set attribute. Sets the attribute of the sepcified element to the given value.
Definition at line 779 of file indexset.h. |
|
Get attribute by index. This function returns a const reference to the attribute of the specified index.
Definition at line 761 of file indexset.h. |
|
Get attribute reference by index. 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(Idx) const instead.
Definition at line 741 of file indexset.h. |
|
Get number of explicit (presumably non-default) attributes.
Definition at line 735 of file indexset.h. |
|
Clear all set.
Reimplemented from faudes::TBaseSet< Idx >. Definition at line 808 of file indexset.h. |
|
Clear all attributes to default value.
Definition at line 796 of file indexset.h. |
|
Clear attribute to default value.
Definition at line 802 of file indexset.h. |
|
Copy to any other TaIndexSet. This function ignores input attributes and sets the result attributes to the default value.
Definition at line 620 of file indexset.h. |
|
Read from TokenReader. Uses TokenReader::SeekBegin() to seek the specified section, reads subsequent integer tokens as indexes, calls matching TokenReader::SeekEnd(). Any subsections or Tokens of type different than integer are skipped. Thus, a file written from a set with attributes can be read as IndexSet.
Reimplemented from faudes::IndexSet. Reimplemented in faudes::TaNameSet< Attr >, faudes::TaNameSet< SimConditionAttribute >, faudes::TaNameSet< AttributeCFlags >, and faudes::TaNameSet< EventAttr >. Definition at line 680 of file indexset.h. |
|
Write to TokenWriter, see TBaseSet for public wrappers. Appends the IndexSet to TokenWriter. This will write a section with label Name() that holds integer tokens to represent the IndexSet. For non-default attribute values, the respective index is followed by the attribute value. The latter may consist of sections (or tokens different from integer or string) to allow for transparent reading; see AttributeVoid and AttributeFlags. Example for 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>
Reimplemented from faudes::IndexSet. Reimplemented in faudes::TaNameSet< Attr >, faudes::TaNameSet< SimConditionAttribute >, faudes::TaNameSet< AttributeCFlags >, and faudes::TaNameSet< EventAttr >. Definition at line 628 of file indexset.h. |
|
Erase element by iterator (incl attribute).
Reimplemented from faudes::TBaseSet< Idx >. Reimplemented in faudes::TaNameSet< Attr >, faudes::TaNameSet< SimConditionAttribute >, faudes::TaNameSet< AttributeCFlags >, and faudes::TaNameSet< EventAttr >. Definition at line 898 of file indexset.h. |
|
Erase Element (incl its attribute).
Reimplemented in faudes::TaNameSet< Attr >, faudes::TaNameSet< SimConditionAttribute >, faudes::TaNameSet< AttributeCFlags >, and faudes::TaNameSet< EventAttr >. Definition at line 889 of file indexset.h. |
|
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.
Definition at line 913 of file indexset.h. |
|
Insert element with attribute.
Reimplemented in faudes::TaNameSet< Attr >, faudes::TaNameSet< SimConditionAttribute >, faudes::TaNameSet< AttributeCFlags >, and faudes::TaNameSet< EventAttr >. Definition at line 845 of file indexset.h. |
|
Insert element. If the element exists, the attribute is maintained. If the element does not exist, it is inserted with default attribute.
Reimplemented from faudes::IndexSet. Reimplemented in faudes::TaNameSet< Attr >, faudes::TaNameSet< SimConditionAttribute >, faudes::TaNameSet< AttributeCFlags >, and faudes::TaNameSet< EventAttr >. Definition at line 825 of file indexset.h. |
|
Insert new index with attribute.
Definition at line 834 of file indexset.h. |
|
Insert new index to set using default attribute.
Reimplemented from faudes::IndexSet. Definition at line 816 of file indexset.h. |
|
Inserts elements of rOtherSet. Attributes of this set are maintained, new elements are inserted with attribute.
Definition at line 858 of file indexset.h. |
|
Inserts elements of rOtherSet. Attributes of this set are maintained, newly inserted elements have default attribute.
Definition at line 883 of file indexset.h. |
|
Set intersection. The intersection is wrt set of indices, the result is stored in this set. Attributes are set to default.
Definition at line 954 of file indexset.h. |
|
Set intersection. The intersection is wrt set of indices, the result is stored in this set. Attributes are set to default.
Definition at line 961 of file indexset.h. |
|
Set union. The union is wrt the set of indices, the result is accumulated in this set. Attributes are set to default. See also InsertSet(const IndexSet&).
Definition at line 940 of file indexset.h. |
|
Set union. The union is wrt the set of indices, the result is accumulated in this set. Attributes are set to default. See also InsertSet(const TaIndexSet&).
Definition at line 947 of file indexset.h. |
|
We implement "protected privacy for template classes" by friendship. This is used for the pragmatic implemention conversion constructors. Definition at line 265 of file indexset.h. |
|
Stored attributes.
Definition at line 505 of file indexset.h. |