| |
libFAUDES
Sections
Index
|
faudes::IndexSet Class Reference |
Public Types | |
typedef TBaseSet< Idx >::Iterator | Iterator |
Iterators on indexset. | |
Public Member Functions | |
virtual IndexSet * | New (void) const |
Construct on heap. | |
virtual IndexSet * | Copy (void) const |
Construct on heap. | |
virtual const IndexSet * | Cast (const Type *pOther) const |
Cast other object to this type. | |
virtual IndexSet & | Assign (const Type &rSrc) |
Assign configuration data from other object. | |
virtual bool | Equal (const Type &rOther) const |
Test equality of configuration data. | |
virtual IndexSet & | operator= (const IndexSet &rSrc) |
virtual bool | operator== (const IndexSet &rOther) const |
virtual bool | operator!= (const IndexSet &rOther) const |
IndexSet (void) | |
Constructor. | |
IndexSet (const TBaseSet< Idx > &rOtherSet) | |
Copy-constructor. | |
IndexSet (const std::string &rFilename, const std::string &rLabel="") | |
Construct from file. | |
virtual | ~IndexSet (void) |
Virtual destructor. | |
Idx | MaxIndex (void) const |
Get maximum index used in this set (0 for emptyset). | |
bool | Valid (const Idx &rIndex) const |
Test whether index is not 0. | |
Idx | Insert (void) |
Insert new index to set. | |
bool | Insert (const Idx &rIndex) |
Insert specified index. | |
Idx | Signature (void) const |
Compute an Idx type signature for a Set. | |
std::string | Str (const Idx &rIndex) const |
Return pretty printable index. | |
Protected Member Functions | |
virtual IndexSet & | DoAssign (const IndexSet &rSource) |
Assign my members. | |
virtual void | DoWrite (TokenWriter &tw, const std::string &rLabel="", const Type *pContext=0) const |
Write to TokenWriter, see Type::Write for public wrappers. | |
virtual void | DoRead (TokenReader &rTr, const std::string &rLabel="", const Type *pContext=0) |
Read from TokenReader, see Type::Read for public wrappers. | |
Friends | |
class | TaIndexSet |
We implement "protected privacy for template classes" by friendship. |
typedef TBaseSet<Idx>::Iterator faudes::IndexSet::Iterator |
Iterators on indexset.
Reimplemented in faudes::TaIndexSet< Attr >, faudes::TaIndexSet< faudes::AttributeTimedState >, faudes::TaIndexSet< faudes::HioStateFlags >, faudes::TaIndexSet< StateAttr >, and faudes::TaIndexSet< faudes::DiagLabelSet >.
Definition at line 141 of file indexset.h.
faudes::IndexSet::IndexSet | ( | void | ) |
faudes::IndexSet::IndexSet | ( | const std::string & | rFilename, | |
const std::string & | rLabel = "" | |||
) |
Construct from file.
Uses the Read(TokenReader&, const std::string&) function to read. a IndexSet from section rLabel in file rFilename.
rFilename | Name of file to read | |
rLabel | Section to read |
Exception |
|
Definition at line 48 of file indexset.cpp.
virtual faudes::IndexSet::~IndexSet | ( | void | ) | [inline, virtual] |
IndexSet * faudes::IndexSet::New | ( | void | ) | const [virtual] |
Construct on heap.
Technically not a constructor, this function creates an object with the same type Type. New() is defined as a virtual function and derived classes are meant to re-implement with the appropiate constructor. This can be done via the provided macros FAUDES_TYPE_DECLARATION and FAUDES_TYPE_IMPLEMENTATION. As with new, it is the callers reponsabilty to delete the object when no longer needed.
Reimplemented from faudes::TBaseSet< T, Cmp >.
Reimplemented in faudes::TaIndexSet< Attr >, faudes::TaIndexSet< faudes::AttributeTimedState >, faudes::TaIndexSet< faudes::HioStateFlags >, faudes::TaIndexSet< StateAttr >, and faudes::TaIndexSet< faudes::DiagLabelSet >.
Definition at line 29 of file indexset.cpp.
IndexSet * faudes::IndexSet::Copy | ( | void | ) | const [virtual] |
Construct on heap.
Technically not a constructor, this function creates an object with the same type Type and the same configuration. Copy() is defined as a virtual function and derived classes are meant to re-implement with the appropiate copy constructor. This can be done via the provided macros FAUDES_TYPE_DECLARATION and FAUDES_TYPE_IMPLEMENTATION. As with new, it is the callers reponsabilty to delete the object when no longer needed.
Reimplemented from faudes::TBaseSet< T, Cmp >.
Reimplemented in faudes::TaIndexSet< Attr >, faudes::TaIndexSet< faudes::AttributeTimedState >, faudes::TaIndexSet< faudes::HioStateFlags >, faudes::TaIndexSet< StateAttr >, and faudes::TaIndexSet< faudes::DiagLabelSet >.
Definition at line 29 of file indexset.cpp.
Cast other object to this type.
Enables the run-time interface to test whether pObject is derived from this object. This feature is used e.g. in the faudes container classes to test attributes. Derived classes must reimplement this function using the appropriate dynamic cast.
Re-implementation can be done via the convenience macros FAUDES_TYPE_DECLARATION and FAUDES_TYPE_IMPLEMENTATION.
Reimplemented from faudes::TBaseSet< T, Cmp >.
Reimplemented in faudes::TaIndexSet< Attr >, faudes::TaIndexSet< faudes::AttributeTimedState >, faudes::TaIndexSet< faudes::HioStateFlags >, faudes::TaIndexSet< StateAttr >, and faudes::TaIndexSet< faudes::DiagLabelSet >.
Definition at line 29 of file indexset.cpp.
Assign configuration data from other object.
Derived classes should reimplement this method to first try to cast the source to the respective class. If successful, the protected function DoAssign is invoked to perform the actual assignment. If the cast fails, the Assign method of the parent class is called. Thus, faudes objects are up- and downcatsted for assignment, maintaining as much of the source data as digestable by the destination object. On the downside, there is no sensible typechecking at compile-time.
Re-implementation can be done via the convenience macros FAUDES_TYPE_DECLARATION and FAUDES_TYPE_IMPLEMENTATION.
rSrc | Source to copy from |
Reimplemented from faudes::TBaseSet< T, Cmp >.
Reimplemented in faudes::TaIndexSet< Attr >, faudes::TaIndexSet< faudes::AttributeTimedState >, faudes::TaIndexSet< faudes::HioStateFlags >, faudes::TaIndexSet< StateAttr >, and faudes::TaIndexSet< faudes::DiagLabelSet >.
Definition at line 29 of file indexset.cpp.
bool faudes::IndexSet::Equal | ( | const Type & | rOther | ) | const [virtual] |
Test equality of configuration data.
Derived classes should reimplement this method to return true if both actual types and configuration data match. The object name is not consired in the test.
This method calls the virtual method DoEqual(). Re-implementation can be done via the convenience macros FAUDES_TYPE_DECLARATION and FAUDES_TYPE_IMPLEMENTATION.
rOther | Other objevt to compare with. |
Reimplemented from faudes::TBaseSet< T, Cmp >.
Reimplemented in faudes::TaIndexSet< Attr >, faudes::TaIndexSet< faudes::AttributeTimedState >, faudes::TaIndexSet< faudes::HioStateFlags >, faudes::TaIndexSet< StateAttr >, and faudes::TaIndexSet< faudes::DiagLabelSet >.
Definition at line 29 of file indexset.cpp.
Reimplemented in faudes::TaIndexSet< Attr >, faudes::TaIndexSet< faudes::AttributeTimedState >, faudes::TaIndexSet< faudes::HioStateFlags >, faudes::TaIndexSet< StateAttr >, and faudes::TaIndexSet< faudes::DiagLabelSet >.
Definition at line 29 of file indexset.cpp.
bool faudes::IndexSet::operator== | ( | const IndexSet & | rOther | ) | const [virtual] |
Definition at line 29 of file indexset.cpp.
bool faudes::IndexSet::operator!= | ( | const IndexSet & | rOther | ) | const [virtual] |
Definition at line 29 of file indexset.cpp.
Idx faudes::IndexSet::MaxIndex | ( | void | ) | const |
Get maximum index used in this set (0 for emptyset).
Definition at line 183 of file indexset.cpp.
bool faudes::IndexSet::Valid | ( | const Idx & | rIndex | ) | const |
Test whether index is not 0.
rIndex | Index to test |
Definition at line 205 of file indexset.cpp.
Idx faudes::IndexSet::Insert | ( | void | ) |
Insert new index to set.
Reimplemented in faudes::TaIndexSet< Attr >, faudes::TaIndexSet< faudes::AttributeTimedState >, faudes::TaIndexSet< faudes::HioStateFlags >, faudes::TaIndexSet< StateAttr >, and faudes::TaIndexSet< faudes::DiagLabelSet >.
Definition at line 191 of file indexset.cpp.
bool faudes::IndexSet::Insert | ( | const Idx & | rIndex | ) |
Insert specified index.
rIndex | Index to insert |
Reimplemented in faudes::TaIndexSet< Attr >, faudes::TaIndexSet< faudes::AttributeTimedState >, faudes::TaIndexSet< faudes::HioStateFlags >, faudes::TaIndexSet< StateAttr >, and faudes::TaIndexSet< faudes::DiagLabelSet >.
Definition at line 199 of file indexset.cpp.
Idx faudes::IndexSet::Signature | ( | void | ) | const |
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 211 of file indexset.cpp.
std::string faudes::IndexSet::Str | ( | const Idx & | rIndex | ) | const [inline] |
Return pretty printable index.
rIndex | Index to print |
Definition at line 180 of file indexset.h.
Assign my members.
This method maintains attributes provided that the type can be appropriately casted.
rSource | Source to copy from |
Definition at line 56 of file indexset.cpp.
void faudes::IndexSet::DoWrite | ( | TokenWriter & | tw, | |
const std::string & | rLabel = "" , |
|||
const Type * | pContext = 0 | |||
) | const [protected, virtual] |
Write to TokenWriter, see Type::Write for public wrappers.
Appends the IndexSet to TokenWriter. This will write a section with label as specified 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>
tw | Reference to TokenWriter | |
rLabel | Label of section to write, defaults to name of set or "IndexSet" | |
pContext | Write context to provide contextual information |
Exception |
|
Reimplemented from faudes::TBaseSet< T, Cmp >.
Definition at line 65 of file indexset.cpp.
void faudes::IndexSet::DoRead | ( | TokenReader & | rTr, | |
const std::string & | rLabel = "" , |
|||
const Type * | pContext = 0 | |||
) | [protected, virtual] |
Read from TokenReader, see Type::Read for public wrappers.
This method invokes TokenReader::SeekBegin() to seek the specified section, reads subsequent integer tokens as indexes, and calls matching TokenReader::SeekEnd(). If no section is specified, the section is assumed to start at the current position of the token stream. If the current position is no begin token, the section "IndexSet" is read. When used by a derived class with attributes, attributes are read, too.
rTr | Reference to tokenreader | |
rLabel | Section to read, defaults to current begin label or else "IndexSet" | |
pContext | Read context to provide contextual information |
Exception |
|
Reimplemented from faudes::TBaseSet< T, Cmp >.
Definition at line 115 of file indexset.cpp.
friend class TaIndexSet [friend] |
We implement "protected privacy for template classes" by friendship.
This is used for the pragmatic implemention conversion constructors.
Definition at line 87 of file indexset.h.
libFAUDES 2.14g --- 2009-12-3 --- c++ source docu by doxygen 1.5.6