|
#include <cfl_attrmap.h>
|
| TAttrMap (TBaseSet< T, Cmp > *pBaseSetRef) |
|
virtual | ~TAttrMap (void) |
|
void | AssignWithAttributes (const TBaseSet< T, Cmp > &rSourceSet) |
|
const Attr * | AttributeType (void) const |
|
Attr * | Attributep (const T &rElem) |
|
const Attr & | Attribute (const T &rElem) const |
|
void | Attribute (const T &rElem, const Type &attr) |
|
void | Attribute (const T &rElem, const Attr &attr) |
|
void | AttributeTry (const T &rElem, const Type &attr) |
|
bool | Insert (const T &rElem) |
|
bool | Insert (const T &rElem, const Attr &attr) |
|
void | InsertSet (const TBaseSet< T, Cmp > &rOtherSet) |
|
bool | Erase (const T &rElem) |
|
TBaseSet< T, Cmp >::Iterator | Erase (const typename TBaseSet< T, Cmp >::Iterator &pos) |
|
void | EraseSet (const TBaseSet< T, Cmp > &rOtherSet) |
|
void | RestrictSet (const TBaseSet< T, Cmp > &rOtherSet) |
|
template<class T, class Attr, class Cmp = std::less<T>>
class faudes::TAttrMap< T, Attr, Cmp >
Attribute interface for TBaseSet.
TAttrMap provides a typed interface to access the attributes associated with elements of a TBaseSet. It is meant to faciltate classes derived from TBaseSet that use non-trivial attributes. Note that the actual attribute map is hosted by TBaseSet itself.
Note: technically, the TAttrMap holds a reference to the associated TBaseSet. When deriving from a child of TBaseSet, the interface is introduced by additional inheritance of TAttrMap. Effectively, this avoids the diomand-shape inheritance we used to have in pre 2.30 versions of libFAUDES and which caused various issues with the MS Visual Studio compilers regarding covaraint return values in the context of templates.
Definition at line 52 of file cfl_attrmap.h.
◆ aiterator
template<class T , class Attr , class Cmp = std::less<T>>
◆ const_aiterator
template<class T , class Attr , class Cmp = std::less<T>>
◆ const_iterator
template<class T , class Attr , class Cmp = std::less<T>>
◆ iterator
template<class T , class Attr , class Cmp = std::less<T>>
◆ TAttrMap()
template<class T , class Attr , class Cmp >
Constructor.
Record associated set.
Definition at line 277 of file cfl_attrmap.h.
◆ ~TAttrMap()
template<class T , class Attr , class Cmp >
◆ AssignWithAttributes()
template<class T , class Attr , class Cmp >
Copy from a TBaseSet to the associated TBaseSet, with attributes, provided that they can be casted accordingly.
- Parameters
-
rSourceSet | Set to copy from |
Definition at line 292 of file cfl_attrmap.h.
◆ Attribute() [1/3]
template<class T , class Attr , class Cmp >
const Attr & faudes::TAttrMap< T, Attr, Cmp >::Attribute |
( |
const T & |
rElem | ) |
const |
Get attribute by element. This function returns a const reference to the attribute of the specified element. - Parameters
-
- Exceptions
-
- Returns
- Reference to attribute
Definition at line 463 of file cfl_attrmap.h.
◆ Attribute() [2/3]
template<class T , class Attr , class Cmp >
void faudes::TAttrMap< T, Attr, Cmp >::Attribute |
( |
const T & |
rElem, |
|
|
const Attr & |
attr |
|
) |
| |
Set attribute. This method sets the attribute of the sepcified element to the given value.
- Parameters
-
rElem | Specify element |
attr | Attribute value. |
- Exceptions
-
Exception |
- Element does not exist (60)
- Cannot cast attribute type (63)
|
Definition at line 513 of file cfl_attrmap.h.
◆ Attribute() [3/3]
template<class T , class Attr , class Cmp >
Set attribute. Provided that the attribute can be casted to the appropriate type, this method sets the attribute of the sepcified element to the given value.
- Parameters
-
rElem | Specify element |
attr | Attribute value. |
- Exceptions
-
Exception |
- Element does not exist (60)
- Cannot cast attribute type (63)
|
Definition at line 480 of file cfl_attrmap.h.
◆ Attributep()
template<class T , class Attr , class Cmp >
Get attribute reference by element. Note that in order to produce a non-const reference this method will insert an explicit default attribute if necessary. If a const reference is sufficient, you should use Attribute(rElem) const instead.
- Parameters
-
- Exceptions
-
- Returns
- Pointer to attribute
Definition at line 445 of file cfl_attrmap.h.
◆ AttributeTry()
template<class T , class Attr , class Cmp >
Set attribute. Provided that the attribute can be casted to the appropriate type, this method sets the attribute of the sepcified element to the given value. If the cast fails, this method does nothing.
- Parameters
-
rElem | Specify element |
attr | Attribute value. |
- Exceptions
-
Definition at line 498 of file cfl_attrmap.h.
◆ AttributeType()
template<class T , class Attr , class Cmp >
Attribute typeinfo.
- Returns
- Pointer to some attribute of this sets attribute type.
Definition at line 437 of file cfl_attrmap.h.
◆ Erase() [1/2]
template<class T , class Attr , class Cmp >
Erase Element (incl its attribute)
- Parameters
-
- Returns
- True if element used to exist
Definition at line 369 of file cfl_attrmap.h.
◆ Erase() [2/2]
template<class T , class Attr , class Cmp >
Erase element by iterator (incl attribute)
- Parameters
-
pos | Iterator to specify element |
- Returns
- Iterator to next element or End()
Definition at line 376 of file cfl_attrmap.h.
◆ EraseSet()
template<class T , class Attr , class Cmp >
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
-
rOtherSet | Elements to erase |
Definition at line 386 of file cfl_attrmap.h.
◆ Insert() [1/2]
template<class T , class Attr , class Cmp >
Insert element. If the element exists, the attribute is maintained. If the element does not exist, it is inserted with default attribute.
- Parameters
-
- Returns
- True if element was new to set
Definition at line 323 of file cfl_attrmap.h.
◆ Insert() [2/2]
template<class T , class Attr , class Cmp >
bool faudes::TAttrMap< T, Attr, Cmp >::Insert |
( |
const T & |
rElem, |
|
|
const Attr & |
attr |
|
) |
| |
Insert element with attribute.
- Parameters
-
rElem | Specify element |
attr | Specify attribute of (new) element |
- Returns
- True if element was new to set
Definition at line 331 of file cfl_attrmap.h.
◆ InsertSet()
template<class T , class Attr , class Cmp >
Inserts elements from rOtherSet.
Attributes of this set are maintained, newly inserted elements receive attributes from rOtherSet, provided that can be casted appropriately.
- Parameters
-
Definition at line 340 of file cfl_attrmap.h.
◆ RestrictSet()
template<class T , class Attr , class Cmp >
Restrict to specified subset. Erases any elements not 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
-
rOtherSet | Elements to erase |
Definition at line 409 of file cfl_attrmap.h.
◆ pBaseSet
template<class T , class Attr , class Cmp = std::less<T>>
The documentation for this class was generated from the following file:
libFAUDES 2.33b
--- 2025.05.07
--- c++ api documentaion by doxygen
|