#include <cfl_indexset.h>

Public Member Functions

 TaIndexSet (void)
 
 TaIndexSet (const TaIndexSet &rOtherSet)
 
 TaIndexSet (const IndexSet &rOtherSet)
 
 TaIndexSet (const std::string &rFilename, const std::string &rLabel="")
 
virtual ~TaIndexSet (void)
 
virtual TaIndexSetAssign (const TBaseSet< Idx > &rSrc)
 
virtual TaIndexSetoperator= (const IndexSet &rSrc)
 
Idx Insert (void)
 
Idx Insert (const Attr &rAttr)
 
bool Insert (const Idx &rIndex)
 
bool Insert (const Idx &rIndex, const Attr &attr)
 
virtual void InsertSet (const IndexSet &rOtherSet)
 
virtual void InsertSet (const TBaseSet< Idx > &rOtherSet)
 
bool Erase (const Idx &rIndex)
 
IndexSet::Iterator Erase (const Iterator &pos)
 
void EraseSet (const IndexSet &rOtherSet)
 
virtual void EraseSet (const TBaseSet< Idx > &rOtherSet)
 
void RestrictSet (const IndexSet &rOtherSet)
 
virtual void RestrictSet (const TBaseSet< Idx > &rOtherSet)
 
const Attr * AttributeType (void) const
 
Attr * Attributep (const Idx &rElem)
 
const Attr & Attribute (const Idx &rElem) const
 
void Attribute (const Idx &rElem, const Attr &rAttr)
 
void Attribute (const Idx &rElem, const Type &rAttr)
 
void AttributeTry (const Idx &rElem, const Type &rAttr)
 
- Public Member Functions inherited from faudes::IndexSet
 IndexSet (void)
 
 IndexSet (const IndexSet &rOtherSet)
 
 IndexSet (const TBaseSet< Idx > &rOtherSet)
 
 IndexSet (const std::string &rFilename, const std::string &rLabel="")
 
virtual ~IndexSet (void)
 
Idx MaxIndex (void) const
 
bool Valid (const Idx &rIndex) const
 
Idx Insert (void)
 
bool Insert (const Idx &rIndex)
 
Idx Signature (void) const
 
std::string Str (const Idx &rIndex) const
 
- Public Member Functions inherited from faudes::TBaseSet< Idx >
 TBaseSet (void)
 
 TBaseSet (const TBaseSet &rOtherSet)
 
 TBaseSet (const std::string &rFilename, const std::string &rLabel="BaseSet")
 
virtual ~TBaseSet (void)
 
const std::string & Name (void) const
 
void Name (const std::string &rName)
 
virtual void Clear (void)
 
Idx Size (void) const
 
bool Empty (void) const
 
virtual std::string Str (const Idx &rElem) const
 
Iterator Begin (void) const
 
Iterator End (void) const
 
virtual bool Valid (const Idx &rElem) const
 
virtual bool Erase (const Idx &rElem)
 
virtual Iterator Erase (const Iterator &pos)
 
virtual void EraseSet (const TBaseSet &rOtherSet)
 
virtual void RestrictSet (const TBaseSet &rOtherSet)
 
virtual bool Disjoint (const TBaseSet &rOtherSet) const
 
virtual bool Insert (const Idx &rElem)
 
virtual Iterator Inject (const Iterator &pos, const Idx &rElem)
 
virtual void Inject (const Idx &rElem)
 
virtual void InsertSet (const TBaseSet &rOtherSet)
 
bool Exists (const Idx &rElem) const
 
Iterator Find (const Idx &rElem) const
 
TBaseSet operator+ (const TBaseSet &rOtherSet) const
 
TBaseSet operator- (const TBaseSet &rOtherSet) const
 
TBaseSet operator* (const TBaseSet &rOtherSet) const
 
bool operator<= (const TBaseSet &rOtherSet) const
 
bool operator>= (const TBaseSet &rOtherSet) const
 
bool operator< (const TBaseSet &rOtherSet) const
 
void DValid (const std::string &rMessage="") const
 
void Detach (DetachMode flag=AttrIncl) const
 
void Lock (void) const
 
virtual bool AttributeTest (const Type &rAttr) const
 
virtual TBaseSetAssignWithoutAttributes (const TBaseSet &rSourceSet)
 
virtual void Attributes (const TBaseSet &rOtherSet)
 
Idx AttributesSize (void) const
 
void ClearAttributes (void)
 
bool EqualAttributes (const TBaseSet &rOtherSet) const
 
