Detailed Description

Set of symbols.

The 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. Invalid iterators throw an exception (id 62) when used as an argument to a SymbolSet function. If the macro FAUDES_CHECKED is defined, the attempt to insert an invalid symbol an exception (id 61).

Note that a symbol set holds a plain set of valid faudes symbols with no indices or symboltable associated. If you are looking for a set of items with mandatory symbolic names you most likely are better of with a NameSet or a TaNameSet. Currently, there is no attributed version of a SymbolSet.

The token IO format is demonstrated by the following example of a set with name "MySymbols"

<MySymbols>
"ASymbol"
"AnotherSymbol"
</MySymbols>

Note that you can read SymbolSet files to NameSets and vice versa.

Definition at line 70 of file cfl_symbolset.h.

#include <cfl_symbolset.h>

Public Types

typedef TBaseSet< std::string >::Iterator Iterator
 Iterators on indexset. More...
 
- Public Types inherited from faudes::TBaseSet< std::string >
enum  DetachMode
 Detach from extern storage (incl allocation and true copy) More...
 

Public Member Functions

 SymbolSet (void)
 Constructor. More...
 
 SymbolSet (const TBaseSet< std::string > &rOtherSet)
 Copy-constructor. More...
 
 SymbolSet (const std::string &rFilename, const std::string &rLabel="SymbolSet")
 Construct from file. More...
 
virtual ~SymbolSet (void)
 Virtual destructor. More...
 
bool Valid (const std::string &symbol) const
 Test whether the given string is a valid faudes symbol. More...
 
bool Insert (const std::string &symbol)
 Insert specified symbol. More...
 
Idx Signature (void) const
 Compute an Idx type signature for a Set. More...
 
std::string Str (const std::string &symbol) const
 Return pretty printable symbol. More...
 
- Public Member Functions inherited from faudes::TBaseSet< std::string >
 TBaseSet (void)
 Constructor. More...
 
 TBaseSet (const TBaseSet &rOtherSet)
 Copy-constructor. More...
 
 TBaseSet (const std::string &rFilename, const std::string &rLabel="BaseSet")
 Constructor from file. More...
 
virtual ~TBaseSet (void)
 Virtual destructor. More...
 
const std::string & Name (void) const
 Return name of TBaseSet. More...
 
void Name (const std::string &rName)
 Set name of TBaseSet. More...
 
virtual void Clear (void)
 Clear all set. More...
 
Idx Size (void) const
 Get Size of TBaseSet. More...
 
bool Empty (void) const
 Test whether if the TBaseSet is Empty. More...
 
virtual std::string Str (const std::string &rElem) const
 Return pretty printable element. More...
 
Iterator Begin (void) const
 Iterator to the begin of set. More...
 
Iterator End (void) const
 Iterator to the end of set. More...
 
virtual bool Valid (const std::string &rElem) const
 Test validty of candidate element. More...
 
virtual bool Erase (const std::string &rElem)
 Erase element by reference. More...
 
virtual Iterator Erase (const Iterator &pos)
 Erase element by iterator. More...
 
virtual void EraseSet (const TBaseSet &rOtherSet)
 Erase elements given by other set. More...
 
virtual void RestrictSet (const TBaseSet &rOtherSet)
 Restrict elements given by other set. More...
 
virtual bool Disjoint (const TBaseSet &rOtherSet) const
 Test for this set to be disjoint witg other set. More...
 
virtual bool Insert (const std::string &rElem)
 Insert specified element. More...
 
virtual Iterator Inject (const Iterator &pos, const std::string &rElem)
 Insert specified element. More...
 
virtual void Inject (const std::string &rElem)
 Insert specified element. More...
 
virtual void InsertSet (const TBaseSet &rOtherSet)
 Insert elements given by rOtherSet. More...
 
bool Exists (const std::string &rElem) const
 Test existence of element. More...
 
Iterator Find (const std::string &rElem) const
 Find element and return iterator. More...
 
TBaseSet operator+ (const TBaseSet &rOtherSet) const
 Set union operator. More...
 
TBaseSet operator- (const TBaseSet &rOtherSet) const
 Set difference operator. More...
 
TBaseSet operator* (const TBaseSet &rOtherSet) const
 Set intersection operator. More...
 
bool operator<= (const TBaseSet &rOtherSet) const
 Test for subset
More...
 
