9 #ifndef THEPEG_ObjectIndexer_H
10 #define THEPEG_ObjectIndexer_H
13 #include "ThePEG/Config/ThePEG.h"
24 template <
typename IntT,
typename ObjT, IntT NoIndex = static_cast<IntT>(-1)>
49 typename ObjectIndexMap::iterator it =
objectIndex.find(o);
72 typename ObjectIndexMap::const_iterator it =
objectIndex.find(o);
73 return it ==
objectIndex.end()? NoIndex: it->second;
81 if ( i == NoIndex )
return tTPtr();
82 typename IndexObjectMap::iterator it =
indexObject.find(i);
84 TPtr o = new_ptr<ObjT>();
107 typename IndexObjectMap::const_iterator it =
indexObject.find(i);
117 if ( i == NoIndex )
return;
118 typename IndexObjectMap::iterator iit =
indexObject.find(i);
120 typename ObjectIndexMap::iterator oit =
objectIndex.find(o);
IntT next
The next index to be used.
bool included(IntT i) const
Return true if the given index is known.
IntT operator()(tTPtr o) const
Return the index for the given object.
map< IntT, tTPtr > IndexObjectMap
Map of objects to indices.
IndexObjectMap indexObject
All known objects keyed by their indices.
TransientRCPtr is a simple wrapper around a bare pointer which can be assigned to and from an RCPtr a...
bool included(tTPtr o) const
Return true if the given object is known.
ObjectIndexer & operator=(const ObjectIndexer &)
Private and non-existent assignment operator.
bool empty() const
Return true if no associations has been made.
This is the main namespace within which all identifiers in ThePEG are declared.
IntT operator()(tTPtr o)
Return the index for the given object.
ThePEG::Ptr< ObjT >::transient_pointer tTPtr
Alias for a transient pointer to ObjT .
ObjectIndexMap objectIndex
All known indices keyed by the corresponding objects.
#define ThePEG_DECLARE_TEMPLATE_POINTERS(full, abbrev)
This macro helps us to declare pointers and stuff to standard classes.
ObjectIndexer()
Empty constructor.
tTPtr find(IntT i) const
Return the object for the given index.
void clear()
Remove all associations.
RCPtr is a reference counted (smart) pointer.
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.
This is a templated class which dynamically associates (reference counted) objects to integer indices...
map< TPtr, IntT > ObjectIndexMap
Map of indices to objects.
void operator()(IntT i, tTPtr o)
Associate the given object with the given index.