ThePEG
2.2.1
|
This is a templated class which dynamically associates (reference counted) objects to integer indices. More...
#include <ObjectIndexer.h>
Public Types | |
typedef ThePEG::Ptr< ObjT >::pointer | TPtr |
Alias for a reference counted pointer to ObjT . More... | |
typedef ThePEG::Ptr< ObjT >::const_pointer | cTPtr |
Alias for a reference counted pointer to a const ObjT . More... | |
typedef ThePEG::Ptr< ObjT >::transient_pointer | tTPtr |
Alias for a transient pointer to ObjT . More... | |
typedef ThePEG::Ptr< ObjT >::transient_const_pointer | tcTPtr |
Alias for a transient pointer to a const ObjT . More... | |
typedef map< IntT, tTPtr > | IndexObjectMap |
Map of objects to indices. | |
typedef map< TPtr, IntT > | ObjectIndexMap |
Map of indices to objects. More... | |
Public Member Functions | |
ObjectIndexer () | |
Empty constructor. | |
IntT | operator() (tTPtr o) |
Return the index for the given object. More... | |
IntT | operator() (tTPtr o) const |
Return the index for the given object. More... | |
IntT | find (tTPtr o) const |
Return the index for the given object. More... | |
tTPtr | operator() (IntT i) |
Return the object for the given index. More... | |
tTPtr | operator() (IntT i) const |
Return the object for the given index. More... | |
tTPtr | find (IntT i) const |
Return the object for the given index. More... | |
void | operator() (IntT i, tTPtr o) |
Associate the given object with the given index. More... | |
bool | included (tTPtr o) const |
Return true if the given object is known. | |
bool | included (IntT i) const |
Return true if the given index is known. | |
void | clear () |
Remove all associations. | |
bool | empty () const |
Return true if no associations has been made. | |
Private Member Functions | |
ObjectIndexer & | operator= (const ObjectIndexer &)=delete |
Private and non-existent assignment operator. | |
Private Attributes | |
IndexObjectMap | indexObject |
All known objects keyed by their indices. | |
ObjectIndexMap | objectIndex |
All known indices keyed by the corresponding objects. | |
IntT | next |
The next index to be used. | |
This is a templated class which dynamically associates (reference counted) objects to integer indices.
By default, all indices will be non-negative, but explicit usage of negative indices is allowed as long as they do not include NoIndex.
Definition at line 25 of file ObjectIndexer.h.
typedef ThePEG::Ptr< ObjT >::const_pointer ThePEG::ObjectIndexer< IntT, ObjT, NoIndex >::cTPtr |
Alias for a reference counted pointer to a const ObjT .
Definition at line 29 of file ObjectIndexer.h.
typedef map<TPtr,IntT> ThePEG::ObjectIndexer< IntT, ObjT, NoIndex >::ObjectIndexMap |
Map of indices to objects.
Definition at line 35 of file ObjectIndexer.h.
typedef ThePEG::Ptr< ObjT >::transient_const_pointer ThePEG::ObjectIndexer< IntT, ObjT, NoIndex >::tcTPtr |
Alias for a transient pointer to a const ObjT .
Definition at line 29 of file ObjectIndexer.h.
typedef ThePEG::Ptr< ObjT >::pointer ThePEG::ObjectIndexer< IntT, ObjT, NoIndex >::TPtr |
Alias for a reference counted pointer to ObjT .
Definition at line 29 of file ObjectIndexer.h.
typedef ThePEG::Ptr< ObjT >::transient_pointer ThePEG::ObjectIndexer< IntT, ObjT, NoIndex >::tTPtr |
Alias for a transient pointer to ObjT .
Definition at line 29 of file ObjectIndexer.h.
|
inline |
Return the index for the given object.
If the object is not known, NoIndex will be returned.
Definition at line 71 of file ObjectIndexer.h.
Referenced by ThePEG::ObjectIndexer< long, ThePEG::ColourLine >::operator()().
|
inline |
Return the object for the given index.
If the index is not known, a null pointer will be returned.
Definition at line 106 of file ObjectIndexer.h.
|
inline |
Return the index for the given object.
If the object is not known, a new index will be created.
Definition at line 48 of file ObjectIndexer.h.
|
inline |
Return the index for the given object.
If the object is not known, NoIndex will be returned.
Definition at line 63 of file ObjectIndexer.h.
|
inline |
Return the object for the given index.
If the index is not known, a new object will be (default) created.
Definition at line 80 of file ObjectIndexer.h.
|
inline |
Return the object for the given index.
If the index is not known, a null pointer will be returned.
Definition at line 98 of file ObjectIndexer.h.
|
inline |
Associate the given object with the given index.
Possible other associations involving the index or the object is removed. If the given index is NoIndex, this function does nothing.
Definition at line 116 of file ObjectIndexer.h.