faudes::TaNameSet< Attr > Class Template Reference
[State, Event and Transition Set]

#include <nameset.h>

Inheritance diagram for faudes::TaNameSet< Attr >:

faudes::NameSet faudes::TaIndexSet< Attr > faudes::IndexSet faudes::IndexSet faudes::TBaseSet< Idx > faudes::TBaseSet< Idx > 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 TaIndexSet to inherit both extra features on top of IndexSet.

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 TaIndexSet, reading a file ignores unknown attributes. Thus, the above example may also be read as IndexSet.

Definition at line 463 of file nameset.h.

Public Member Functions

 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="NameSet")
 Constructor from file.
virtual ~TaNameSet (void)
 Virtual destructor.
TaNameSet NewN () const
 Return a NameSet with same symboltable as this set.
TaNameSetNewP () const
 Return an empty NameSet with same SymbolTable as this set.
template<class OtherAttr>
void CopyWithoutAttributes (TaNameSet< OtherAttr > &rOtherSet) const
 Copy this set to any nameset, ignore attributes.
bool Insert (Idx index)
 Add an element by index.
bool Insert (Idx index, 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.
bool Erase (Idx index)
 Delete element by index.
bool Erase (const std::string &rName)
 Delete element by symbolic name.
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.
std::string Str (Idx index) const
 Return pretty printable symbolic name for index.

Protected Member Functions

void DoWrite (TokenWriter &tw, const std::string &rLabel) const
 Write to TokenWriter, see TBaseSet for public wrappers.
void DoDWrite (TokenWriter &tw) const
 Write debug info to TokenWriter, see TBaseSet for public wrappers.
void DoRead (TokenReader &tr, const std::string &rLabel="NameSet")
 Read from TokenReader, see TBaseSet for public wrappers.

Friends

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


Constructor & Destructor Documentation

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

Constructor for NameSet referring to the static SymbolTable.

Definition at line 752 of file nameset.h.

template<class Attr>
faudes::TaNameSet< Attr >::TaNameSet const TaNameSet< Attr > &  rOtherSet  ) 
 

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

Parameters:
rOtherSet Set to copy

Definition at line 760 of file nameset.h.

template<class Attr>
faudes::TaNameSet< Attr >::TaNameSet const NameSet rOtherSet  ) 
 

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

Parameters:
rOtherSet Set to copy

Definition at line 771 of file nameset.h.

template<class Attr>
faudes::TaNameSet< Attr >::TaNameSet const std::string &  rFilename,
const std::string &  rLabel = "NameSet"
 

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 781 of file nameset.h.

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

Virtual destructor.

Definition at line 509 of file nameset.h.


Member Function Documentation

template<class Attr>
template<class OtherAttr>
void faudes::TaNameSet< Attr >::CopyWithoutAttributes TaNameSet< OtherAttr > &  rOtherSet  )  const
 

Copy this set to any nameset, ignore attributes.

Parameters:
rOtherSet NameSet with no attributes

Definition at line 806 of file nameset.h.

template<class Attr>
void faudes::TaNameSet< Attr >::DoDWrite TokenWriter tw  )  const [protected, virtual]
 

Write debug info to TokenWriter, see TBaseSet for public wrappers.

The debug version writes a format that includes symbolic names and indices.

Parameters:
tw Reference to TokenWriter
Exceptions:
Exception 
  • IO errors (id 2)

Reimplemented from faudes::NameSet.

Definition at line 839 of file nameset.h.

template<class Attr>
void faudes::TaNameSet< Attr >::DoRead TokenReader tr,
const std::string &  rLabel = "NameSet"
[protected, virtual]
 

Read from TokenReader, see TBaseSet for public wrappers.

It is an error if the file contains an index (id 52).

Parameters:
tr Reference to TokenReader
rLabel Label to read
Exceptions:
Exception 
  • IO errors (id 1)
  • token mismatch (id 50, 51, 52)

Reimplemented from faudes::TaIndexSet< Attr >.

Definition at line 853 of file nameset.h.

