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>
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 void | clear (InterfacedBase &ib) const |
Clear the 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()'. | |
Public Member Functions inherited from ThePEG::RefVectorBase | |
RefVectorBase (string newName, string newDescription, string newClassName, const type_info &newTypeInfo, string newRefClassName, const type_info &newRefTypeInfo, int newSize, bool depSafe, bool readonly, bool norebind, bool nullable, bool defnull) | |
Standard constructor. | |
virtual string | exec (InterfacedBase &ib, string action, string arguments) const |
The general interface method overriding the one in InterfaceBase. | |
virtual string | fullDescription (const InterfacedBase &ib) const |
Return a complete description of this reference vector. | |
virtual string | type () const |
Return a code for the type of this reference. | |
virtual string | doxygenType () const |
Return a string describing the type of interface to be included in the Doxygen documentation. | |
virtual void | set (InterfacedBase &ib, IBPtr ip, int i, bool chk=true) const =0 |
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 =0 |
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 =0 |
Remove the i'th element of a container of pointers of ib. | |
virtual void | clear (InterfacedBase &ib) const =0 |
Clear the container of pointers of ib. | |
virtual IVector | get (const InterfacedBase &ib) const =0 |
Return a vector of pointers corresponding to the container of pointers of ib. | |
virtual bool | check (const InterfacedBase &ib, cIBPtr ip, int i) const =0 |
Check if set(ib, ip, i) will be successfull but do not do anything. | |
virtual void | rebind (InterfacedBase &ib, const TranslationMap &trans, const IVector &defs) const |
In the object ib, replace all pointers to objects in this interface with the translated ones provided by trans. | |
virtual IVector | getReferences (const InterfacedBase &ib) const |
Return pointers to other objects in ib. | |
int | size () const |
Get the size of the container being interfaced. | |
void | setSize (int sz) |
Set the size of the container being interfaced. | |
void | setVariableSize () |
Set the size of the container being interfaced to -1, i.e. | |
Public Member Functions inherited from ThePEG::RefInterfaceBase | |
RefInterfaceBase (string newName, string newDescription, string newClassName, const type_info &newTypeInfo, string newRefClassName, const type_info &newRefTypeInfo, bool depSafe, bool readonly, bool norebind, bool nullable, bool defnull) | |
Standard constructor. | |
string | refClassName () const |
Return the class name of the class referred to by this interface. | |
const type_info & | refTypeInfo () const |
Return the type_info object of the class referred to by this interface. | |
bool | noRebind () const |
Get the flag saying whether the interface is responsible for rebinding of the corresponding refenerces. | |
void | setNoRebind () |
Set the flag saying that the interface is not responsible for rebinding refenerces. | |
void | setRebind () |
Set the flag saying that the interface is responsible for rebinding refenerces. | |
bool | noNull () const |
Get the flag saying whether the interface is allowed to set the reference to null. | |
void | setNullable () |
Set the flag saying that the interface it is allowed to set the reference to null. | |
void | setNotNullable () |
Set the flag saying that the interface it is not allowed to set the reference to null. | |
bool | defaultIfNull () const |
Get the flag saying wether a null pointer should be replaced by a default of suitable class when rebind is called. | |
void | setDefaultIfNull () |
Set the flag saying that a null pointer should be replaced by a default of suitable class when rebind is called. | |
void | setNoDefaultIfNull () |
Set the flag saying that a null pointer should not be replaced by a default of suitable class when rebind is called. | |
Public Member Functions inherited from ThePEG::InterfaceBase | |
InterfaceBase (string newName, string newDescription, string newClassName, const type_info &newTypeInfo, bool depSafe, bool readonly) | |
Standard constructor. | |
virtual | ~InterfaceBase () |
The destructor. | |
string | tag (int pos=-1) const |
Create a tag for this interface using its name and optional poisitional argument. | |
virtual string | exec (InterfacedBase &ib, string action, string arguments) const =0 |
Manipulate an object of the corresponding class. | |
virtual string | type () const =0 |
Return a code for the type of this interface. | |
virtual bool | notDefault (InterfacedBase &) const |
Returns true if the setting for this interface has been changed from its default value. | |
map< string, string > & | objectDefaults (InterfacedBase &) const |
Returns the map of objectDefaults of the given object. | |
virtual void | rebind (InterfacedBase &, const TranslationMap &, const IVector &=IVector()) const |
Rebind all references in ib according to the translation map. | |
virtual IVector | getReferences (const InterfacedBase &) const |
For derived classes interfacing references between Interfaced objects, return the references for this interface. | |
string | description () const |
Return the description of this interface. | |
virtual string | fullDescription (const InterfacedBase &ib) const |
Return a complete description of this interface. | |
virtual void | doxygenDescription (ostream &stream) const |
Print a description to be included in the Doxygen documentation to the given stream. | |
virtual string | doxygenType () const =0 |
Return a string describing the type of interface to be included in the Doxygen documentation. | |
string | className () const |
Return the class name for the class this interface is defined for. | |
bool | dependencySafe () const |
Get the flag saying whether changing an object with this interface may change the state of a dependent object . | |
void | setDependencySafe () |
Set the flag saying whether changing an object with this interface may change the state of a dependent object . | |
void | setDependencySensitive () |
Set the flag saying whether changing an object with this interface may change the state of a dependent object . | |
bool | readOnly () const |
Get the flag saying whether this interface is allowed to change an object. | |
void | setReadOnly () |
Set the flag saying that this interface is allowed to change an object. | |
void | setReadWrite () |
Unset the flag saying that this interface is allowed to change an object. | |
bool | anonymous () const |
Return true if this interface is anonyous, ie. | |
double | rank () const |
Get the rank for this interface. | |
void | rank (double r) |
Set the rank for this interface. | |
void | setHasDefault (bool b) |
Indicate that this interface has a default value. | |
Public Member Functions inherited from ThePEG::Named | |
Named (const string &newName=string()) | |
Constructor with name. | |
Named (const Named &)=default | |
Explicit default copy-constructor (too avoid compiler warnings) | |
const string & | name () const |
Return name. | |
bool | operator== (const Named &other) const |
Test for equality. | |
bool | operator< (const Named &other) const |
Lexicographical comparison. | |
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()'. | |
Additional Inherited Members | |
Static Public Attributes inherited from ThePEG::InterfaceBase | |
static bool | NoReadOnly |
If set to true, all read-only interfaces can be changed. | |
Protected Member Functions inherited from ThePEG::Named | |
const Named & | operator= (const Named &other) |
Assignment. | |
const string & | name (const string &newName) |
Set new name. | |
Protected Attributes inherited from ThePEG::InterfaceBase | |
bool | hasDefault |
A flag indicating whether this interface has a default setting. | |
bool | isDependencySafe |
The flag saying whether changing an object with this interface may change the state of a dependent object . | |
bool | isReadOnly |
The flag saying whether this interface is allowed to change an object. | |
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.
Definition at line 215 of file RefVector.h.
typedef bool(T::* ThePEG::RefVector< T, R >::CheckFn) (cRefPtr, int) const |
A pointer to a menberfunction to be used for the 'check' action.
Definition at line 230 of file RefVector.h.
typedef Ptr<R>::const_pointer ThePEG::RefVector< T, R >::cRefPtr |
A const pointer to the class of objects referred to.
Definition at line 222 of file RefVector.h.
typedef void(T::* ThePEG::RefVector< T, R >::DelFn) (int) |
A pointer to a menberfunction to be used for the 'erase' action.
Definition at line 228 of file RefVector.h.
typedef vector< RefPtr >(T::* ThePEG::RefVector< T, R >::GetFn) () const |
A pointer to a menberfunction to be used for the 'get' action.
Definition at line 232 of file RefVector.h.
typedef void(T::* ThePEG::RefVector< T, R >::InsFn) (RefPtr, int) |
A pointer to a menberfunction to be used for the 'insert' action.
Definition at line 226 of file RefVector.h.
typedef vector<RefPtr> T::* ThePEG::RefVector< T, R >::Member |
Declaration of a direct pointer to the member variable in case it is a vector.
Definition at line 237 of file RefVector.h.
typedef Ptr<R>::pointer ThePEG::RefVector< T, R >::RefPtr |
A pointer to the class of objects referred to.
Definition at line 220 of file RefVector.h.
typedef void(T::* ThePEG::RefVector< T, R >::SetFn) (RefPtr, int) |
A pointer to a menberfunction to be used for the 'set' action.
Definition at line 224 of file RefVector.h.
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.
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. |
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.
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. |
|
virtual |
Check if set(ib, ip, i) will be successfull but do not do anything.
Implements ThePEG::RefVectorBase.
|
virtual |
Clear the container of pointers of ib.
Implements ThePEG::RefVectorBase.
|
virtual |
Remove the i'th element of a container of pointers of ib.
Implements ThePEG::RefVectorBase.
|
virtual |
Return a vector of pointers corresponding to the container of pointers of ib.
Implements ThePEG::RefVectorBase.
|
virtual |
Insert a new pointer before the i'th element of a container of pointers of ib and set it to ip.
Implements ThePEG::RefVectorBase.
|
virtual |
Set the i'th element of a container of pointers of ib to ip.
Implements ThePEG::RefVectorBase.
|
inline |
Give a pointer to a member function to be used by 'check()'.
Definition at line 404 of file RefVector.h.
References ThePEG::RefVector< T, R >::theCheckFn.
|
inline |
Give a pointer to a member function to be used by 'erase()'.
Definition at line 399 of file RefVector.h.
References ThePEG::RefVector< T, R >::theDelFn.
|
inline |
Give a pointer to a member function to be used by 'get()'.
Definition at line 394 of file RefVector.h.
References ThePEG::RefVector< T, R >::theGetFn.
|
inline |
Give a pointer to a member function to be used by 'insert()'.
Definition at line 389 of file RefVector.h.
References ThePEG::RefVector< T, R >::theInsFn.
|
inline |
Give a pointer to a member function to be used by 'set()'.
Definition at line 384 of file RefVector.h.
References ThePEG::RefVector< T, R >::theSetFn.
|
private |
Give a pointer to a member function to be used by 'check()'.
Definition at line 436 of file RefVector.h.
Referenced by ThePEG::RefVector< T, R >::setCheckFunction().
|
private |
Give a pointer to a member function to be used by 'erase()'.
Definition at line 426 of file RefVector.h.
Referenced by ThePEG::RefVector< T, R >::setEraseFunction().
|
private |
Give a pointer to a member function to be used by 'get()'.
Definition at line 431 of file RefVector.h.
Referenced by ThePEG::RefVector< T, R >::setGetFunction().
|
private |
Give a pointer to a member function to be used by 'insert()'.
Definition at line 421 of file RefVector.h.
Referenced by ThePEG::RefVector< T, R >::setInsertFunction().
|
private |
The pointer to the member variable.
Definition at line 411 of file RefVector.h.
|
private |
A pointer to a member function to be used by 'set()'.
Definition at line 416 of file RefVector.h.
Referenced by ThePEG::RefVector< T, R >::setSetFunction().