virtual AttributeVoidAttributep (const Idx &rElem)
 
virtual const AttributeVoidAttribute (const Idx &rElem) const
 
virtual void Attribute (const Idx &rElem, const Type &rAttr)
 
virtual void ClrAttribute (const Idx &rElem)
 
virtual void XElementTag (const std::string &rTag)
 
virtual const std::string & TypeName (void) const
 
virtual void TypeName (const std::string &rType)
 
Typeoperator= (const Type &rSrc)
 
bool operator== (const Type &rOther) const
 
bool operator!= (const Type &rOther) const
 
- Public Member Functions inherited from faudes::Type
 Type (void)
 
 Type (const Type &rType)
 
virtual ~Type (void)
 
virtual TypeNew (void) const
 
virtual TypeCopy (void) const
 
virtual const TypeCast (const Type *pOther) const
 
virtual TypeAssign (const Type &rSrc)
 
Typeoperator= (const Type &rSrc)
 
virtual bool Equal (const Type &rOther) const
 
bool operator== (const Type &rOther) const
 
bool operator!= (const Type &rOther) const
 
void Write (const Type *pContext=0) const
 
void Write (const std::string &pFileName, const std::string &rLabel="", const Type *pContext=0, std::ios::openmode openmode=std::ios::out|std::ios::trunc) const
 
void Write (const std::string &pFileName, std::ios::openmode openmode) const
 
