#include <indexset.h>
Inheritance diagram for faudes::IndexSet:
This class is built on top of the faudes version TBaseSet of STL sets. It provides the essentials of the STL interface and inherits the standard token IO interface from Type, so you may use Read and Write for file/string/console IO.
IndexSet is used as common base for TaIndexSet (indices with attributes), NameSet (indices with symbolic names) and TaNameSet (indices with attributes and symbolic names).
The index of value 0 is reserved to indicate the invalid index. If the macro FAUDES_CHECKED is defined, the attempt to insert an index 0 triggers an exception (id 61). Invalid iterators throw an exception (id 62) when used as an argument to a IndexSet function.
Technically, file IO is done by TaIndexSet functions. This requires a copy and for that reason may be reimplemented in a future versions. The format is demonstrated by the following example of a set with name "MySet" consisting of indices 17, 25, 26, 27, 28, 40:
<Myset> 17 <Consecutive> 25 4 </Consecutive> 40 </MySet>
Definition at line 78 of file indexset.h.
Public Types | |
typedef TBaseSet< Idx >::Iterator | Iterator |
Iterators on indexset. | |
Public Member Functions | |
IndexSet (void) | |
Constructor. | |
IndexSet (const TBaseSet< Idx > &rOtherSet) | |
Copy-constructor. | |
IndexSet (const std::string &rFilename, const std::string &rLabel="IndexSet") | |
Construct from file. | |
virtual | ~IndexSet (void) |
Virtual destructor. | |
Idx | MaxIndex (void) const |
Get maximum index used in this set (0 for emptyset). | |
bool | Valid (Idx index) const |
Test whether index is not 0. | |
Idx | Insert (void) |
Insert new index to set. | |
bool | Insert (Idx idx) |
Insert specified index. | |
Idx | Signature (void) const |
Compute an Idx type signature for a Set. | |
std::string | Str (Idx index) const |
Return pretty printable index. | |
Protected Member Functions | |
virtual void | DoWrite (TokenWriter &tw, 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, see TBaseSet for public wrappers. | |
Friends | |
class | TaIndexSet |
We implement "protected privacy for template classes" by friendship. |
|
Iterators on indexset.
Definition at line 138 of file indexset.h. |
|
Constructor.
Definition at line 29 of file indexset.cpp. |
|
Copy-constructor.
Definition at line 37 of file indexset.cpp. |
|
Construct from file. Uses the Read(TokenReader&, const std::string&) function to read. a IndexSet from section rLabel in file rFilename.
Definition at line 44 of file indexset.cpp. |
|
Virtual destructor.
Definition at line 116 of file indexset.h. |
|
Read from TokenReader, see TBaseSet for public wrappers. Uses TaIndexSet::Read(TokenReader&,const std::string&) with void attributes. See TBaseSet for public versions of this function.
Reimplemented from faudes::TBaseSet< Idx >. Reimplemented in faudes::TaIndexSet< Attr >, faudes::NameSet, faudes::TaNameSet< Attr >, faudes::TaIndexSet< SimConditionAttribute >, faudes::TaIndexSet< StateAttr >, faudes::TaIndexSet< AttributeCFlags >, faudes::TaIndexSet< EventAttr >, faudes::TaIndexSet< AttributeTimedState >, faudes::TaNameSet< SimConditionAttribute >, faudes::TaNameSet< AttributeCFlags >, and faudes::TaNameSet< EventAttr >. Definition at line 58 of file indexset.cpp. |
|
Write to TokenWriter, see TBaseSet for public wrappers. Uses TaIndexSet::Write(TokenWriter&,const std::string&) with void attributes. See TBaseSet for public versions of this function.
Reimplemented from faudes::TBaseSet< Idx >. Reimplemented in faudes::TaIndexSet< Attr >, faudes::NameSet, faudes::TaNameSet< Attr >, faudes::TaIndexSet< SimConditionAttribute >, faudes::TaIndexSet< StateAttr >, faudes::TaIndexSet< AttributeCFlags >, faudes::TaIndexSet< EventAttr >, faudes::TaIndexSet< AttributeTimedState >, faudes::TaNameSet< SimConditionAttribute >, faudes::TaNameSet< AttributeCFlags >, and faudes::TaNameSet< EventAttr >. Definition at line 52 of file indexset.cpp. |
|
Insert specified index.
Reimplemented in faudes::TaIndexSet< Attr >, faudes::NameSet, faudes::TaNameSet< Attr >, faudes::TaIndexSet< SimConditionAttribute >, faudes::TaIndexSet< StateAttr >, faudes::TaIndexSet< AttributeCFlags >, faudes::TaIndexSet< EventAttr >, faudes::TaIndexSet< AttributeTimedState >, faudes::TaNameSet< SimConditionAttribute >, faudes::TaNameSet< AttributeCFlags >, and faudes::TaNameSet< EventAttr >. Definition at line 82 of file indexset.cpp. |
|
Insert new index to set.
Reimplemented in faudes::TaIndexSet< Attr >, faudes::TaIndexSet< SimConditionAttribute >, faudes::TaIndexSet< StateAttr >, faudes::TaIndexSet< AttributeCFlags >, faudes::TaIndexSet< EventAttr >, and faudes::TaIndexSet< AttributeTimedState >. Definition at line 74 of file indexset.cpp. |
|
Get maximum index used in this set (0 for emptyset).
Definition at line 66 of file indexset.cpp. |
|
Compute an Idx type signature for a Set. The value is computed by summing up the product of every index with an integer starting at 1 (for the first index) and ending at Size() (for the last index).
Definition at line 94 of file indexset.cpp. |
|
Return pretty printable index.
Reimplemented in faudes::NameSet, faudes::TaNameSet< Attr >, faudes::TaNameSet< SimConditionAttribute >, faudes::TaNameSet< AttributeCFlags >, and faudes::TaNameSet< EventAttr >. Definition at line 177 of file indexset.h. |
|
Test whether index is not 0.
Definition at line 88 of file indexset.cpp. |
|
We implement "protected privacy for template classes" by friendship. This is used for the pragmatic implemention conversion constructors. Definition at line 84 of file indexset.h. |