libFAUDES

Sections

Index

faudes::TaNameSet< Attr > Class Template Reference
[Classes]

#include <nameset.h>

Inherits faudes::NameSet, and faudes::TaBaseSet< long unsigned int, Attr >.

Inherited by faudes::SimConditionSet.

List of all members.


Detailed Description

template<class Attr>
class faudes::TaNameSet< Attr >

Set of indices with symbolic names and attributes.

This class is derived from NameSet and TaBaseSet.

The file format is demonstrated by the following example of a set "Alphabet" consisting of events "alpha", "beta" and "gamma" with "gamma" having some attribute (see eg AtributeFlags)

 <Alphabet> 
 "alpha" 
 "beta" 
 "gamma" 0x0f
 <\Alphabet> 
As with TaBaseSet, reading a file ignores unknown attributes. Thus, the above example may also be read as NameSet.

Definition at line 520 of file nameset.h.


Public Member Functions

virtual TaNameSetNew (void) const
 Faudes Type interface.
virtual TaNameSetCopy (void) const
 Faudes Type interface.
virtual const TaNameSetCast (const Type *pOther) const
 Faudes Type interface.
virtual TaNameSetAssign (const Type &rSrc)
 Assign configuration data from other object.
virtual bool Equal (const Type &rOther) const
 Test equality of configuration data.
virtual TaNameSetoperator= (const TaNameSet &rSrc)
virtual bool operator== (const TaNameSet &rOther) const
virtual bool operator!= (const TaNameSet &rOther) const
 TaNameSet (void)
 Constructor for NameSet referring to the static SymbolTable.
 TaNameSet (const TaNameSet &rOtherSet)
 Copy-constructor from other TaNameSet (incl attributes and symboltable).
 TaNameSet (const NameSet &rOtherSet)
 Constructor from NameSet (sets default attributes, same symboltable).
 TaNameSet (const std::string &rFilename, const std::string &rLabel="")
 Constructor from file.
virtual ~TaNameSet (void)
 Virtual destructor.
TaNameSet NewN () const
 Return a NameSet with same symboltable as this set.
virtual TaNameSetAssign (const NameSet &rSrc)
 Relaxed assignment method (uses base class to be maintain attributes).
virtual TaNameSetoperator= (const NameSet &rSrc)
 Relaxed assignment operator (uses base class to be maintain attributes).
bool Insert (const Idx &rIndex)
 Add an element by index.
bool Insert (const Idx &rIndex, const Attr &rAttr)
 Add an element by index incl.
Idx Insert (const std::string &rName)
 Add an element by its symbolic name.
Idx Insert (const std::string &rName, const Attr &rAttr)
 Add an element by its symbolic name.
void InsertSet (const NameSet &rOtherSet)
 Inserts elements of rOtherSet.
void InsertSet (const TaNameSet &rOtherSet)
 Inserts elements of rOtherSet incl attributes Attributes of this set are maintained, new elements are inserted with attribute.
virtual bool Erase (const Idx &rIndex)
 Delete element by index.
virtual bool Erase (const std::string &rName)
 Delete element by symbolic name.
virtual Iterator Erase (const Iterator &pos)
 Delete element by iterator.
void EraseSet (const NameSet &rOtherSet)
 Erase elements indicated by rOtherSet.
void EraseSet (const TaNameSet &rOtherSet)
 Erase elements indicated by rOtherSet.
void RestrictSet (const NameSet &rOtherSet)
 Restrict elements indicated by rOtherSet.
void RestrictSet (const TaNameSet &rOtherSet)
 Restrict elements indicated by rOtherSet.
virtual void Attributes (const NameSet &rOtherSet)
 Set attributes.
virtual void Attributes (const TaNameSet &rOtherSet)
 Set attributes.
std::string Str (const Idx &rIndex) const
 Return pretty printable symbolic name for index.

Protected Member Functions

virtual TaNameSetDoAssign (const TaNameSet &rSourceSet)
 Assign to other name set.

Friends

class NameSet
 We implement "protected privacy for template classes" by friendship.