void Write (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 
virtual void XWrite (const std::string &pFileName, const std::string &rLabel="", const Type *pContext=0) const
 
void XWrite (const Type *pContext=0) const
 
void XWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 
std::string ToString (const std::string &rLabel="", const Type *pContext=0) const
 
std::string ToText (const std::string &rLabel="", const Type *pContext=0) const
 
void DWrite (const Type *pContext=0) const
 
void DWrite (const std::string &pFileName, const std::string &rLabel="", const Type *pContext=0, std::ios::openmode openmode=std::ios::out|std::ios::trunc) const
 
void DWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 
void SWrite (TokenWriter &rTw) const
 
void SWrite (void) const
 
std::string ToSText (void) const
 
void Read (const std::string &rFileName, const std::string &rLabel="", const Type *pContext=0)
 
void FromString (const std::string &rString, const std::string &rLabel="", const Type *pContext=0)
 
void Read (TokenReader &rTr, const std::string &rLabel="", const Type *pContext=0)
 
- Public Member Functions inherited from faudes::TAttrMap< Idx, Attr >
 TAttrMap (TBaseSet< Idx, std::less< Idx > > *pBaseSetRef)
 
virtual ~TAttrMap (void)
 
void AssignWithAttributes (const TBaseSet< Idx, std::less< Idx > > &rSourceSet)
 
const Attr * AttributeType (void) const
 
Attr * Attributep (const Idx &rElem)
 
const Attr & Attribute (const Idx &rElem) const
 
void Attribute (const Idx &rElem, const Type &attr)
 
void Attribute (const Idx &rElem, const Attr &attr)
 
void AttributeTry (const Idx &rElem, const Type &attr)
 
bool Insert (const Idx &rElem)
 
bool Insert (const Idx &rElem, const Attr &attr)
 
void InsertSet (const TBaseSet< Idx, std::less< Idx > > &rOtherSet)
 
bool Erase (const Idx &rElem)
 
TBaseSet< Idx, std::less< Idx > >::Iterator Erase (const typename TBaseSet< Idx, std::less< Idx > >::Iterator &pos)
 
void EraseSet (const TBaseSet< Idx, std::less< Idx > > &rOtherSet)
 
void RestrictSet (const TBaseSet< Idx, std::less< Idx > > &rOtherSet)
 

Protected Member Functions

void DoAssign (const TaIndexSet &rSource)
 
- Protected Member Functions inherited from faudes::IndexSet
void DoAssign (const IndexSet &rSource)
 
virtual void DoWrite (TokenWriter &tw, const std::string &rLabel="", const Type *pContext=0) const
 
virtual void DoXWrite (TokenWriter &tw, const std::string &rLabel="", const Type *pContext=0) const
 
virtual void DoRead (TokenReader &rTr, const std::string &rLabel="", const Type *pContext=0)
 
- Protected Member Functions inherited from faudes::TBaseSet< Idx >
virtual const std::string & XElementTag (void) const
 
virtual void DoDWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 
virtual void DoSWrite (TokenWriter &rTw) const
 
void DoAssign (const TBaseSet &rSourceSet)
 
bool DoEqual (const TBaseSet &rOtherSet) const
 
void DoAttribute (const Idx &rElem, const Type *pAttr)
 
const AttributeVoidDoAttribute (const Idx &rElem) const
 
AttributeVoidDoAttributeExplicit (const Idx &rElem)
 
TBaseSet< Idx, std::less< Idx > >::Iterator ThisIterator (const typename std::set< Idx, std::less< Idx > >::const_iterator &sit) const
 
void RelinkClients (void)
 
void AttachClient (TBaseSet *pRef) const
 
void DetachClient (TBaseSet *pRef) const
 
void AttachIterator (Iterator *pFit) const
 
void DetachIterator (Iterator *pFit) const
 
virtual const TypeDefinitionTypeDefinitionp (void) const
 
- Protected Member Functions inherited from faudes::Type
void DoAssign (const Type &rSrc)
 
bool DoEqual (const Type &rOther) const
 
virtual Token XBeginTag (const std::string &rLabel="", const std::string &rFallbackLabel="") const
 

Friends

class IndexSet
 

Additional Inherited Members

- Public Types inherited from faudes::TBaseSet< Idx >
enum  DetachMode
 
- Protected Types inherited from faudes::TBaseSet< Idx >
typedef std::set< Idx, std::less< Idx > >::iterator iterator
 
typedef std::set< Idx, std::less< Idx > >::const_iterator const_iterator
 
typedef std::map< Idx, AttributeVoid * >::iterator aiterator
 
typedef std::map< Idx, AttributeVoid * >::const_iterator const_aiterator
 
- Protected Types inherited from faudes::TAttrMap< Idx, Attr >
typedef TBaseSet< Idx, std::less< Idx > >::iterator iterator
 
typedef TBaseSet< Idx, std::less< Idx > >::const_iterator const_iterator
 
typedef TBaseSet< Idx, std::less< Idx > >::aiterator aiterator
 
typedef TBaseSet< Idx, std::less< Idx > >::const_aiterator const_aiterator
 
- Protected Attributes inherited from faudes::TBaseSet< Idx >
std::string mMyName
 
std::set< Idx, std::less< Idx > > * pSet
 
std::set< Idx, std::less< Idx > > * mpSet
 
std::map< Idx, AttributeVoid * > * pAttributes
 
std::map< Idx, AttributeVoid * > * mpAttributes
 
TBaseSet< Idx, std::less< Idx > > * pHostSet
 
std::list< TBaseSet< Idx, std::less< Idx > > * >::iterator mClientRecord
 
std::list< TBaseSet< Idx, std::less< Idx > > * > * mpClients
 
bool mDetached
 
bool mLocked
 
std::set< Iterator * > mIterators
 
std::string mXElementTagDef
 
- Protected Attributes inherited from faudes::TAttrMap< Idx, Attr >
TBaseSet< Idx, std::less< Idx > > * pBaseSet
 
- Static Protected Attributes inherited from faudes::TBaseSet< Idx >
static std::set< Idx, std::less< Idx > > msEmptySet
 
static std::map< Idx, AttributeVoid * > msEmptyAttributes
 

Detailed Description

template<class Attr>
class faudes::TaIndexSet< Attr >

Set of indices with attributes. A TaIndexSet<Attr> is a template derived from IndexSet, such that each set element has an Attribute of class Attr. The template parameter Attr must provide basic functions for file IO and must define a default value, see AttributeVoid and AttributeFlags for an examples. Attributes are maintained by an STL map to associate indices with attributes different from the default value. Thus, attributes with default value do not take up any memeory.

Parameters
mAttributeMapSTL map of type std::map<Idx,Attr> to hold attributes

The copy constructor copies attributes; the methods InsertSet(), EraseSet() and RestrictSet() maintain attributes; all other set operations derived from IndexSet
either return a IndexSet (no attributes) or set all attributes to the dafault value. To set or get an attribute of an index that does not exist in the set is considered as an error and triggers an exception (id 60) when the macro FAUDES_CHECKED is defined.

The format for token IO is demonstrated by the following example of 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>

Note that attributes may be either subsections or tokens of type different from integer and string. This is to allow reading a token stream to a class with incompatible (or no) attributes.

Definition at line 318 of file cfl_indexset.h.

Constructor & Destructor Documentation

◆ TaIndexSet() [1/4]

template<class Attr >
faudes::TaIndexSet< Attr >::TaIndexSet ( void  )

Constructor.

Definition at line 578 of file cfl_indexset.h.

◆ TaIndexSet() [2/4]

template<class Attr >
faudes::TaIndexSet< Attr >::TaIndexSet ( const TaIndexSet< Attr > &  rOtherSet)

Copy-constructor (from TaIndexSet, incl attributes)

Definition at line 587 of file cfl_indexset.h.

◆ TaIndexSet() [3/4]

template<class Attr >
faudes::TaIndexSet< Attr >::TaIndexSet ( const IndexSet rOtherSet)

Copy-constructor (from IndexSet, sets attributes to default)

Definition at line 598 of file cfl_indexset.h.

◆ TaIndexSet() [4/4]

template<class Attr >
faudes::TaIndexSet< Attr >::TaIndexSet ( const std::string &  rFilename,
const std::string &  rLabel = "" 
)

Construct from file. This constructor uses the Read(TokenReader&, const std::string&) function to read.

Parameters
rFilenameName of file
rLabelSection for the set in file
Exceptions
Exception
  • IO errors (id 1)
  • token mismatch (id 50, 51, 52)

Definition at line 610 of file cfl_indexset.h.

◆ ~TaIndexSet()

template<class Attr >
virtual faudes::TaIndexSet< Attr >::~TaIndexSet ( void  )
inlinevirtual

Virtual destructor

Definition at line 369 of file cfl_indexset.h.

Member Function Documentation

◆ Assign()

template<class Attr >
TaIndexSet< Attr > & faudes::TaIndexSet< Attr >::Assign ( const TBaseSet< Idx > &  rSrc)
virtual

Relaxed assignment method. Maintain attributes provided they can be casted.

Parameters
rSrcSource from which to assign
Returns
Ref to this set

Definition at line 629 of file cfl_indexset.h.

◆ Attribute() [1/3]

template<class Attr >
const Attr& faudes::TaIndexSet< Attr >::Attribute ( const Idx rElem) const
inline

Definition at line 535 of file cfl_indexset.h.

◆ Attribute() [2/3]

template<class Attr >
void faudes::TaIndexSet< Attr >::Attribute ( const Idx rElem,
const Attr &  rAttr 
)
inline

Definition at line 536 of file cfl_indexset.h.

◆ Attribute() [3/3]

template<class Attr >
void faudes::TaIndexSet< Attr >::Attribute ( const Idx rElem,
const Type rAttr 
)
inline

Definition at line 537 of file cfl_indexset.h.

◆ Attributep()

template<class Attr >
Attr* faudes::TaIndexSet< Attr >::Attributep ( const Idx rElem)
inline

Definition at line 534 of file cfl_indexset.h.

◆ AttributeTry()

template<class Attr >
void faudes::TaIndexSet< Attr >::AttributeTry ( const Idx rElem,
const Type rAttr 
)
inlinevirtual

Attribute access. This virtual function provides an interface for derived classes with attributes eg TaIndexSet. It is meant to try to set the attribute as specified if the type can be casted. Otherwise it does nothing.

Parameters
rElemElement of which the attribute is to be set
rAttrAttribute value to set.

Reimplemented from faudes::TBaseSet< Idx >.

Definition at line 538 of file cfl_indexset.h.

◆ AttributeType()

template<class Attr >
const Attr* faudes::TaIndexSet< Attr >::AttributeType ( void  ) const
inlinevirtual

resolve ambiguities from attribute interface ("using" wont do the job)

Reimplemented from faudes::TBaseSet< Idx >.

Definition at line 533 of file cfl_indexset.h.

◆ DoAssign()

template<class Attr >
void faudes::TaIndexSet< Attr >::DoAssign ( const TaIndexSet< Attr > &  rSource)
protected

Assign my members. This method maintains attributes.

Parameters
rSourceSource to copy from

Definition at line 621 of file cfl_indexset.h.

◆ Erase() [1/2]

template<class Attr >
bool faudes::TaIndexSet< Attr >::Erase ( const Idx rIndex)

Erase Element (incl its attribute)

Parameters
rIndexIndex to specify element
Returns
True if element used to exist

Definition at line 708 of file cfl_indexset.h.

◆ Erase() [2/2]

template<class Attr >
IndexSet::Iterator faudes::TaIndexSet< Attr >::Erase ( const Iterator &  pos)

Erase element by iterator (incl attribute)

Parameters
posIterator to specify element
Returns
Iterator to next element or End()

Definition at line 714 of file cfl_indexset.h.

◆ EraseSet() [1/2]

template<class Attr >
void faudes::TaIndexSet< Attr >::EraseSet ( const IndexSet rOtherSet)

Erase elements given by other set.

This function ignores the attributes of the other set and maintains the attributes of the remaining elements in this set.

Parameters
rOtherSetElements to erase

Definition at line 721 of file cfl_indexset.h.

◆ EraseSet() [2/2]

template<class Attr >
void faudes::TaIndexSet< Attr >::EraseSet ( const TBaseSet< Idx > &  rOtherSet)
virtual

Erase elements given by other set.

This variant uses a runtime cast to access attributes.

Parameters
rOtherSetOther IndexSet
Exceptions
Exception
  • cast failed (id 67)

Definition at line 728 of file cfl_indexset.h.

◆ Insert() [1/4]

template<class Attr >
Idx faudes::TaIndexSet< Attr >::Insert ( const Attr &  rAttr)

Insert new index with attribute. If the index allready exists, the attribute is overwritten by rAttr.

Parameters
rAttrSpecify attribute of new element
Returns
new index

Definition at line 667 of file cfl_indexset.h.

◆ Insert() [2/4]

template<class Attr >
bool faudes::TaIndexSet< Attr >::Insert ( const Idx rIndex)

Insert element. If the element exists, the attribute is maintained. If the element does not exist, it is inserted with default attribute.

Parameters
rIndexIndex to specify element
Returns
True if element was new to set

Definition at line 660 of file cfl_indexset.h.

◆ Insert() [3/4]

template<class Attr >
bool faudes::TaIndexSet< Attr >::Insert ( const Idx rIndex,
const Attr &  attr 
)

Insert element with attribute.

Parameters
rIndexIndex to specify element
attrSpecify attribute of (new) element
Returns
True if element was new to set

Definition at line 678 of file cfl_indexset.h.

◆ Insert() [4/4]

template<class Attr >
Idx faudes::TaIndexSet< Attr >::Insert ( void  )

Insert new index to set using default attribute.

Returns
New index

Definition at line 651 of file cfl_indexset.h.

◆ InsertSet() [1/2]

template<class Attr >
void faudes::TaIndexSet< Attr >::InsertSet ( const IndexSet rOtherSet)
virtual

Inserts elements of rOtherSet.

Attributes of this set are maintained, newly inserted elements attain the attribute from rOtherSet if it can be casted appropriately.

Parameters
rOtherSetOther IndexSet

Definition at line 686 of file cfl_indexset.h.

◆ InsertSet() [2/2]

template<class Attr >
void faudes::TaIndexSet< Attr >::InsertSet ( const TBaseSet< Idx > &  rOtherSet)
virtual

Inserts elements of rOtherSet.

This variant uses a runtime cast to access attributes.

Parameters
rOtherSetOther IndexSet
Exceptions
Exception
  • cast failed (id 67)

Definition at line 693 of file cfl_indexset.h.

◆ operator=()

template<class Attr >
virtual TaIndexSet& faudes::TaIndexSet< Attr >::operator= ( const IndexSet rSrc)
inlinevirtual

Relaxed assignment operator. Maintain attributes provided they can be casted.

Parameters
rSrcSource from which to assign
Returns
Ref to this set

Definition at line 387 of file cfl_indexset.h.

◆ RestrictSet() [1/2]

template<class Attr >
void faudes::TaIndexSet< Attr >::RestrictSet ( const IndexSet rOtherSet)

Restrict to specified subset.

Erases any elements no in the specified set. This function ignores the attributes of the other set and maintains the attributes of the remaining elements in this set.

Parameters
rOtherSetElements to erase

Definition at line 743 of file cfl_indexset.h.

◆ RestrictSet() [2/2]

template<class Attr >
void faudes::TaIndexSet< Attr >::RestrictSet ( const TBaseSet< Idx > &  rOtherSet)
virtual

Restrict to specified subset.

This variant uses a runtime cast to access attributes.

Parameters
rOtherSetOther IndexSet
Exceptions
Exception
  • cast failed (id 67)

Definition at line 750 of file cfl_indexset.h.

Friends And Related Function Documentation

◆ IndexSet

template<class Attr >
friend class IndexSet ( void  )
friend

We implement "protected privacy for template classes" by friendship. This is used for the pragmatic implemention conversion constructors.

Definition at line 333 of file cfl_indexset.h.


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

libFAUDES 2.33c --- 2025.05.15 --- c++ api documentaion by doxygen