Rebinder is a class associating pairs of pointers to objects. More...
#include <Rebinder.h>
Public Types | |
typedef ThePEG::Ptr< T >::pointer | TPtr |
Alias for a reference counted pointer to T . | |
typedef ThePEG::Ptr< T >::const_pointer | cTPtr |
Alias for a reference counted pointer to a const T . | |
typedef ThePEG::Ptr< T >::transient_pointer | tTPtr |
Alias for a transient pointer to T . | |
typedef ThePEG::Ptr< T >::transient_const_pointer | tcTPtr |
Alias for a transient pointer to a const T . | |
typedef std::map< cTPtr, TPtr > | MapType |
Map associating pairs of objects. | |
typedef MapType::const_iterator | const_iterator |
The iterator of the underlying map. | |
Public Member Functions | |
Rebinder () | |
Default constructor. | |
TPtr & | operator[] (tcTPtr t) |
Return a pointer to the object associated with the argument. | |
template<typename R > | |
R | translate (const R &r) const |
Return a pointer to the object associated with the argument. | |
template<typename OutputIterator , typename InputIterator > | |
void | translate (OutputIterator r, InputIterator first, InputIterator last) const |
Insert pointers to objects into the output iterator, pointers to objects corresponding to the ones given by the range of input iterators. | |
template<typename R > | |
R | alwaysTranslate (const R &r) const |
Return a pointer to the object associated with the argument. | |
template<typename OutputIterator , typename InputIterator > | |
void | alwaysTranslate (OutputIterator r, InputIterator first, InputIterator last) const |
Insert pointers to objects into the output iterator, pointers to objects corresponding to the ones given by the range of input iterators. | |
const MapType & | map () const |
Acces the underlying map representation. | |
Private Member Functions | |
Rebinder (const Rebinder &) | |
The copy constructor is private and not implemented. | |
Rebinder & | operator= (const Rebinder &)=delete |
The assignment operator is private and not implemented. | |
Private Attributes | |
MapType | theMap |
The underlying map representation. | |
Rebinder is a class associating pairs of pointers to objects.
It is typically used when cloning a set of objects which have pointers to eachother. The Rebinder is then set up so that a cloned object can easily be retrieved given a pointer to the original one. The cloned objects can then use the Rebinder to change their pointers so that they henceforth points to the cloned copies.
Definition at line 27 of file Rebinder.h.
typedef MapType::const_iterator ThePEG::Rebinder< T >::const_iterator |
The iterator of the underlying map.
Definition at line 42 of file Rebinder.h.
typedef ThePEG::Ptr<T>::const_pointer ThePEG::Rebinder< T >::cTPtr |
Alias for a reference counted pointer to a const T .
Definition at line 36 of file Rebinder.h.
typedef std::map<cTPtr,TPtr> ThePEG::Rebinder< T >::MapType |
Map associating pairs of objects.
Definition at line 39 of file Rebinder.h.
typedef ThePEG::Ptr<T>::transient_const_pointer ThePEG::Rebinder< T >::tcTPtr |
Alias for a transient pointer to a const T .
Definition at line 36 of file Rebinder.h.
typedef ThePEG::Ptr<T>::pointer ThePEG::Rebinder< T >::TPtr |
Alias for a reference counted pointer to T .
Definition at line 36 of file Rebinder.h.
typedef ThePEG::Ptr<T>::transient_pointer ThePEG::Rebinder< T >::tTPtr |
Alias for a transient pointer to T .
Definition at line 36 of file Rebinder.h.
|
inline |
Default constructor.
Definition at line 32 of file Rebinder.h.
|
inline |
Return a pointer to the object associated with the argument.
If no corresponding object is found an exception is thrown.
r | a pointer to an object of a type which is derived from T. |
Definition at line 81 of file Rebinder.h.
References ThePEG::Rebinder< T >::theMap.
Referenced by ThePEG::Rebinder< T >::alwaysTranslate().
|
inline |
Insert pointers to objects into the output iterator, pointers to objects corresponding to the ones given by the range of input iterators.
If a given object in the input iterator range does not exists, an exception will be thrown.
Definition at line 97 of file Rebinder.h.
References ThePEG::Rebinder< T >::alwaysTranslate().
|
inline |
Acces the underlying map representation.
Definition at line 105 of file Rebinder.h.
References ThePEG::Rebinder< T >::theMap.
|
inline |
Return a pointer to the object associated with the argument.
Definition at line 49 of file Rebinder.h.
References ThePEG::Rebinder< T >::theMap.
|
inline |
Return a pointer to the object associated with the argument.
If no corresponding object is found a null pointer given by R() is returned.
r | a pointer to an object of a type which is derived from T. |
Definition at line 58 of file Rebinder.h.
References ThePEG::Rebinder< T >::theMap.
Referenced by ThePEG::Rebinder< T >::translate().
|
inline |
Insert pointers to objects into the output iterator, pointers to objects corresponding to the ones given by the range of input iterators.
If a given object in the input iterator range does not exists, a null pointer will be inserted in the output iterator.
Definition at line 70 of file Rebinder.h.
References ThePEG::Rebinder< T >::translate().
|
private |
The underlying map representation.
Definition at line 113 of file Rebinder.h.
Referenced by ThePEG::Rebinder< T >::alwaysTranslate(), ThePEG::Rebinder< T >::map(), ThePEG::Rebinder< T >::operator[](), and ThePEG::Rebinder< T >::translate().