thepeg is hosted by Hepforge, IPPP Durham
ThePEG  2.1.5
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 . More...
 
typedef ThePEG::Ptr< T >::const_pointer cTPtr
 Alias for a reference counted pointer to a const T . More...
 
typedef ThePEG::Ptr< T >::transient_pointer tTPtr
 Alias for a transient pointer to T . More...
 
typedef ThePEG::Ptr< T >::transient_const_pointer tcTPtr
 Alias for a transient pointer to a const T . More...
 
typedef std::map< cTPtr, TPtrMapType
 Map associating pairs of objects. More...
 
typedef MapType::const_iterator const_iterator
 The iterator of the underlying map. More...
 

Public Member Functions

 Rebinder ()
 Default constructor. More...
 
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. More...
 
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. More...
 
template<typename R >
alwaysTranslate (const R &r) const
 Return a pointer to the object associated with the argument. More...
 
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. More...
 
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::Pointer::dynamic_ptr_cast(), and 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().

◆ 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::Pointer::dynamic_ptr_cast(), and 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().


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