faudes::IndexSet Class Reference
[State, Event and Transition Set]

#include <indexset.h>

Inheritance diagram for faudes::IndexSet:

faudes::TBaseSet< Idx > faudes::NameSet faudes::TaIndexSet< Attr > faudes::TaNameSet< Attr > faudes::TaNameSet< Attr > List of all members.

Detailed Description

Set of indices.

This class is built on top of the faudes version TBaseSet of STL sets. It provides the essentials of the STL interface and plus token based file IO. It 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>  
Theere is a minimum number of consecutive indices for the use of the consecutive section defined in definitions.h.

Definition at line 72 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

void DoWrite (TokenWriter &tw, 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, see TBaseSet for public wrappers.

Friends

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


Member Typedef Documentation

typedef TBaseSet<Idx>::Iterator faudes::IndexSet::Iterator
 

Iterators on indexset.

Definition at line 132 of file indexset.h.


Constructor & Destructor Documentation

faudes::IndexSet::IndexSet void   ) 
 

Constructor.

Definition at line 29 of file indexset.cpp.

faudes::IndexSet::IndexSet const TBaseSet< Idx > &  rOtherSet  ) 
 

Copy-constructor.

Definition at line 37 of file indexset.cpp.

faudes::IndexSet::IndexSet const std::string &  rFilename,
const std::string &  rLabel = "IndexSet"
 

Construct from file.

Uses the Read(TokenReader&, const std::string&) function to read. a IndexSet from section rLabel in file rFilename.

Parameters:
rFilename Name of file to read
rLabel Section to read
Exceptions:
Exception 
  • IO Errors (id 1)
  • token musmatch (id 50, 51, 52)

Definition at line 44 of file indexset.cpp.

virtual faudes::IndexSet::~IndexSet void   )  [inline, virtual]
 

Virtual destructor.

Definition at line 110 of file indexset.h.


Member Function Documentation

void faudes::IndexSet::DoRead TokenReader rTr,
const std::string &  rLabel = "IndexSet"
[protected, virtual]
 

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.

Parameters:
rTr Reference to tokenreader
rLabel Section to read
Exceptions:
Exception 
  • IO errors (id 1)
  • token mismatch (id 50, 51, 52)

Reimplemented from faudes::TBaseSet< Idx >.

Reimplemented in faudes::TaIndexSet< Attr >, faudes::NameSet, faudes::TaNameSet< Attr >, faudes::TaIndexSet< StateAttr >, faudes::TaIndexSet< EventAttr >, and faudes::TaNameSet< EventAttr >.

Definition at line 58 of file indexset.cpp.

void faudes::IndexSet::DoWrite TokenWriter tw,
const std::string &  rLabel = ""
const [protected, virtual]
 

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.

Parameters:
tw Reference to TokenWriter
rLabel Label of section to write, defaults to name of set
Exceptions:
Exception 
  • IO errors (id 2)

Reimplemented from faudes::TBaseSet< Idx >.

Reimplemented in faudes::TaIndexSet< Attr >, faudes::NameSet, faudes::TaNameSet< Attr >, faudes::TaIndexSet< StateAttr >, faudes::TaIndexSet< EventAttr >, and faudes::TaNameSet< EventAttr >.

Definition at line 52 of file indexset.cpp.

bool faudes::IndexSet::Insert Idx  idx  ) 
 

Insert specified index.

Parameters:
idx Index to insert
Returns:
True if index was new to set

Reimplemented in faudes::TaIndexSet< Attr >, faudes::NameSet, faudes::TaNameSet< Attr >, faudes::TaIndexSet< StateAttr >, faudes::TaIndexSet< EventAttr >, and faudes::TaNameSet< EventAttr >.

Definition at line 81 of file indexset.cpp.

Idx faudes::IndexSet::Insert void   ) 
 

Insert new index to set.

Returns:
New index

Reimplemented in faudes::TaIndexSet< Attr >, faudes::TaIndexSet< StateAttr >, and faudes::TaIndexSet< EventAttr >.

Definition at line 73 of file indexset.cpp.

Idx faudes::IndexSet::MaxIndex void   )  const
 

Get maximum index used in this set (0 for emptyset).

Returns:
max indices

Definition at line 65 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).

Returns:
Idx type set signature

Definition at line 93 of file indexset.cpp.

std::string faudes::IndexSet::Str Idx  index  )  const [inline]
 

Return pretty printable index.

Parameters:
index Index to print
Returns:
String

Reimplemented in faudes::NameSet, faudes::TaNameSet< Attr >, and faudes::TaNameSet< EventAttr >.

Definition at line 171 of file indexset.h.

bool faudes::IndexSet::Valid Idx  index  )  const
 

Test whether index is not 0.

Parameters:
index Index to test
Returns:
True if idx!=0

Definition at line 87 of file indexset.cpp.


Friends And Related Function Documentation

friend class TaIndexSet [friend]
 

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

This is used for the pragmatic implemention conversion constructors.

Reimplemented in faudes::TaIndexSet< Attr >, faudes::TaIndexSet< StateAttr >, and faudes::TaIndexSet< EventAttr >.

Definition at line 78 of file indexset.h.


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