bool operator>= (const TBaseSet &rOtherSet) const
 Test for superset. More...
 
bool operator< (const TBaseSet &rOtherSet) const
 Order for sorting containers of TBaseSet. More...
 
void DValid (const std::string &rMessage="") const
 Some validation of deferred copy mechanism (provoke abort) More...
 
void Detach (DetachMode flag=AttrIncl) const
 
void Lock (void) const
 Detach and lock any further reallocation. More...
 
virtual const AttributeVoidAttributeType (void) const
 Attribute typeinfo. More...
 
virtual bool AttributeTest (const Type &rAttr) const
 Attribute typeinfo. More...
 
virtual TBaseSetAssignWithoutAttributes (const TBaseSet &rSourceSet)
 Attribute access. More...
 
virtual void Attributes (const TBaseSet &rOtherSet)
 Attributes access. More...
 
Idx AttributesSize (void) const
 Attribute access. More...
 
void ClearAttributes (void)
 Attribute access. More...
 
bool EqualAttributes (const TBaseSet &rOtherSet) const
 Attribute access. More...
 
virtual AttributeVoidAttributep (const std::string &rElem)
 Attribute access. More...
 
virtual const AttributeVoidAttribute (const std::string &rElem) const
 Attribute access. More...
 
virtual void Attribute (const std::string &rElem, const Type &rAttr)
 Attribute access. More...
 
virtual void AttributeTry (const std::string &rElem, const Type &rAttr)
 Attribute access. More...
 
virtual void ClrAttribute (const std::string &rElem)
 Attribute access. More...
 
virtual void XElementTag (const std::string &rTag)
 Configure the element name tag. More...
 
virtual const std::string & TypeName (void) const
 Get objects's type name. More...
 
virtual void TypeName (const std::string &rType)
 Overwrite faudes-type name. More...
 
- Public Member Functions inherited from faudes::Type
 Type (void)
 Constructor. More...
 
 Type (const Type &rType)
 Copy constructor. More...
 
virtual ~Type (void)
 Destructor. More...
 
virtual TypeNew (void) const
 Construct on heap. More...
 
virtual TypeCopy (void) const
 Construct on heap. More...
 
virtual const TypeCast (const Type *pOther) const
 Cast other object to this type. More...
 
virtual TypeAssign (const Type &rSrc)
 Assign configuration data from other object. More...
 
virtual Typeoperator= (const Type &rSrc)
 Assign configurationdata from other object. More...
 
virtual bool Equal (const Type &rOther) const
 Test equality of configuration data. More...
 
virtual bool operator== (const Type &rOther) const
 Test equality of configuration data. More...
 
virtual bool operator!= (const Type &rOther) const
 Test equality of configuration data. More...
 
void Write (const Type *pContext=0) const
 Write configuration data to console. More...
 
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
 Write configuration data to a file. More...
 
void Write (const std::string &pFileName, std::ios::openmode openmode) const
 Write configuration data to a file. More...
 
