ThePEG::RefVector< T, R > Class Template Reference

The RefVector and its base class RefVectorBase defines an interface to a class derived from the InterfacedBase, through which vectors (or any other container) of pointers to other InterfacedBase objects may be manipulated. More...

#include <RefVector.h>

Inheritance diagram for ThePEG::RefVector< T, R >:

ThePEG::RefVectorBase ThePEG::RefInterfaceBase ThePEG::InterfaceBase ThePEG::Named

List of all members.

Public Types

typedef Ptr< R >::pointer RefPtr
 A pointer to the class of objects referred to.
typedef Ptr< R >::const_pointer cRefPtr
 A const pointer to the class of objects referred to.
typedef void(T::* SetFn )(RefPtr, int)
 A pointer to a menberfunction to be used for the 'set' action.
typedef void(T::* InsFn )(RefPtr, int)
 A pointer to a menberfunction to be used for the 'insert' action.
typedef void(T::* DelFn )(int)
 A pointer to a menberfunction to be used for the 'erase' action.
typedef bool(T::* CheckFn )(cRefPtr, int) const
 A pointer to a menberfunction to be used for the 'check' action.
typedef vector< RefPtr >(T::* GetFn )() const
 A pointer to a menberfunction to be used for the 'get' action.
typedef vector< RefPtr > T::* Member
 Declaration of a direct pointer to the member variable in case it is a vector.

Public Member Functions

 RefVector (string newName, string newDescription, Member newMember, int newSize, bool depSafe=false, bool readonly=false, bool rebind=true, bool nullable=true, SetFn newSetFn=0, InsFn newInsFn=0, DelFn newDelFn=0, GetFn newGetFn=0, CheckFn newCheckFn=0)
 Standard constructor.
 RefVector (string newName, string newDescription, Member newMember, int newSize, bool depSafe, bool readonly, bool rebind, bool nullable, bool defnull, SetFn newSetFn=0, InsFn newInsFn=0, DelFn newDelFn=0, GetFn newGetFn=0, CheckFn newCheckFn=0)
 Standard constructor.
virtual void set (InterfacedBase &ib, IBPtr ip, int i, bool chk=true) const
 Set the i'th element of a container of pointers of ib to ip.
virtual void insert (InterfacedBase &ib, IBPtr ip, int i, bool chk=true) const
 Insert a new pointer before the i'th element of a container of pointers of ib and set it to ip.
virtual void erase (InterfacedBase &ib, int i) const
 Remove the i'th element of a container of pointers of ib.
virtual IVector get (const InterfacedBase &ib) const
 Return a vector of pointers corresponding to the container of pointers of ib.
virtual bool check (const InterfacedBase &ib, cIBPtr, int i) const
 Check if set(ib, ip, i) will be successfull but do not do anything.
void setSetFunction (SetFn sf)
 Give a pointer to a member function to be used by 'set()'.
void setInsertFunction (InsFn ifn)
 Give a pointer to a member function to be used by 'insert()'.
void setGetFunction (GetFn gf)
 Give a pointer to a member function to be used by 'get()'.
void setEraseFunction (DelFn df)
 Give a pointer to a member function to be used by 'erase()'.
void setCheckFunction (CheckFn cf)
 Give a pointer to a member function to be used by 'check()'.

Private Attributes

Member theMember
 The pointer to the member variable.
SetFn theSetFn
 A pointer to a member function to be used by 'set()'.
InsFn theInsFn
 Give a pointer to a member function to be used by 'insert()'.
DelFn theDelFn
 Give a pointer to a member function to be used by 'erase()'.
GetFn theGetFn
 Give a pointer to a member function to be used by 'get()'.
CheckFn theCheckFn
 Give a pointer to a member function to be used by 'check()'.


Detailed Description

template<class T, class R>
class ThePEG::RefVector< T, R >

The RefVector and its base class RefVectorBase defines an interface to a class derived from the InterfacedBase, through which vectors (or any other container) of pointers to other InterfacedBase objects may be manipulated.

RefVector is templated on the type of the class and the class of the objects pointed to, and is derived from the InterfaceBase class via RefVectorBase and RefInterfaceBase.

For each InterfacedBase class exactly one static RefVector object should created for each member variable of container type which should be interfaced. This object will automatically register itself with the BaseRepository class.