template<class Attr>
void faudes::TaNameSet< Attr >::DoWrite TokenWriter tw,
const std::string &  rLabel
const [protected, virtual]
 

Write to TokenWriter, see TBaseSet for public wrappers.

Parameters:
tw Reference to TokenWriter
rLabel Label for set in file
Exceptions:
Exception 
  • IO errors (id 2)

Reimplemented from faudes::TaIndexSet< Attr >.

Definition at line 815 of file nameset.h.

template<class Attr>
TaNameSet< Attr >::Iterator faudes::TaNameSet< Attr >::Erase const Iterator pos  )  [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::TaIndexSet< Attr >.

Definition at line 989 of file nameset.h.

template<class Attr>
bool faudes::TaNameSet< Attr >::Erase const std::string &  rName  ) 
 

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 974 of file nameset.h.

template<class Attr>
bool faudes::TaNameSet< Attr >::Erase Idx  index  ) 
 

Delete element by index.

Symbolic name is not removed from SymbolTable.

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

Reimplemented from faudes::TaIndexSet< Attr >.

Definition at line 967 of file nameset.h.

template<class Attr>
void faudes::TaNameSet< Attr >::EraseSet const TaNameSet< Attr > &  rOtherSet  ) 
 

Erase elements indicated by rOtherSet.

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

Definition at line 1009 of file nameset.h.

template<class Attr>
void faudes::TaNameSet< Attr >::EraseSet const NameSet rOtherSet  ) 
 

Erase elements indicated by rOtherSet.

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

Reimplemented from faudes::NameSet.

Definition at line 995 of file nameset.h.

template<class Attr>
Idx faudes::TaNameSet< Attr >::Insert const std::string &  rName,
const Attr &  rAttr
 

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 930 of file nameset.h.

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

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 922 of file nameset.h.

template<class Attr>
bool faudes::TaNameSet< Attr >::Insert Idx  index,
const Attr &  rAttr
 

Add an element by index incl.

attribute

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

Reimplemented from faudes::TaIndexSet< Attr >.

Definition at line 908 of file nameset.h.

template<class Attr>
bool faudes::TaNameSet< Attr >::Insert Idx  index  ) 
 

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:
index Index to add
Returns:
True, if element was new to set
Exceptions:
Exception 
  • no symbolic name for index (id 65)

Reimplemented from faudes::TaIndexSet< Attr >.

Definition at line 894 of file nameset.h.

template<class Attr>
void faudes::TaNameSet< Attr >::InsertSet const TaNameSet< Attr > &  rOtherSet  ) 
 

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 953 of file nameset.h.

template<class Attr>
void faudes::TaNameSet< Attr >::InsertSet const NameSet rOtherSet  ) 
 

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 939 of file nameset.h.

template<class Attr>
TaNameSet< Attr > faudes::TaNameSet< Attr >::NewN  )  const
 

Return a NameSet with same symboltable as this set.

Returns:
New empty TaNameSet

Reimplemented from faudes::NameSet.

Definition at line 789 of file nameset.h.

template<class Attr>
TaNameSet< Attr > * faudes::TaNameSet< Attr >::NewP  )  const
 

Return an empty NameSet with same SymbolTable as this set.

Returns:
Pointer to new empty NameSet on heap

Reimplemented from faudes::NameSet.

Definition at line 797 of file nameset.h.

template<class Attr>
std::string faudes::TaNameSet< Attr >::Str Idx  index  )  const
 

Return pretty printable symbolic name for index.

Primary meant for debugging messages.

Parameters:
index Index to print
Returns:
String

Reimplemented from faudes::NameSet.

Definition at line 1023 of file nameset.h.


Friends And Related Function Documentation

template<class Attr>
friend class TaNameSet [friend]
 

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

This is used for the pragmatic implemention conversion constructors.

Reimplemented from faudes::NameSet.

Definition at line 469 of file nameset.h.


The documentation for this class was generated from the following file:
Generated on Fri May 9 11:26:48 2008 for libFAUDES 2.09b by  doxygen 1.4.4