thepeg
is hosted by
Hepforge
,
IPPP Durham
ThePEG
2.3.0
Interface
Reference.h
1
// -*- C++ -*-
2
//
3
// Reference.h is a part of ThePEG - Toolkit for HEP Event Generation
4
// Copyright (C) 1999-2019 Leif Lonnblad
5
//
6
// ThePEG is licenced under version 3 of the GPL, see COPYING for details.
7
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
8
//
9
#ifndef ThePEG_Reference_H
10
#define ThePEG_Reference_H
11
// This is the declaration of the Reference and ReferenceBase classes.
12
13
#include "
ThePEG/Config/ThePEG.h
"
14
#include "InterfaceBase.h"
15
#include "Reference.xh"
16
#include "Reference.fh"
17
18
namespace
ThePEG
{
19
37
class
ReferenceBase
:
public
RefInterfaceBase
{
38
39
public
:
40
76
ReferenceBase
(
string
newName,
string
newDescription,
77
string
newClassName,
78
const
type_info & newTypeInfo,
79
string
newRefClassName,
80
const
type_info & newRefTypeInfo,
bool
depSafe,
81
bool
readonly,
bool
norebind,
bool
nullable,
bool
defnull);
82
89
virtual
string
exec
(
InterfacedBase
& ib,
string
action,
90
string
arguments)
const
;
91
95
virtual
string
fullDescription
(
const
InterfacedBase
& ib)
const
;
96
100
virtual
string
type
()
const
;
101
106
virtual
string
doxygenType
()
const
;
107
111
virtual
void
set
(
InterfacedBase
& ib,
IBPtr
ip,
bool
chk =
true
)
112
const
= 0;
113
117
virtual
IBPtr
get
(
const
InterfacedBase
& ib)
118
const
= 0;
119
124
virtual
bool
check
(
const
InterfacedBase
& ib,
cIBPtr
ip)
const
125
= 0;
126
133
virtual
void
rebind
(
InterfacedBase
& ib,
const
TranslationMap
& trans,
134
const
IVector
& defs)
const
;
135
139
virtual
IVector
getReferences
(
const
InterfacedBase
& ib)
const
;
140
141
};
142
143
161
template
<
class
T,
class
R>
162
class
Reference
:
public
ReferenceBase
{
163
164
public
:
165
167
typedef
typename
Ptr<R>::pointer
RefPtr
;
169
typedef
typename
Ptr<R>::const_pointer
cRefPtr
;
171
typedef
void (T::*
SetFn
)(
RefPtr
);
173
typedef
bool (T::*
CheckFn
)(
cRefPtr
)
const
;
175
typedef
RefPtr
(T::*
GetFn
)()
const
;
177
typedef
RefPtr
T::*
Member
;
178
179
public
:
180
215
Reference
(
string
newName,
string
newDescription,
216
Member
newMember,
bool
depSafe =
false
,
217
bool
readonly =
false
,
bool
rebind
=
true
,
bool
nullable =
true
,
218
SetFn
newSetFn = 0,
GetFn
newGetFn = 0,
219
CheckFn
newCheckFn = 0)
220
:
ReferenceBase
(newName, newDescription,
221
ClassTraits
<T>::
className
(), typeid(T),
222
ClassTraits
<R>::
className
(), typeid(R),
223
depSafe, readonly, !
rebind
, nullable, false),
224
theMember
(newMember),
theSetFn
(newSetFn),
theGetFn
(newGetFn),
225
theCheckFn
(newCheckFn) {}
226
265
Reference
(
string
newName,
string
newDescription,
266
Member
newMember,
bool
depSafe,
bool
readonly,
bool
rebind
,
267
bool
nullable,
bool
defnull,
SetFn
newSetFn = 0,
GetFn
newGetFn = 0,
268
CheckFn
newCheckFn = 0)
269
:
ReferenceBase
(newName, newDescription,
270
ClassTraits
<T>::
className
(), typeid(T),
271
ClassTraits
<R>::
className
(), typeid(R),
272
depSafe, readonly, !
rebind
, nullable, defnull),
273
theMember
(newMember),
theSetFn
(newSetFn),
theGetFn
(newGetFn),
274
theCheckFn
(newCheckFn) {}
275
276
280
virtual
void
set
(
InterfacedBase
& ib,
IBPtr
ip,
bool
chk =
true
)
const
281
;
282
286
virtual
IBPtr
get
(
const
InterfacedBase
& ib)
const
287
;
288
293
virtual
bool
check
(
const
InterfacedBase
& ib,
cIBPtr
newRef)
const
294
;
295
299
void
setSetFunction
(
SetFn
sf) {
theSetFn
= sf; }
300
304
void
setGetFunction
(
GetFn
gf) {
theGetFn
= gf; }
305
309
void
setCheckFunction
(
CheckFn
cf) {
theCheckFn
= cf; }
310
311
private
:
312
316
Member
theMember
;
317
321
SetFn
theSetFn
;
322
326
GetFn
theGetFn
;
327
331
CheckFn
theCheckFn
;
332
333
334
};
335
336
}
337
338
#include "Reference.tcc"
339
340
#endif
/* ThePEG_Reference_H */
ThePEG.h
This is the main config header file for ThePEG.
ThePEG::InterfaceBase::className
string className() const
Return the class name for the class this interface is defined for.
Definition:
InterfaceBase.h:166
ThePEG::InterfacedBase
InterfacedBase is the base class of all Interfaced objects to be handled by the BaseRepository class.
Definition:
InterfacedBase.h:45
ThePEG::Pointer::ConstRCPtr
ConstRCPtr is a reference counted (smart) const pointer.
Definition:
RCPtr.h:320
ThePEG::Pointer::RCPtr
RCPtr is a reference counted (smart) pointer.
Definition:
RCPtr.h:60
ThePEG::Rebinder
Rebinder is a class associating pairs of pointers to objects.
Definition:
Rebinder.h:27
ThePEG::RefInterfaceBase
RefInterfaceBase is an abstract base class inheriting from InterfaceBase used for subclasses dealing ...
Definition:
InterfaceBase.h:280
ThePEG::ReferenceBase
The Reference class and its base class ReferenceBase defines an interface to a class derived from the...
Definition:
Reference.h:37
ThePEG::ReferenceBase::check
virtual bool check(const InterfacedBase &ib, cIBPtr ip) const =0
Check if set(ib, ip) will be successfull but do not do anything.
ThePEG::ReferenceBase::getReferences
virtual IVector getReferences(const InterfacedBase &ib) const
Return the pointer to another object in ib (in a vector).
ThePEG::ReferenceBase::get
virtual IBPtr get(const InterfacedBase &ib) const =0
Return the pointer of ib.
ThePEG::ReferenceBase::ReferenceBase
ReferenceBase(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.
ThePEG::ReferenceBase::doxygenType
virtual string doxygenType() const
Return a string describing the type of interface to be included in the Doxygen documentation.
ThePEG::ReferenceBase::rebind
virtual void rebind(InterfacedBase &ib, const TranslationMap &trans, const IVector &defs) const
In the object ib, replace the pointer in this interface with one of the translated ones provided by t...
ThePEG::ReferenceBase::fullDescription
virtual string fullDescription(const InterfacedBase &ib) const
Return a complete description of this reference.
ThePEG::ReferenceBase::type
virtual string type() const
Return a code for the type of this reference.
ThePEG::ReferenceBase::set
virtual void set(InterfacedBase &ib, IBPtr ip, bool chk=true) const =0
Set the pointer of ib to ip.
ThePEG::ReferenceBase::exec
virtual string exec(InterfacedBase &ib, string action, string arguments) const
The general interface method overriding the one in InterfaceBase.
ThePEG::Reference
The Reference and its base class ReferenceBase defines an interface to a class derived from the Inter...
Definition:
Reference.h:162
ThePEG::Reference::theSetFn
SetFn theSetFn
A pointer to a member function to be used by 'set()'.
Definition:
Reference.h:321
ThePEG::Reference::Reference
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.
Definition:
Reference.h:215
ThePEG::Reference::GetFn
RefPtr(T::* GetFn)() const
A pointer to a menberfunction to be used for the 'get' action.
Definition:
Reference.h:175
ThePEG::Reference::SetFn
void(T::* SetFn)(RefPtr)
A pointer to a menberfunction to be used for the 'set' action.
Definition:
Reference.h:171
ThePEG::Reference::setGetFunction
void setGetFunction(GetFn gf)
Give a pointer to a member function to be used by 'get()'.
Definition:
Reference.h:304
ThePEG::Reference::cRefPtr
Ptr< R >::const_pointer cRefPtr
A const pointer to the class of objects referred to.
Definition:
Reference.h:169
ThePEG::Reference::theMember
Member theMember
The pointer to the member variable.
Definition:
Reference.h:316
ThePEG::Reference::set
virtual void set(InterfacedBase &ib, IBPtr ip, bool chk=true) const
Set the pointer of ib to ip.
ThePEG::Reference::CheckFn
bool(T::* CheckFn)(cRefPtr) const
A pointer to a menberfunction to be used for the 'check' action.
Definition:
Reference.h:173
ThePEG::Reference::theCheckFn
CheckFn theCheckFn
Give a pointer to a member function to be used by 'check()'.
Definition:
Reference.h:331
ThePEG::Reference::theGetFn
GetFn theGetFn
Give a pointer to a member function to be used by 'get()'.
Definition:
Reference.h:326
ThePEG::Reference::setSetFunction
void setSetFunction(SetFn sf)
Give a pointer to a member function to be used by 'set()'.
Definition:
Reference.h:299
ThePEG::Reference::RefPtr
Ptr< R >::pointer RefPtr
A pointer to the class of objects referred to.
Definition:
Reference.h:167
ThePEG::Reference::check
virtual bool check(const InterfacedBase &ib, cIBPtr newRef) const
Check if set(ib, ip) will be successfull but do not do anything.
ThePEG::Reference::get
virtual IBPtr get(const InterfacedBase &ib) const
Return the pointer of ib.
ThePEG::Reference::Member
RefPtr T::* Member
Declaration of a direct pointer to the member variable.
Definition:
Reference.h:177
ThePEG::Reference::Reference
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.
Definition:
Reference.h:265
ThePEG::Reference::setCheckFunction
void setCheckFunction(CheckFn cf)
Give a pointer to a member function to be used by 'check()'.
Definition:
Reference.h:309
ThePEG
This is the main namespace within which all identifiers in ThePEG are declared.
Definition:
FactoryBase.h:28
ThePEG::IVector
vector< IBPtr > IVector
A vector of pointers to InterfacedBase objects.
Definition:
Containers.h:67
ThePEG::ClassTraits
The default concrete implementation of ClassTraitsBase.
Definition:
ClassTraits.h:134
Generated on Thu Jun 20 2024 14:47:00 for ThePEG by
1.9.6