thepeg is hosted by Hepforge, IPPP Durham
ThePEG 2.3.0
ThePEG::Rebinder< T > Class Template Reference

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, TPtrMapType
 Map associating pairs of objects.
 
typedef MapType::const_iterator const_iterator
 The iterator of the underlying map.
 

Public Member Functions

 Rebinder ()
 Default constructor.
 
TPtroperator[] (tcTPtr t)
 Return a pointer to the object associated with the argument.
 
template<typename 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 >
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 MapTypemap () const
 Acces the underlying map representation.
 

Private Member Functions

 Rebinder (const Rebinder &)
 The copy constructor is private and not implemented.
 
Rebinderoperator= (const Rebinder &)=delete
 The assignment operator is private and not implemented.
 

Private Attributes

MapType theMap
 The underlying map representation.
 

Detailed Description

template<typename T>
class ThePEG::Rebinder< T >

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.

Member Typedef Documentation

◆ const_iterator

template<typename T >
typedef MapType::const_iterator ThePEG::Rebinder< T >::const_iterator

The iterator of the underlying map.

Definition at line 42 of file Rebinder.h.

◆ cTPtr

template<typename T >
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.

◆ MapType

template<typename T >
typedef std::map<cTPtr,TPtr> ThePEG::Rebinder< T >::MapType

Map associating pairs of objects.

Definition at line 39 of file Rebinder.h.

◆ tcTPtr

template<typename T >
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.

◆ TPtr

template<typename T >
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.

◆ tTPtr

template<typename T >
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.

Constructor & Destructor Documentation

◆ Rebinder()

template<typename T >
ThePEG::Rebinder< T >::Rebinder ( )
inline

Default constructor.

Definition at line 32 of file Rebinder.h.

Member Function Documentation

◆ alwaysTranslate() [1/2]

template<typename T >
template<typename R >
R ThePEG::Rebinder< T >::alwaysTranslate ( const R &  r) const
inline

Return a pointer to the object associated with the argument.

If no corresponding object is found an exception is thrown.

Parameters
ra 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().

◆ alwaysTranslate() [2/2]

template<typename T >
template<typename OutputIterator , typename InputIterator >
void ThePEG::Rebinder< T >::alwaysTranslate ( OutputIterator  r,
InputIterator  first,
InputIterator  last 
) const
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().

◆ map()

template<typename T >
const MapType & ThePEG::Rebinder< T >::map ( ) const
inline

Acces the underlying map representation.

Definition at line 105 of file Rebinder.h.

References ThePEG::Rebinder< T >::theMap.

◆ operator[]()

template<typename T >
TPtr & ThePEG::Rebinder< T >::operator[] ( tcTPtr  t)
inline

Return a pointer to the object associated with the argument.

Definition at line 49 of file Rebinder.h.

References ThePEG::Rebinder< T >::theMap.

◆ translate() [1/2]

template<typename T >
template<typename R >
R ThePEG::Rebinder< T >::translate ( const R &  r) const
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.

Parameters
ra 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().

◆ translate() [2/2]

template<typename T >
template<typename OutputIterator , typename InputIterator >
void ThePEG::Rebinder< T >::translate ( OutputIterator  r,
InputIterator  first,
InputIterator  last 
) const
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().

Member Data Documentation

◆ theMap

template<typename T >
MapType ThePEG::Rebinder< T >::theMap
private

The documentation for this class was generated from the following file: