ThePEG 2.3.0
|
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 . | |
typedef ThePEG::Ptr< ObjT >::const_pointer | cTPtr |
Alias for a reference counted pointer to a const ObjT . | |
typedef ThePEG::Ptr< ObjT >::transient_pointer | tTPtr |
Alias for a transient pointer to ObjT . | |
typedef ThePEG::Ptr< ObjT >::transient_const_pointer | tcTPtr |
Alias for a transient pointer to a const ObjT . | |
typedef map< IntT, tTPtr > | IndexObjectMap |
Map of objects to indices. | |
typedef map< TPtr, IntT > | ObjectIndexMap |
Map of indices to objects. | |
Public Member Functions | |
ObjectIndexer () | |
Empty constructor. | |
IntT | operator() (tTPtr o) |
Return the index for the given object. | |
IntT | operator() (tTPtr o) const |
Return the index for the given object. | |
IntT | find (tTPtr o) const |
Return the index for the given object. | |
tTPtr | operator() (IntT i) |
Return the object for the given index. | |
tTPtr | operator() (IntT i) const |
Return the object for the given index. | |
tTPtr | find (IntT i) const |
Return the object for the given index. | |
void | operator() (IntT i, tTPtr o) |
Associate the given object with the given index. | |
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<IntT,tTPtr> ThePEG::ObjectIndexer< IntT, ObjT, NoIndex >::IndexObjectMap |
Map of objects to indices.
Definition at line 32 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 |
Empty constructor.
Definition at line 42 of file ObjectIndexer.h.
|
inline |
Remove all associations.
Definition at line 144 of file ObjectIndexer.h.
References ThePEG::ObjectIndexer< IntT, ObjT, NoIndex >::indexObject, and ThePEG::ObjectIndexer< IntT, ObjT, NoIndex >::objectIndex.
|
inline |
Return true if no associations has been made.
Definition at line 152 of file ObjectIndexer.h.
References ThePEG::ObjectIndexer< IntT, ObjT, NoIndex >::indexObject, and ThePEG::ObjectIndexer< IntT, ObjT, NoIndex >::objectIndex.
|
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.
References ThePEG::ObjectIndexer< IntT, ObjT, NoIndex >::indexObject.
|
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.
References ThePEG::ObjectIndexer< IntT, ObjT, NoIndex >::objectIndex.
Referenced by ThePEG::ObjectIndexer< IntT, ObjT, NoIndex >::operator()().
|
inline |
Return true if the given index is known.
Definition at line 137 of file ObjectIndexer.h.
References ThePEG::ObjectIndexer< IntT, ObjT, NoIndex >::indexObject.
|
inline |
Return true if the given object is known.
Definition at line 130 of file ObjectIndexer.h.
References ThePEG::ObjectIndexer< IntT, ObjT, NoIndex >::objectIndex.
|
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.
References ThePEG::ObjectIndexer< IntT, ObjT, NoIndex >::indexObject, ThePEG::ObjectIndexer< IntT, ObjT, NoIndex >::next, and ThePEG::ObjectIndexer< IntT, ObjT, NoIndex >::objectIndex.
|
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.
References ThePEG::ObjectIndexer< IntT, ObjT, NoIndex >::find().
|
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.
References ThePEG::ObjectIndexer< IntT, ObjT, NoIndex >::indexObject, ThePEG::ObjectIndexer< IntT, ObjT, NoIndex >::next, and ThePEG::ObjectIndexer< IntT, ObjT, NoIndex >::objectIndex.
|
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.
References ThePEG::ObjectIndexer< IntT, ObjT, NoIndex >::indexObject, ThePEG::ObjectIndexer< IntT, ObjT, NoIndex >::next, and ThePEG::ObjectIndexer< IntT, ObjT, NoIndex >::objectIndex.
|
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.
References ThePEG::ObjectIndexer< IntT, ObjT, NoIndex >::find().
|
private |
All known objects keyed by their indices.
Definition at line 161 of file ObjectIndexer.h.
Referenced by ThePEG::ObjectIndexer< IntT, ObjT, NoIndex >::clear(), ThePEG::ObjectIndexer< IntT, ObjT, NoIndex >::empty(), ThePEG::ObjectIndexer< IntT, ObjT, NoIndex >::find(), ThePEG::ObjectIndexer< IntT, ObjT, NoIndex >::included(), and ThePEG::ObjectIndexer< IntT, ObjT, NoIndex >::operator()().
|
private |
The next index to be used.
Definition at line 171 of file ObjectIndexer.h.
Referenced by ThePEG::ObjectIndexer< IntT, ObjT, NoIndex >::operator()().
|
private |
All known indices keyed by the corresponding objects.
Definition at line 166 of file ObjectIndexer.h.
Referenced by ThePEG::ObjectIndexer< IntT, ObjT, NoIndex >::clear(), ThePEG::ObjectIndexer< IntT, ObjT, NoIndex >::empty(), ThePEG::ObjectIndexer< IntT, ObjT, NoIndex >::find(), ThePEG::ObjectIndexer< IntT, ObjT, NoIndex >::included(), and ThePEG::ObjectIndexer< IntT, ObjT, NoIndex >::operator()().