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

The Reference and its base class ReferenceBase defines an interface to a class derived from the InterfacedBase, through which pointers to other InterfacedBase objects may be manipulated. More...

#include <Reference.h>

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

ThePEG::ReferenceBase 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)
 A pointer to a menberfunction to be used for the 'set' action.
typedef bool(T::* CheckFn )(cRefPtr) const
 A pointer to a menberfunction to be used for the 'check' action.
typedef RefPtr(T::* GetFn )() const
 A pointer to a menberfunction to be used for the 'get' action.
typedef RefPtr T::* Member
 Declaration of a direct pointer to the member variable.

Public Member Functions

 Reference (string newName, string newDescription, Member newMember, bool depSafe=false, bool readonly=false, bool rebind=true, bool nullable=true, SetFn newSetFn=0, GetFn newGetFn=0, CheckFn newCheckFn=0)
 Standard constructor.
 Reference (string newName, string newDescription, Member newMember, bool depSafe, bool readonly, bool rebind, bool nullable, bool defnull, SetFn newSetFn=0, GetFn newGetFn=0, CheckFn newCheckFn=0)
 Standard constructor.
virtual void set (InterfacedBase &ib, IBPtr ip, bool chk=true) const
 Set the pointer of ib to ip.
virtual IBPtr get (const InterfacedBase &ib) const
 Return the pointer of ib.
virtual bool check (const InterfacedBase &ib, cIBPtr newRef) const
 Check if set(ib, ip) 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 setGetFunction (GetFn gf)
 Give a pointer to a member function to be used by 'get()'.
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()'.
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::Reference< T, R >

The Reference and its base class ReferenceBase defines an interface to a class derived from the InterfacedBase, through which pointers to other InterfacedBase objects may be manipulated.

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

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

See also:
InterfacedBase

InterfaceBase

Definition at line 162 of file Reference.h.


Member Typedef Documentation

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

A pointer to the class of objects referred to.

Definition at line 167 of file Reference.h.

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

A const pointer to the class of objects referred to.

Definition at line 169 of file Reference.h.

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

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

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

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

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

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

template<class T, class R>
typedef RefPtr T::* ThePEG::Reference< T, R >::Member

Declaration of a direct pointer to the member variable.

Definition at line 177 of file Reference.h.


Constructor & Destructor Documentation

template<class T, class R>
ThePEG::Reference< T, R >::Reference ( string  newName,
string  newDescription,
Member  newMember,
bool  depSafe = false,
bool  readonly = false,
bool  rebind = true,
bool  nullable = true,
SetFn  newSetFn = 0,
GetFn  newGetFn = 0,
CheckFn  newCheckFn = 0 
) [inline]

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.
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.
newGetFn optional pointer to member function for the 'get' action.
newCheckFn optional pointer to member function for the 'check' action.

Definition at line 215 of file Reference.h.

template<class T, class R>
ThePEG::Reference< T, R >::Reference ( string  newName,
string  newDescription,
Member  newMember,
bool  depSafe,
bool  readonly,
bool  rebind,
bool  nullable,
bool  defnull,
SetFn  newSetFn = 0,
GetFn  newGetFn = 0,
CheckFn  newCheckFn = 0 
) [inline]

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.
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.
newGetFn optional pointer to member function for the 'get' action.
newCheckFn optional pointer to member function for the 'check' action.

Definition at line 265 of file Reference.h.


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

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