ThePEG
1.8.0
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
Interface
RefVector.h
1
// -*- C++ -*-
2
//
3
// RefVector.h is a part of ThePEG - Toolkit for HEP Event Generation
4
// Copyright (C) 1999-2011 Leif Lonnblad
5
//
6
// ThePEG is licenced under version 2 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
138
virtual
IVector
get
(
const
InterfacedBase
& ib)
const
139
= 0;
140
145
virtual
bool
check
(
const
InterfacedBase
& ib,
cIBPtr
ip,
int
i)
const
146
= 0;
147
154
virtual
void
rebind
(
InterfacedBase
& ib,
const
TranslationMap
& trans,
155
const
IVector
& defs)
const
;
156
160
virtual
IVector
getReferences
(
const
InterfacedBase
& ib)
const
;
161
166
int
size
()
const
{
return
theSize
; }
167
172
void
setSize
(
int
sz) {
theSize
= sz; }
173
178
void
setVariableSize
() {
theSize
= 0; }
179
180
private
:
181
185
int
theSize
;
186
187
};
188
189
208
template
<
class
T,
class
R>
209
class
RefVector
:
public
RefVectorBase
{
210
211
public
:
212
214
typedef
typename
Ptr<R>::pointer
RefPtr
;
216
typedef
typename
Ptr<R>::const_pointer
cRefPtr
;
218
typedef
void (T::*
SetFn
)(
RefPtr
, int);
220
typedef
void (T::*
InsFn
)(
RefPtr
, int);
222
typedef
void (T::*
DelFn
)(int);
224
typedef
bool (T::*
CheckFn
)(
cRefPtr
, int)
const
;
226
typedef
vector<RefPtr> (T::*
GetFn
)()
const
;
231
typedef
vector<RefPtr> T::*
Member
;
232
233
public
:
234
277
RefVector
(
string
newName,
string
newDescription,
278
Member
newMember,
int
newSize,
bool
depSafe =
false
,
279
bool
readonly =
false
,
bool
rebind
=
true
,
bool
nullable =
true
,
280
SetFn
newSetFn = 0,
InsFn
newInsFn = 0,
DelFn
newDelFn = 0,
281
GetFn
newGetFn = 0,
CheckFn
newCheckFn = 0);
282
329
RefVector
(
string
newName,
string
newDescription,
330
Member
newMember,
int
newSize,
bool
depSafe,
331
bool
readonly,
bool
rebind
,
bool
nullable,
bool
defnull,
332
SetFn
newSetFn = 0,
InsFn
newInsFn = 0,
DelFn
newDelFn = 0,
333
GetFn
newGetFn = 0,
CheckFn
newCheckFn = 0);
334
339
virtual
void
set
(
InterfacedBase
& ib,
IBPtr
ip,
int
i,
bool
chk =
true
)
340
const
;
341
346
virtual
void
insert
(
InterfacedBase
& ib,
IBPtr
ip,
int
i,
bool
chk =
true
)
347
const
;
348
352
virtual
void
erase
(
InterfacedBase
& ib,
int
i)
353
const
;
354
359
virtual
IVector
get
(
const
InterfacedBase
& ib)
const
360
;
361
366
virtual
bool
check
(
const
InterfacedBase
& ib,
cIBPtr
,
int
i)
const
367
;
368
372
void
setSetFunction
(
SetFn
sf) {
theSetFn
= sf; }
373
377
void
setInsertFunction
(
InsFn
ifn) {
theInsFn
= ifn; }
378
382
void
setGetFunction
(
GetFn
gf) {
theGetFn
= gf; }
383
387
void
setEraseFunction
(
DelFn
df) {
theDelFn
= df; }
388
392
void
setCheckFunction
(
CheckFn
cf) {
theCheckFn
= cf; }
393
394
private
:
395
399
Member
theMember
;
400
404
SetFn
theSetFn
;
405
409
InsFn
theInsFn
;
410
414
DelFn
theDelFn
;
415
419
GetFn
theGetFn
;
420
424
CheckFn
theCheckFn
;
425
426
};
427
428
}
429
430
#include "RefVector.tcc"
431
432
#endif
/* ThePEG_RefVector_H */
Generated on Mon Jul 2 2012 16:06:47 for ThePEG by
1.8.1.1