Constructor & Destructor Documentation

template<class Attr>
faudes::TaNameSet< Attr >::TaNameSet ( void   )  [inline]

Constructor for NameSet referring to the static SymbolTable.

Definition at line 831 of file nameset.h.

template<class Attr>
faudes::TaNameSet< Attr >::TaNameSet ( const TaNameSet< Attr > &  rOtherSet  )  [inline]

Copy-constructor from other TaNameSet (incl attributes and symboltable).

Parameters:
rOtherSet Set to copy

Definition at line 843 of file nameset.h.

template<class Attr>
faudes::TaNameSet< Attr >::TaNameSet ( const NameSet rOtherSet  )  [inline]

Constructor from NameSet (sets default attributes, same symboltable).

Parameters:
rOtherSet Set to copy

Definition at line 855 of file nameset.h.

template<class Attr>
faudes::TaNameSet< Attr >::TaNameSet ( const std::string &  rFilename,
const std::string &  rLabel = "" 
) [inline]

Constructor from file.

This constructor reads a NameSet from a file using the DoRead(TokenReader&, const std::String&) function. The section is specified by rLabel and the static SymbolTable is used.

Parameters:
rFilename Name of File
rLabel Section for the set in the file;

Definition at line 867 of file nameset.h.

template<class Attr>
virtual faudes::TaNameSet< Attr >::~TaNameSet ( void   )  [inline, virtual]

Virtual destructor.

Definition at line 568 of file nameset.h.


Member Function Documentation

template<class Attr>
TaNameSet< Attr > * faudes::TaNameSet< Attr >::New ( void   )  const [inline, virtual]

Faudes Type interface.

Construct object of same type on heap.

Reimplemented from faudes::TaBaseSet< T, Attr, Cmp >.

Reimplemented in faudes::SimConditionSet.

Definition at line 879 of file nameset.h.

template<class Attr>
TaNameSet< Attr > * faudes::TaNameSet< Attr >::Copy ( void   )  const [inline, virtual]

Faudes Type interface.

Construct copy on heap.

Reimplemented from faudes::TaBaseSet< T, Attr, Cmp >.

Reimplemented in faudes::SimConditionSet.

Definition at line 824 of file nameset.h.

template<class Attr>
const TaNameSet< Attr > * faudes::TaNameSet< Attr >::Cast ( const Type pType  )  const [inline, virtual]

Faudes Type interface.

Cast object to my type.

Reimplemented from faudes::TaBaseSet< T, Attr, Cmp >.

Reimplemented in faudes::SimConditionSet.

Definition at line 825 of file nameset.h.

template<class Attr>
TaNameSet< Attr > & faudes::TaNameSet< Attr >::Assign ( const Type rSrc  )  [inline, virtual]

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.

Parameters:
rSrc Source to copy from
Returns:
Reference to this object.

Reimplemented from faudes::NameSet.

Reimplemented in faudes::SimConditionSet.

Definition at line 826 of file nameset.h.

