#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 249 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. | |
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 | |
void | DoWrite (TokenWriter &rTw, const std::string &rLabel="") const |
Write to TokenWriter, see TBaseSet for public wrappers. | |
void | DoRead (TokenReader &rTr, const std::string &rLabel="IndexSet") |
Read from TokenReader. | |
Protected Attributes | |
std::map< Idx, Attr > | mAttributeMap |
Stored attributes. | |
Static Protected Attributes | |
static Attr | mDefAttribute |
Statics per template parameter. | |
Friends | |
class | TaIndexSet |
We implement "protected privacy for template classes" by friendship. |
|
Constructor.
Definition at line 568 of file indexset.h. |
|
Copy-constructor (from TaIndexSet, incl attributes).
Definition at line 575 of file indexset.h. |
|
Copy-constructor (from IndexSet, sets attributes to default).
Definition at line 584 of file indexset.h. |
|
Construct from file. This constructor uses the Read(TokenReader&, const std::string&) function to read.
Definition at line 593 of file indexset.h. |
|
Virtual destructor.
Definition at line 291 of file indexset.h. |
|
Set attribute. Sets the attribute of the sepcified element to the given value.
Definition at line 748 of file indexset.h. |
|
Get attribute by index. This function returns a const reference to the attribute of the specified index.
Definition at line 730 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 710 of file indexset.h. |
|
Get number of explicit (presumably non-default) attributes.
Definition at line 704 of file indexset.h. |
|
Clear all set.
Reimplemented from faudes::TBaseSet< Idx >. Definition at line 777 of file indexset.h. |
|
Clear all attributes to default value.
Definition at line 765 of file indexset.h. |
|
Clear attribute to default value.
Definition at line 771 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 602 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 >, and faudes::TaNameSet< EventAttr >. Definition at line 648 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 >, and faudes::TaNameSet< EventAttr >. Definition at line 610 of file indexset.h. |
|
Erase element by iterator (incl attribute).
Reimplemented from faudes::TBaseSet< Idx >. Reimplemented in faudes::TaNameSet< Attr >, and faudes::TaNameSet< EventAttr >. Definition at line 866 of file indexset.h. |
|
Erase Element (incl its attribute).
Reimplemented in faudes::TaNameSet< Attr >, and faudes::TaNameSet< EventAttr >. Definition at line 857 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 881 of file indexset.h. |
|
Insert element with attribute.
Reimplemented in faudes::TaNameSet< Attr >, and faudes::TaNameSet< EventAttr >. Definition at line 813 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 >, and faudes::TaNameSet< EventAttr >. Definition at line 793 of file indexset.h. |
|
Insert new index with attribute.
Definition at line 802 of file indexset.h. |
|
Insert new index to set using default attribute.
Reimplemented from faudes::IndexSet. Definition at line 784 of file indexset.h. |
|
Inserts elements of rOtherSet. Attributes of this set are maintained, new elements are inserted with attribute.
Definition at line 826 of file indexset.h. |
|
Inserts elements of rOtherSet. Attributes of this set are maintained, newly inserted elements have default attribute.
Definition at line 851 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 922 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 929 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 908 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 915 of file indexset.h. |
|
We implement "protected privacy for template classes" by friendship. This is used for the pragmatic implemention conversion constructors. Reimplemented from faudes::IndexSet. Definition at line 255 of file indexset.h. |
|
Stored attributes.
Definition at line 495 of file indexset.h. |