See also:
InterfacedBase

InterfaceBase

Definition at line 209 of file RefVector.h.


Member Typedef Documentation

template<class T, class R>
typedef Ptr<R>::pointer ThePEG::RefVector< T, R >::RefPtr

A pointer to the class of objects referred to.

Definition at line 214 of file RefVector.h.

template<class T, class R>
typedef Ptr<R>::const_pointer ThePEG::RefVector< T, R >::cRefPtr

A const pointer to the class of objects referred to.

Definition at line 216 of file RefVector.h.

template<class T, class R>
typedef void(T::* ThePEG::RefVector< T, R >::SetFn)(RefPtr, int)

A pointer to a menberfunction to be used for the 'set' action.

template<class T, class R>
typedef void(T::* ThePEG::RefVector< T, R >::InsFn)(RefPtr, int)

A pointer to a menberfunction to be used for the 'insert' action.

template<class T, class R>
typedef void(T::* ThePEG::RefVector< T, R >::DelFn)(int)

A pointer to a menberfunction to be used for the 'erase' action.

template<class T, class R>
typedef bool(T::* ThePEG::RefVector< T, R >::CheckFn)(cRefPtr, int) const

A pointer to a menberfunction to be used for the 'check' action.

template<class T, class R>
typedef vector<RefPtr>(T::* ThePEG::RefVector< T, R >::GetFn)() const

A pointer to a menberfunction to be used for the 'get' action.


Constructor & Destructor Documentation

template<class T, class R>
ThePEG::RefVector< T, R >::RefVector ( string  newName,
string  newDescription,
Member  newMember,
int  newSize,
bool  depSafe = false,
bool  readonly = false,
bool  rebind = true,
bool  nullable = true,
SetFn  newSetFn = 0,
InsFn  newInsFn = 0,
DelFn  newDelFn = 0,
GetFn  newGetFn = 0,
CheckFn  newCheckFn = 0 
)

Standard constructor.

Parameters:
newName the name of the interface, may only contain letters [a-zA-z0-9_].
newDescription a brief description of the interface.
newMember a pointer to a Member which is a TypeVector. May be null, in which case the pointers to member functions must be specified.
newSize the size of the container or -1 if varying.
depSafe set to true if calls to this interface for one object does not influence other objects.
readonly if this is set true the interface will not be able to manipulate objects of the corresponding class, but will still be able to access information.
rebind if set to true, this interface is responsible for the rebinding of corresponding objects.
nullable if set to true this corresponding references may be null.
newSetFn optional pointer to member function for the 'set' action.
newInsFn optional pointer to member function for the 'insert' action.
newDelFn optional pointer to member function for the 'erase' action.
newGetFn optional pointer to member function for the 'get' action.
newCheckFn optional pointer to member function for the 'check' action.

template<class T, class R>
ThePEG::RefVector< T, R >::RefVector ( string  newName,
string  newDescription,
Member  newMember,
int  newSize,
bool  depSafe,
bool  readonly,
bool  rebind,
bool  nullable,
bool  defnull,
SetFn  newSetFn = 0,
InsFn  newInsFn = 0,
DelFn  newDelFn = 0,
GetFn  newGetFn = 0,
CheckFn  newCheckFn = 0 
)

Standard constructor.

Parameters:
newName the name of the interface, may only contain letters [a-zA-z0-9_].
newDescription a brief description of the interface.
newMember a pointer to a Member which is a TypeVector. May be null, in which case the pointers to member functions must be specified.
newSize the size of the container or -1 if varying.
depSafe set to true if calls to this interface for one object does not influence other objects.
readonly if this is set true the interface will not be able to manipulate objects of the corresponding class, but will still be able to access information.
rebind if set to true, this interface is responsible for the rebinding of corresponding objects.
nullable if set to true this corresponding references may be null.
defnull if set to true and a corresponding reference is null it may be given a a default value in the initialization of an EventGenerator.
newSetFn optional pointer to member function for the 'set' action.
newInsFn optional pointer to member function for the 'insert' action.
newDelFn optional pointer to member function for the 'erase' action.
newGetFn optional pointer to member function for the 'get' action.
newCheckFn optional pointer to member function for the 'check' action.


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

Generated on Thu Apr 29 12:43:09 2010 for ThePEG by  doxygen 1.5.5