template<class Attr>
bool faudes::TaNameSet< Attr >::Equal ( const Type rOther  )  const [inline, 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.

Parameters:
rOther Other objevt to compare with.
Returns:
True on match.

Reimplemented from faudes::NameSet.

Reimplemented in faudes::SimConditionSet.

Definition at line 827 of file nameset.h.

template<class Attr>
TaNameSet< Attr > & faudes::TaNameSet< Attr >::operator= ( const TaNameSet< Attr > &  rSrc  )  [inline, virtual]

Definition at line 826 of file nameset.h.

template<class Attr>
bool faudes::TaNameSet< Attr >::operator== ( const TaNameSet< Attr > &  rOther  )  const [inline, virtual]

Definition at line 827 of file nameset.h.

template<class Attr>
bool faudes::TaNameSet< Attr >::operator!= ( const TaNameSet< Attr > &  rOther  )  const [inline, virtual]

Definition at line 827 of file nameset.h.

template<class Attr>
TaNameSet< Attr > faudes::TaNameSet< Attr >::NewN ( void   )  const [inline]

Return a NameSet with same symboltable as this set.

Returns:
New empty TaNameSet

Reimplemented from faudes::NameSet.

Definition at line 887 of file nameset.h.

template<class Attr>
TaNameSet< Attr > & faudes::TaNameSet< Attr >::Assign ( const NameSet rSrc  )  [inline, virtual]

Relaxed assignment method (uses base class to be maintain attributes).

Parameters:
rSrc Source from which to assign
Returns:
Ref to this set

Definition at line 907 of file nameset.h.

template<class Attr>
virtual TaNameSet& faudes::TaNameSet< Attr >::operator= ( const NameSet rSrc  )  [inline, virtual]

Relaxed assignment operator (uses base class to be maintain attributes).

Parameters:
rSrc Source from which to assign
Returns:
Ref to this set

Reimplemented from faudes::NameSet.

Definition at line 594 of file nameset.h.

template<class Attr>
bool faudes::TaNameSet< Attr >::Insert ( const Idx rIndex  )  [inline]

Add an element by index.

Index must be already known to the global SymbolTable. If the element already exists in the set, the attribute is maintained. Otherwise, the element is inserted with default attribute.

Parameters:
rIndex Index to add
Returns:
True, if element was new to set
Exceptions:
Exception 
  • no symbolic name for index (id 65)

Reimplemented from faudes::NameSet.

Definition at line 919 of file nameset.h.

template<class Attr>
bool faudes::TaNameSet< Attr >::Insert ( const Idx rIndex,
const Attr &  rAttr 
) [inline]

Add an element by index incl.

attribute

Parameters:
rIndex Index to add
rAttr Attribute to add
Returns:
True, if index was new to set
Exceptions:
Exception 
  • no symbolic name for index (id 65)

Definition at line 933 of file nameset.h.

template<class Attr>
Idx faudes::TaNameSet< Attr >::Insert ( const std::string &  rName  )  [inline]

Add an element by its symbolic name.

If the name is unknown, a new index will be generated and recorded in the symboltable. If the name is known, the corresponding index will be added to the set. If the element already exists in the set, the attribute is maintained. Otherwise, the element is inserted with default attribute.

Parameters:
rName symbolic name of element to add
Returns:
Index of (new) element

Reimplemented from faudes::NameSet.

Definition at line 947 of file nameset.h.

template<class Attr>
Idx faudes::TaNameSet< Attr >::Insert ( const std::string &  rName,
const Attr &  rAttr 
) [inline]

Add an element by its symbolic name.

If the name is unknown, a new index will be generated and recorded in the symboltable. If the name is known, the corresponding index will be added to the set.

Parameters:
rName symbolic name of element to add
rAttr Attribute
Returns:
Index of (new) element

Definition at line 955 of file nameset.h.

template<class Attr>
void faudes::TaNameSet< Attr >::InsertSet ( const NameSet rOtherSet  )  [inline, virtual]

Inserts elements of rOtherSet.

Attributes of this set are maintained, newly inserted elements have default attribute.

Parameters:
rOtherSet Other StateSet
Exceptions:
Exception 
  • symboltable mismatch (id 67)

Reimplemented from faudes::NameSet.

Definition at line 964 of file nameset.h.

template<class Attr>
void faudes::TaNameSet< Attr >::InsertSet ( const TaNameSet< Attr > &  rOtherSet  )  [inline]

Inserts elements of rOtherSet incl attributes Attributes of this set are maintained, new elements are inserted with attribute.

Parameters:
rOtherSet Other StateSet

Definition at line 978 of file nameset.h.

template<class Attr>
bool faudes::TaNameSet< Attr >::Erase ( const Idx rIndex  )  [inline, virtual]

Delete element by index.

Symbolic name is not removed from SymbolTable.

Parameters:
rIndex Index to delete
Returns:
True if element did exist

Reimplemented from faudes::NameSet.

Definition at line 992 of file nameset.h.

template<class Attr>
bool faudes::TaNameSet< Attr >::Erase ( const std::string &  rName  )  [inline, virtual]

Delete element by symbolic name.

Symbolic name is not removed from SymbolTable

Parameters:
rName Symbolic name of element to dlete
Returns:
True if element did exist
Exceptions:
Exception 
  • name not found in Symboltable (id 66)

Reimplemented from faudes::NameSet.

Definition at line 999 of file nameset.h.

template<class Attr>
TaNameSet< Attr >::Iterator faudes::TaNameSet< Attr >::Erase ( const Iterator pos  )  [inline, virtual]

Delete element by iterator.

Symbolic nam is not removed from SymbolTable.

Parameters:
pos TaNameSet::iterator
Returns:
Iterator to next element
Exceptions:
Exception 
  • invalid iterator (id 62)

Reimplemented from faudes::TaBaseSet< T, Attr, Cmp >.

Definition at line 1014 of file nameset.h.

template<class Attr>
void faudes::TaNameSet< Attr >::EraseSet ( const NameSet rOtherSet  )  [inline]

Erase elements indicated by rOtherSet.

Exceptions:
Exception 
  • symboltable mismatch (id 67)
Parameters:
rOtherSet Other StateSet

Reimplemented from faudes::NameSet.

Definition at line 1020 of file nameset.h.

template<class Attr>
void faudes::TaNameSet< Attr >::EraseSet ( const TaNameSet< Attr > &  rOtherSet  )  [inline]

Erase elements indicated by rOtherSet.

Exceptions:
Exception 
  • symboltable mismatch (id 67)
Parameters:
rOtherSet Other StateSet

Definition at line 1034 of file nameset.h.

template<class Attr>
void faudes::TaNameSet< Attr >::RestrictSet ( const NameSet rOtherSet  )  [inline]

Restrict elements indicated by rOtherSet.

Exceptions:
Exception 
  • symboltable mismatch (id 67)
Parameters:
rOtherSet Other EventSet

Reimplemented from faudes::NameSet.

Definition at line 1048 of file nameset.h.

template<class Attr>
void faudes::TaNameSet< Attr >::RestrictSet ( const TaNameSet< Attr > &  rOtherSet  )  [inline]

Restrict elements indicated by rOtherSet.

Exceptions:
Exception 
  • symboltable mismatch (id 67)
Parameters:
rOtherSet Other StateSet

Definition at line 1062 of file nameset.h.

template<class Attr>
void faudes::TaNameSet< Attr >::Attributes ( const NameSet 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.

Parameters:
rOtherSet Other IndexSet
Exceptions:
Exception 
  • Element does not exist (63)
  • Cannot cast attribute type (63)

Reimplemented from faudes::NameSet.

Definition at line 1090 of file nameset.h.

template<class Attr>
void faudes::TaNameSet< Attr >::Attributes ( const TaNameSet< 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.

Parameters:
rOtherSet Other IndexSet

Definition at line 1076 of file nameset.h.

template<class Attr>
std::string faudes::TaNameSet< Attr >::Str ( const Idx rIndex  )  const [inline]

Return pretty printable symbolic name for index.

Primary meant for debugging messages.

Parameters:
rIndex Index to print
Returns:
String

Reimplemented from faudes::NameSet.

Definition at line 1105 of file nameset.h.

template<class Attr>
TaNameSet< Attr > & faudes::TaNameSet< Attr >::DoAssign ( const TaNameSet< Attr > &  rSourceSet  )  [inline, protected, virtual]

Assign to other name set.

Performs a fake copy, see TBaseSet. This function maintains attributes.

Parameters:
rSourceSet Destination to copy from
Returns:
ref to this set

Definition at line 895 of file nameset.h.


Friends And Related Function Documentation

template<class Attr>
friend class NameSet [friend]

We implement "protected privacy for template classes" by friendship.

This is used for the pragmatic implemention conversion constructors.

Definition at line 528 of file nameset.h.


The documentation for this class was generated from the following file:

libFAUDES 2.14g --- 2009-12-3 --- c++ source docu by doxygen 1.5.6