item_base | The type of an item. |
Public Types | |
typedef item_base | item_type |
The type representing an item. | |
typedef quark_base< item_base > | this_class |
The type of this class. | |
typedef std::vector< item_type > | inverse_map_type |
The type implementing a vector of items. | |
typedef inverse_map_type::size_type | value_type |
The type representing a unique identifier. | |
typedef UNORDERED_MAP< item_type, value_type > | forward_map_type |
The type associating an item to its unique identifier. | |
Public Member Functions | |
quark_base () | |
Constructs the object. | |
quark_base (const this_class &src) | |
Constructs the object by copying the source object. | |
virtual | ~quark_base () |
Destructs the object. | |
this_class & | operator= (const this_class &src) |
Copies another object to this object. | |
value_type | size () const |
Returns the number of item-identifier associations. | |
bool | exists (const item_type &x) |
Tests whether an item has an identifier assigned. | |
value_type | operator() (const item_type &x) |
Assigns the unique identifier for an item. | |
value_type | associate (const item_type &x) |
Assigns a unique identifier for a new item. | |
value_type | to_value (const item_type &x) const |
Returns the unique identifier for an item. | |
value_type | to_value (const item_type &x, const value_type &def) const |
Returns the unique identifier for an item. | |
const item_type & | to_item (const value_type &v) const |
Returns the item for the unique identifier. | |
Protected Attributes | |
forward_map_type | m_fwd |
Forward mapping: (item0, item1) -> value. | |
inverse_map_type | m_inv |
Inverse mapping: value -> (item0, item1). |
classias::quark_base< item_base >::quark_base | ( | const this_class & | src | ) | [inline] |
Constructs the object by copying the source object.
src | The source object. |
this_class& classias::quark_base< item_base >::operator= | ( | const this_class & | src | ) | [inline] |
Copies another object to this object.
src | The source object. |
value_type classias::quark_base< item_base >::size | ( | ) | const [inline] |
Returns the number of item-identifier associations.
value_type | The number of associations between items and identifiers. |
bool classias::quark_base< item_base >::exists | ( | const item_type & | x | ) | [inline] |
Tests whether an item has an identifier assigned.
x | The item. |
bool | true if the item is known. |
value_type classias::quark_base< item_base >::operator() | ( | const item_type & | x | ) | [inline] |
Assigns the unique identifier for an item.
If the item is unknown, this function assigns a new unique identifier to the item and return it.
x | The item. |
value_type classias::quark_base< item_base >::associate | ( | const item_type & | x | ) | [inline] |
Assigns a unique identifier for a new item.
If the item is unknown, this function assigns a new unique identifier to the item and return it. If the item is known, this function returns the existing identifier that was associated with the item.
x | The item. |
value_type classias::quark_base< item_base >::to_value | ( | const item_type & | x | ) | const [inline] |
Returns the unique identifier for an item.
If the item is unknown, this function throws quark_error.
x | The item. |
quark_error. |
value_type classias::quark_base< item_base >::to_value | ( | const item_type & | x, | |
const value_type & | def | |||
) | const [inline] |
Returns the unique identifier for an item.
If the item is unknown, this function returns the default identifier.
x | The item. | |
def | The default identifier if the item is unknown. |
const item_type& classias::quark_base< item_base >::to_item | ( | const value_type & | v | ) | const [inline] |
Returns the item for the unique identifier.
If the unique identifier is unknown, this function throws quark_error.
v | The unique identifier. |
quark_error. |