thepeg
is hosted by
Hepforge
,
IPPP Durham
ThePEG
2.2.1
Interface
RefVector.h
1
// -*- C++ -*-
2
//
3
// RefVector.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_RefVector_H
10
#define ThePEG_RefVector_H
11
// This is the declaration of the RefVector and RefVectorBase classes.
12
13
#include "
ThePEG/Config/ThePEG.h
"
14
#include "InterfaceBase.h"
15
#include "RefVector.xh"
16
#include "RefVector.fh"
17
18
namespace
ThePEG
{
19
38
class
RefVectorBase
:
public
RefInterfaceBase
{
39
40
public
:
41
79
RefVectorBase
(
string
newName,
string
newDescription,
80
string
newClassName,
81
const
type_info & newTypeInfo,
82
string
newRefClassName,
83
const
type_info & newRefTypeInfo,
84
int
newSize,
bool
depSafe,
85
bool
readonly,
bool
norebind,
bool
nullable,
bool
defnull);
86
95
virtual
string
exec
(
InterfacedBase
& ib,
string
action,
96
string
arguments)
const
;
97
101
virtual
string
fullDescription
(
const
InterfacedBase
& ib)
const
;
102
106
virtual
string
type
()
const
;
107
112
virtual
string
doxygenType
()
const
;
113
118
virtual
void
set
(
InterfacedBase
& ib,
IBPtr
ip,
int
i,
bool
chk =
true
)
119
const
= 0;
120
125
virtual
void
insert
(
InterfacedBase
& ib,
IBPtr
ip,
int
i,
bool
chk =
true
)
126
const
= 0;
127
131
virtual
void
erase
(
InterfacedBase
& ib,
int
i)
132
const
= 0;
133
137
virtual
void
clear
(
InterfacedBase
& ib)
138
const
= 0;
139
144
virtual
IVector
get
(
const
InterfacedBase
& ib)
const
145
= 0;
146
151
virtual
bool
check
(
const
InterfacedBase
& ib,
cIBPtr
ip,
int
i)
const
152
= 0;
153
160
virtual
void
rebind
(
InterfacedBase
& ib,
const
TranslationMap
& trans,
161
const
IVector
& defs)
const
;
162
166
virtual
IVector
getReferences
(
const
InterfacedBase
& ib)
const
;
167
172
int
size
()
const
{
return
theSize
; }
173
178
void
setSize
(
int
sz) {
theSize
= sz; }
179
184
void
setVariableSize
() {
theSize
= 0; }
185
186
private
:
187
191
int
theSize
;
192
193
};
194
195
214
template
<
class
T,
class
R>
215
class
RefVector
:
public
RefVectorBase
{
216
217
public
:
218
220
typedef
typename
Ptr<R>::pointer
RefPtr
;
222
typedef
typename
Ptr<R>::const_pointer
cRefPtr
;
224
typedef
void (T::*SetFn)(RefPtr, int);
226
typedef
void (T::*InsFn)(RefPtr, int);
228
typedef
void (T::*DelFn)(int);
230
typedef
bool (T::*CheckFn)(cRefPtr, int)
const
;
232
typedef
vector<RefPtr> (T::*
GetFn
)()
const
;
237
typedef
vector<RefPtr> T::*
Member
;
238
239
public
:
240
283
RefVector
(
string
newName,
string
newDescription,
284
Member
newMember,
int
newSize,
bool
depSafe =
false
,
285
bool
readonly =
false
,
bool
rebind
=
true
,
bool
nullable =
true
,
286
SetFn newSetFn = 0, InsFn newInsFn = 0, DelFn newDelFn = 0,
287
GetFn newGetFn = 0, CheckFn newCheckFn = 0);
288
335
RefVector
(
string
newName,
string
newDescription,
336
Member
newMember,
int
newSize,
bool
depSafe,
337
bool
readonly,
bool
rebind
,
bool
nullable,
bool
defnull,
338
SetFn newSetFn = 0, InsFn newInsFn = 0, DelFn newDelFn = 0,
339
GetFn newGetFn = 0, CheckFn newCheckFn = 0);
340
345
virtual
void
set
(
InterfacedBase
& ib,
IBPtr
ip,
int
i,
bool
chk =
true
)
346
const
;
347
352
virtual
void
insert
(
InterfacedBase
& ib,
IBPtr
ip,
int
i,
bool
chk =
true
)
353
const
;
354
358
virtual
void
erase
(
InterfacedBase
& ib,
int
i)
359
const
;
360
364
virtual
void
clear
(
InterfacedBase
& ib)
365
const
;
366
371
virtual
IVector
get
(
const
InterfacedBase
& ib)
const
372
;
373
378
virtual
bool
check
(
const
InterfacedBase
& ib,
cIBPtr
,
int
i)
const
379
;
380
384
void
setSetFunction
(SetFn sf) { theSetFn = sf; }
385
389
void
setInsertFunction
(InsFn ifn) { theInsFn = ifn; }
390
394
void
setGetFunction
(GetFn gf) { theGetFn = gf; }
395
399
void
setEraseFunction
(DelFn df) { theDelFn = df; }
400
404
void
setCheckFunction
(CheckFn cf) { theCheckFn = cf; }
405
406
private
:
407
411
Member
theMember
;
412
416
SetFn
theSetFn
;
417
421
InsFn
theInsFn
;
422
426
DelFn
theDelFn
;
427
431
GetFn
theGetFn
;
432
436
CheckFn
theCheckFn
;
437
438
};
439
440
}
441
442
#include "RefVector.tcc"
443
444
#endif
/* ThePEG_RefVector_H */
ThePEG::RefVectorBase::clear
virtual void clear(InterfacedBase &ib) const =0
Clear the container of pointers of ib.
ThePEG::RefVector::setSetFunction
void setSetFunction(SetFn sf)
Give a pointer to a member function to be used by 'set()'.
Definition:
RefVector.h:384
ThePEG::RefVector::theInsFn
InsFn theInsFn
Give a pointer to a member function to be used by 'insert()'.
Definition:
RefVector.h:421
ThePEG::RefVectorBase::insert
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...
ThePEG::RefVector::RefPtr
Ptr< R >::pointer RefPtr
A pointer to the class of objects referred to.
Definition:
RefVector.h:220
ThePEG::RefVectorBase::getReferences
virtual IVector getReferences(const InterfacedBase &ib) const
Return pointers to other objects in ib.
ThePEG::RefVectorBase::fullDescription
virtual string fullDescription(const InterfacedBase &ib) const
Return a complete description of this reference vector.
ThePEG::RefVectorBase::setSize
void setSize(int sz)
Set the size of the container being interfaced.
Definition:
RefVector.h:178
ThePEG::RefVector::Member
vector< RefPtr > T::* Member
Declaration of a direct pointer to the member variable in case it is a vector.
Definition:
RefVector.h:237
ThePEG::RefVector::setGetFunction
void setGetFunction(GetFn gf)
Give a pointer to a member function to be used by 'get()'.
Definition:
RefVector.h:394
ThePEG::RefVectorBase::check
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.
ThePEG::RefVector
The RefVector and its base class RefVectorBase defines an interface to a class derived from the Inter...
Definition:
RefVector.h:215
ThePEG::Pointer::ConstRCPtr
ConstRCPtr is a reference counted (smart) const pointer.
Definition:
RCPtr.h:320
ThePEG::Rebinder
Rebinder is a class associating pairs of pointers to objects.
Definition:
Rebinder.h:27
ThePEG
This is the main namespace within which all identifiers in ThePEG are declared.
Definition:
FactoryBase.h:28
ThePEG.h
This is the main config header file for ThePEG.
ThePEG::RefVectorBase::erase
virtual void erase(InterfacedBase &ib, int i) const =0
Remove the i'th element of a container of pointers of ib.
ThePEG::RefVectorBase::setVariableSize
void setVariableSize()
Set the size of the container being interfaced to -1, i.e.
Definition:
RefVector.h:184
ThePEG::RefVector::cRefPtr
Ptr< R >::const_pointer cRefPtr
A const pointer to the class of objects referred to.
Definition:
RefVector.h:222
ThePEG::RefVectorBase::theSize
int theSize
The size of the container being interfaced.
Definition:
RefVector.h:191
ThePEG::RefVector::theSetFn
SetFn theSetFn
A pointer to a member function to be used by 'set()'.
Definition:
RefVector.h:416
ThePEG::RefVectorBase::doxygenType
virtual string doxygenType() const
Return a string describing the type of interface to be included in the Doxygen documentation.
ThePEG::RefVectorBase
The RefVector and its base class RefVectorBase defines an interface to a class derived from the Inter...
Definition:
RefVector.h:38
ThePEG::RefVector::setCheckFunction
void setCheckFunction(CheckFn cf)
Give a pointer to a member function to be used by 'check()'.
Definition:
RefVector.h:404
ThePEG::RefVectorBase::exec
virtual string exec(InterfacedBase &ib, string action, string arguments) const
The general interface method overriding the one in InterfaceBase.
ThePEG::RefVector::setEraseFunction
void setEraseFunction(DelFn df)
Give a pointer to a member function to be used by 'erase()'.
Definition:
RefVector.h:399
ThePEG::RefVectorBase::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.
ThePEG::RefVector::theGetFn
GetFn theGetFn
Give a pointer to a member function to be used by 'get()'.
Definition:
RefVector.h:431
ThePEG::RefVectorBase::rebind
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...
ThePEG::InterfacedBase
InterfacedBase is the base class of all Interfaced objects to be handled by the BaseRepository class...
Definition:
InterfacedBase.h:45
ThePEG::RefInterfaceBase
RefInterfaceBase is an abstract base class inheriting from InterfaceBase used for subclasses dealing ...
Definition:
InterfaceBase.h:280
ThePEG::RefVector::setInsertFunction
void setInsertFunction(InsFn ifn)
Give a pointer to a member function to be used by 'insert()'.
Definition:
RefVector.h:389
ThePEG::RefVector::GetFn
vector< RefPtr >(T::* GetFn)() const
A pointer to a menberfunction to be used for the 'get' action.
Definition:
RefVector.h:232
ThePEG::RefVectorBase::type
virtual string type() const
Return a code for the type of this reference.
ThePEG::Pointer::RCPtr
RCPtr is a reference counted (smart) pointer.
Definition:
RCPtr.h:60
ThePEG::RefVector::theMember
Member theMember
The pointer to the member variable.
Definition:
RefVector.h:411
ThePEG::RefVectorBase::size
int size() const
Get the size of the container being interfaced.
Definition:
RefVector.h:172
ThePEG::IVector
vector< IBPtr > IVector
A vector of pointers to InterfacedBase objects.
Definition:
Containers.h:67
ThePEG::RefVector::theDelFn
DelFn theDelFn
Give a pointer to a member function to be used by 'erase()'.
Definition:
RefVector.h:426
ThePEG::RefVector::theCheckFn
CheckFn theCheckFn
Give a pointer to a member function to be used by 'check()'.
Definition:
RefVector.h:436
Generated on Sat Apr 11 2020 14:31:17 for ThePEG by
1.8.13