void Write (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 Write configuration data to TokenWriter. More...
 
virtual void XWrite (const std::string &pFileName, const std::string &rLabel="", const Type *pContext=0) const
 Write configuration data to an XML file. More...
 
void XWrite (const Type *pContext=0) const
 Write configuration data in XML format to concole Note: this write function uses the virtual function DoXWrite(), to be reimplemented by derived classes. More...
 
void XWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 Write configuration data in XML format to TokenWriter. More...
 
std::string ToString (const std::string &rLabel="", const Type *pContext=0) const
 Write configuration data to a string. More...
 
std::string ToText (const std::string &rLabel="", const Type *pContext=0) const
 Write configuration data to a formated string. More...
 
void DWrite (const Type *pContext=0) const
 Write configuration data to console, debugging format. More...
 
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
 Write configuration data to a file, debugging format. More...
 
void DWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 Write configuration data in debug format to TokenWriter. More...
 
void SWrite (TokenWriter &rTw) const
 Write statistics comment to TokenWriter. More...
 
void SWrite (void) const
 Write statistics comment to console. More...
 
std::string ToSText (void) const
 Write statistics to a string. More...
 
void Read (const std::string &rFileName, const std::string &rLabel="", const Type *pContext=0)
 Read configuration data from file with label specified. More...
 
void FromString (const std::string &rString, const std::string &rLabel="", const Type *pContext=0)
 Read configuration data from a string. More...
 
void Read (TokenReader &rTr, const std::string &rLabel="", const Type *pContext=0)
 Read configuration data from TokenReader with label sepcified. More...
 

Protected Member Functions

void DoAssign (const SymbolSet &rSource)
 Assign my members. More...
 
void DoWrite (TokenWriter &tw, const std::string &rLabel="", const Type *pContext=0) const
 Write to TokenWriter, see TBaseSet for public wrappers. More...
 
void DoRead (TokenReader &rTr, const std::string &rLabel="", const Type *pContext=0)
 Read from TokenReader, see TBaseSet for public wrappers. More...
 
- Protected Member Functions inherited from faudes::TBaseSet< std::string >
virtual const std::string & XElementTag (void) const
 Get name of elements (used for XML IO) More...
 
virtual void DoDWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 Token output, debugging see Type::DWrite for public wrappers. More...
 
virtual void DoSWrite (TokenWriter &rTw) const
 Token output, see Type::SWrite for public wrappers. More...
 
void DoAssign (const TBaseSet &rSourceSet)
 assign my members More...
 
bool DoEqual (const TBaseSet &rOtherSet) const
 test equality More...
 
void DoAttribute (const std::string &rElem, const Type *pAttr)
 set attribute in map (assume elem exists in set, NULL <=> set to default) More...
 
const AttributeVoidDoAttribute (const std::string &rElem) const
 get attribute from map (return null if elem does not exist in map) More...
 
AttributeVoidDoAttributeExplicit (const std::string &rElem)
 get attribute from map (insert explicit default if elem does not exist in map) More...
 
TBaseSet< std::string, std::less< std::string > >::Iterator ThisIterator (const typename std::set< std::string, std::less< std::string > >::const_iterator &sit) const
 Convert STL iterator to API iterator. More...
 
void RelinkClients (void)
 Ensure that we do not host contents to anyone else. More...
 
void AttachClient (TBaseSet *pRef) const
 Record that we provide contents to some other BaseSet. More...
 
void DetachClient (TBaseSet *pRef) const
 Record that we stop providing data for some TBaseSet. More...
 
void AttachIterator (Iterator *pFit) const
 Record that an iterator refers to this TBaseSet. More...
 
void DetachIterator (Iterator *pFit) const
 Record that an iterator stops to refer to this TBaseSet. More...
 
virtual const TypeDefinitionTypeDefinitionp (void) const
 Reimplment from type to use chache. More...
 
- Protected Member Functions inherited from faudes::Type
void DoAssign (const Type &rSrc)
 Assign configuration data from other object. More...
 
bool DoEqual (const Type &rOther) const
 Test equality of configuration data. More...
 
virtual void DoXWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const
 Write configuration data of this object to TokenWriter in XML format. More...
 
virtual Token XBeginTag (const std::string &rLabel="", const std::string &rFallbackLabel="") const
 

Additional Inherited Members

- Protected Types inherited from faudes::TBaseSet< std::string >
typedef std::set< std::string, std::less< std::string > >::iterator iterator
 STL iterator, non-const version. More...
 
typedef std::set< std::string, std::less< std::string > >::const_iterator const_iterator
 STL iterator, const version. More...
 
typedef std::map< std::string, AttributeVoid * >::iterator aiterator
 STL attribute iterator, non-const version. More...
 
typedef std::map< std::string, AttributeVoid * >::const_iterator const_aiterator
 STL attribute iterator, const version. More...
 
- Protected Attributes inherited from faudes::TBaseSet< std::string >
std::string mMyName
 Name of this BaseSet. More...
 
std::set< std::string, std::less< std::string > > * pSet
 Pointer on STL set to operate on. More...
 
std::set< std::string, std::less< std::string > > * mpSet
 STL set, if this object hosts data (else NULL) More...
 
std::map< std::string, AttributeVoid * > * pAttributes
 Pointer to attribute map to operate on. More...
 
std::map< std::string, AttributeVoid * > * mpAttributes
 Attribute map, if this object hosts data (else NULL). More...
 
TBaseSet< std::string, std::less< std::string > > * pHostSet
 Pointer on BaseSet that hosts our data (THIS if we host) More...
 
std::list< TBaseSet< std::string, std::less< std::string > > * >::iterator mClientRecord
 Iterator to the client list that hosts our data (maintained by host) More...
 
std::list< TBaseSet< std::string, std::less< std::string > > * > * mpClients
 BaseSets, that use data hosted by us (NULL if we dont host data, emptyset if we host to ourself excl.) More...
 
bool mDetached
 Indicate "hosts data to myself only". More...
 
bool mLocked
 Indicate "dont re-allocate the STL set ever again". More...
 
std::set< Iterator * > mIterators
 Iterators that refer to this TBaseSet. More...
 
- Static Protected Attributes inherited from faudes::TBaseSet< std::string >
static std::set< std::string, std::less< std::string > > msEmptySet
 static empty STL set for default constructor More...
 
static std::map< std::string, AttributeVoid * > msEmptyAttributes
 static empty STL map for default constructor More...
 

Member Typedef Documentation

◆ Iterator

Iterators on indexset.

Definition at line 118 of file cfl_symbolset.h.

Constructor & Destructor Documentation

◆ SymbolSet() [1/3]

faudes::SymbolSet::SymbolSet ( void  )

Constructor.

Definition at line 32 of file cfl_symbolset.cpp.

◆ SymbolSet() [2/3]

faudes::SymbolSet::SymbolSet ( const TBaseSet< std::string > &  rOtherSet)

Copy-constructor.

Definition at line 40 of file cfl_symbolset.cpp.

◆ SymbolSet() [3/3]

faudes::SymbolSet::SymbolSet ( const std::string &  rFilename,
const std::string &  rLabel = "SymbolSet" 
)

Construct from file.

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

Parameters
rFilenameName of file to read
rLabelSection to read
Exceptions
Exception
  • IO Errors (id 1)
  • token musmatch (id 50, 51, 52)

Definition at line 47 of file cfl_symbolset.cpp.

◆ ~SymbolSet()

virtual faudes::SymbolSet::~SymbolSet ( void  )
inlinevirtual

Virtual destructor.

Definition at line 104 of file cfl_symbolset.h.

Member Function Documentation

◆ DoAssign()

void faudes::SymbolSet::DoAssign ( const SymbolSet rSource)
protected

Assign my members.

This method calls the base class to assign its members.

Parameters
rSourceSource to copy from
Returns
Ref to this set

Definition at line 55 of file cfl_symbolset.cpp.

◆ DoRead()

void faudes::SymbolSet::DoRead ( TokenReader rTr,
const std::string &  rLabel = "",
const Type pContext = 0 
)
protectedvirtual

Read from TokenReader, see TBaseSet for public wrappers.

Parameters
rTrReference to tokenreader
rLabelSection to read
pContextRead context for contextual information
Exceptions
Exception
  • IO errors (id 1)
  • token mismatch (id 50, 51, 52)

Reimplemented from faudes::TBaseSet< std::string >.

Definition at line 76 of file cfl_symbolset.cpp.

◆ DoWrite()

void faudes::SymbolSet::DoWrite ( TokenWriter tw,
const std::string &  rLabel = "",
const Type pContext = 0 
) const
protectedvirtual

Write to TokenWriter, see TBaseSet for public wrappers.

Parameters
twReference to TokenWriter
rLabelLabel of section to write, defaults to name of set
pContextWrite context for contextual information
Exceptions
Exception
  • IO errors (id 2)

Reimplemented from faudes::TBaseSet< std::string >.

Definition at line 61 of file cfl_symbolset.cpp.

◆ Insert()

bool faudes::SymbolSet::Insert ( const std::string &  symbol)

Insert specified symbol.

Parameters
symbolSymbol to insert
Returns
True if symbol was new to set

Definition at line 101 of file cfl_symbolset.cpp.

◆ Signature()

Idx faudes::SymbolSet::Signature ( void  ) const
inline

Compute an Idx type signature for a Set.

This method is currently not implemented.

Returns
Idx type set signature

Definition at line 137 of file cfl_symbolset.h.

◆ Str()

std::string faudes::SymbolSet::Str ( const std::string &  symbol) const
inline

Return pretty printable symbol.

Parameters
symbolSymbol to print
Returns
String

Definition at line 148 of file cfl_symbolset.h.

◆ Valid()

bool faudes::SymbolSet::Valid ( const std::string &  symbol) const

Test whether the given string is a valid faudes symbol.

Parameters
symbolSymbol to test
Returns
True if valid

Definition at line 107 of file cfl_symbolset.cpp.


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

libFAUDES 2.32b --- 2024.03.01 --- c++ api documentaion by doxygen