|
template<class T, class Cmp = std::less<T>>
class faudes::TBaseSet< T, Cmp >
STL style set template. This class template is built on top of the STL set template. It provides essentials of the STL interface relevant to libFAUDES plus a deferred copy mechanism, aka copy-on-write. TBaseSet serves as a base class for all libFaudes containers:
The public functions of a TBaseSet provide the high-level api, with the intention to organize the deferred copy machanism in a transparent manner. Since STL iterators refer to a particular STL container, they become invalid when the internal container is copied. Therefor, TBaseSet tracks iterators and fixes them when the actual copy takes place. This introduces some runtime overhead, in particular when your application represents subsets as sets of iterators. You may use the public method Lock() to enforce a full copy and to prevent any further re-allocation.
Alternatively to the high-level api, a protected low-level api is provided with direct access to the internal STL set. When using this api, it is up to the derived class to ensure that the BaseSet gets detached from its refernces befor write operations can take place.
The virtual function TBaseSet<T>::Valid() is used to indicate whether a candidate element is valid as a set member. If the macro FAUDES_CHECKED is defined, the attempt to insert an invalid element triggers an exception (id 61). Invalid iterators throw an exception (id 62) when used as an argument to a BaseSet function.
The TBaseSet also hosts a container to associate an attribute with each set element. However, in the plain TBAseSey the attribute type is set to void and member methods only deal with attributes when this does not invilve too much overhead. To make effective use of attributes, one is meant to derive a class from TBaseSet that encodes the actual attribute type and that provides appropriate access methods. This is facilitated by the class TAttrMap.
Note on a boring technical detail: since STL sets are sorted, effectively all set iterators should be const. However, there is a minor issue whether or not the erase function should use a const iterator as argument. SGI derived STL implementations (as used on most GNU systems) avoid this issue by defining const and non-const iterators on sets as identical types. MS implementation (used in VS C++ by default, as of 2006) differ in this aspect. The class TBaseSet::Iterator hides the issue from the faudes API but it is still present internaly.
Definition at line 98 of file cfl_baseset.h.
#include <cfl_baseset.h>
|
| TBaseSet (void) |
|
| TBaseSet (const TBaseSet &rOtherSet) |
|
| TBaseSet (const std::string &rFilename, const std::string &rLabel="BaseSet") |
|
virtual | ~TBaseSet (void) |
|
virtual void | Clear (void) |
|
virtual bool | IsDefault (void) const |
|
Idx | Size (void) const |
|
bool | Empty (void) const |
|
virtual std::string | Str (const T &rElem) const |
|
Iterator | Begin (void) const |
|
Iterator | End (void) const |
|
virtual bool | Valid (const T &rElem) const |
|
virtual bool | Erase (const T &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 T &rElem) |
|
virtual Iterator | Inject (const Iterator &pos, const T &rElem) |
|
virtual void | Inject (const T &rElem) |
|
virtual void | InsertSet (const TBaseSet &rOtherSet) |
|
bool | Exists (const T &rElem) const |
|
Iterator | Find (const T &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 const AttributeVoid * | AttributeType (void) const |
|
virtual bool | AttributeTest (const Type &rAttr) const |
|
virtual TBaseSet & | AssignWithoutAttributes (const TBaseSet &rSourceSet) |
|
virtual void | Attributes (const TBaseSet &rOtherSet) |
|
Idx | AttributesSize (void) const |
|
void | ClearAttributes (void) |
|
bool | EqualAttributes (const TBaseSet &rOtherSet) const |
|
virtual AttributeVoid * | Attributep (const T &rElem) |
|
virtual const AttributeVoid & | Attribute (const T &rElem) const |
|
virtual void | Attribute (const T &rElem, const Type &rAttr) |
|
virtual void | AttributeTry (const T &rElem, const Type &rAttr) |
|
virtual void | ClrAttribute (const T &rElem) |
|
| ExtType (void) |
|
| ExtType (const ExtType &rType) |
|
virtual | ~ExtType (void) |
|
const std::string & | Name (void) const |
|
void | Name (const std::string &rName) |
|
virtual const std::string & | TypeName (void) const |
|
virtual void | TypeName (const std::string &rType) |
|
virtual const std::string & | ElementTag (void) const |
|
virtual void | ElementTag (const std::string &rTag) |
|
virtual const std::string & | ElementType (void) const |
|
virtual const TypeDefinition * | TypeDefinitionp (void) const |
|
Type & | operator= (const Type &rSrc) |
|
bool | operator== (const Type &rOther) const |
|
bool | operator!= (const Type &rOther) const |
|
| AttrType (void) |
|
| AttrType (const AttrType &rSrc) |
|
virtual | ~AttrType (void) |
|
Type & | operator= (const Type &rSrc) |
|
bool | operator== (const Type &rOther) const |
|
bool | operator!= (const Type &rOther) const |
|
| Type (void) |
|
| Type (const Type &rType) |
|
virtual | ~Type (void) |
|
virtual Type * | New (void) const |
|
virtual Type * | Copy (void) const |
|
virtual const Type * | Cast (const Type *pOther) const |
|
virtual Type & | Assign (const Type &rSrc) |
|
Type & | operator= (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) |
|
|
virtual void | DoWriteElement (TokenWriter &rTw, const T &rElem, const std::string &rLabel="", const Type *pContext=0) const |
|
virtual void | DoXWriteElement (TokenWriter &rTw, const T &rElem, const std::string &rLabel="", const Type *pContext=0) const |
|
virtual void | DoReadElement (TokenReader &rTr, T &rElem, const std::string &rLabel, const Type *pContext) |
|
virtual void | DoWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const |
|
virtual void | DoXWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const |
|
virtual void | DoDWrite (TokenWriter &rTw, const std::string &rLabel="", const Type *pContext=0) const |
|
virtual void | DoSWrite (TokenWriter &rTw) const |
|
virtual void | DoRead (TokenReader &rTr, const std::string &rLabel="", const Type *pContext=0) |
|
void | DoAssign (const TBaseSet &rSourceSet) |
|
bool | DoEqual (const TBaseSet &rOtherSet) const |
|
void | DoAttribute (const T &rElem, const Type *pAttr) |
|
const AttributeVoid * | DoAttribute (const T &rElem) const |
|
AttributeVoid * | DoAttributeExplicit (const T &rElem) |
|
TBaseSet< T, Cmp >::Iterator | ThisIterator (const typename std::set< T, Cmp >::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 |
|
void | DoAssign (const AttrType &rSrc) |
|
bool | DoEqual (const AttrType &rOther) const |
|
void | DoAssign (const Type &rSrc) |
|
bool | DoEqual (const Type &rOther) const |
|
virtual Token | XBeginTag (const std::string &rLabel="", const std::string &rFallbackLabel="") const |
|
|
template<class TP , class AP , class CP > |
class | TAttrMap |
|
◆ aiterator
template<class T , class Cmp = std::less<T>>
STL attribute iterator, non-const version
Definition at line 970 of file cfl_baseset.h.
◆ CIterator
template<class T , class Cmp = std::less<T>>
Iterator class for high-level api to TBaseSet.
This is a convenoience typedef — faudes set iterators are const anyway.
Definition at line 192 of file cfl_baseset.h.
◆ const_aiterator
template<class T , class Cmp = std::less<T>>
STL attribute iterator, const version
Definition at line 973 of file cfl_baseset.h.
◆ const_iterator
template<class T , class Cmp = std::less<T>>
◆ iterator
template<class T , class Cmp = std::less<T>>
◆ DetachMode
template<class T , class Cmp = std::less<T>>
Detach from extern storage (incl allocation and true copy)
Enumerator |
---|
SetOnly | |
AttrIncl | |
Definition at line 374 of file cfl_baseset.h.
◆ AttributeTry()
template<class T , class Cmp = std::less<T>>
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
-
rElem | Element of which the attribute is to be set |
rAttr | Attribute value to set. |
Reimplemented in faudes::TaTransSet< Attr >, faudes::TaNameSet< Attr >, faudes::TaNameSet< faudes::AttributeFailureEvents >, faudes::TaNameSet< AttributeSimCondition >, faudes::TaNameSet< faudes::AttributeSignalEvent >, faudes::TaNameSet< faudes::AttributeSimplenetEvent >, faudes::TaNameSet< EventAttr >, faudes::TaNameSet< SimEventAttribute >, faudes::TaIndexSet< Attr >, faudes::TaIndexSet< StateAttr >, and faudes::TaIndexSet< faudes::DiagLabelSet >.
Definition at line 785 of file cfl_baseset.h.
◆ TAttrMap
template<class T , class Cmp = std::less<T>>
template<class TP , class AP , class CP >
allow access to attribute interface class
Definition at line 109 of file cfl_baseset.h.
◆ mClientRecord
template<class T , class Cmp = std::less<T>>
◆ mDetached
template<class T , class Cmp = std::less<T>>
Indicate "hosts data to myself only"
Definition at line 988 of file cfl_baseset.h.
◆ mIterators
template<class T , class Cmp = std::less<T>>
◆ mLocked
template<class T , class Cmp = std::less<T>>
Indicate "dont re-allocate the STL set ever again"
Definition at line 991 of file cfl_baseset.h.
◆ mpAttributes
template<class T , class Cmp = std::less<T>>
Attribute map, if this object hosts data (else NULL).
Definition at line 967 of file cfl_baseset.h.
◆ mpClients
template<class T , class Cmp = std::less<T>>
BaseSets, that use data hosted by us (NULL if we dont host data, emptyset if we host to ourself excl.)
Definition at line 985 of file cfl_baseset.h.
◆ mpSet
template<class T , class Cmp = std::less<T>>
STL set, if this object hosts data (else NULL)
Definition at line 950 of file cfl_baseset.h.
◆ pAttributes
template<class T , class Cmp = std::less<T>>
Pointer to attribute map to operate on
Definition at line 964 of file cfl_baseset.h.
◆ pHostSet
template<class T , class Cmp = std::less<T>>
Pointer on BaseSet that hosts our data (THIS if we host)
Definition at line 979 of file cfl_baseset.h.
◆ pSet
template<class T , class Cmp = std::less<T>>
The documentation for this class was generated from the following file:
libFAUDES 2.33h
--- 2025.06.18
--- c++ api documentaion by doxygen
|