thepeg
is hosted by
Hepforge
,
IPPP Durham
ThePEG
2.3.0
Interface
InterfaceBase.h
1
// -*- C++ -*-
2
//
3
// InterfaceBase.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_InterfaceBase_H
10
#define ThePEG_InterfaceBase_H
11
// This is the declaration of the InterfaceBase and RefInterfaceBase classes.
12
13
#include "
ThePEG/Config/ThePEG.h
"
14
#include "InterfaceBase.fh"
15
#include "InterfaceBase.xh"
16
#include "ThePEG/Utilities/Named.h"
17
#include "ThePEG/Utilities/ClassTraits.h"
18
#include "Interface.h"
19
20
namespace
ThePEG
{
21
59
class
InterfaceBase
:
public
Named
{
60
61
public
:
62
83
InterfaceBase
(
string
newName,
string
newDescription,
84
string
newClassName,
85
const
type_info & newTypeInfo,
bool
depSafe,
86
bool
readonly);
87
91
virtual
~InterfaceBase
() {}
92
97
string
tag
(
int
pos = -1)
const
;
98
104
virtual
string
105
exec
(
InterfacedBase
& ib,
string
action,
string
arguments)
const
106
= 0;
107
111
virtual
string
type
()
const
= 0;
112
117
virtual
bool
notDefault
(
InterfacedBase
&)
const
;
118
122
map<string,string> &
objectDefaults
(
InterfacedBase
&)
const
;
123
128
virtual
void
rebind
(
InterfacedBase
&,
129
const
TranslationMap
&,
130
const
IVector
& =
IVector
())
const
{}
131
136
virtual
IVector
getReferences
(
const
InterfacedBase
&)
const
{
137
return
IVector
();
138
}
139
143
string
description
()
const
{
return
theDescription
; }
144
148
virtual
string
fullDescription
(
const
InterfacedBase
& ib)
const
;
149
154
virtual
void
doxygenDescription
(ostream & stream)
const
;
155
160
virtual
string
doxygenType
()
const
= 0;
161
166
string
className
()
const
{
return
theClassName
; }
167
172
bool
dependencySafe
()
const
{
return
isDependencySafe
; }
173
178
void
setDependencySafe
() {
isDependencySafe
=
true
; }
179
184
void
setDependencySensitive
() {
isDependencySafe
=
false
; }
185
190
bool
readOnly
()
const
{
return
isReadOnly
&& (!
NoReadOnly
); }
191
196
void
setReadOnly
() {
isReadOnly
=
true
; }
197
202
void
setReadWrite
() {
isReadOnly
=
false
; }
203
208
bool
anonymous
()
const
{
return
description
().empty(); }
209
214
double
rank
()
const
{
return
theRank
; }
215
220
void
rank
(
double
r) {
theRank
= r; }
221
225
void
setHasDefault
(
bool
b) {
226
hasDefault
= b;
227
}
228
232
static
bool
NoReadOnly
;
233
234
private
:
235
239
string
theDescription
;
240
244
string
theClassName
;
245
250
double
theRank
;
251
252
protected
:
253
257
bool
hasDefault
;
258
263
mutable
bool
isDependencySafe
;
264
269
mutable
bool
isReadOnly
;
270
271
272
};
273
274
280
class
RefInterfaceBase
:
public
InterfaceBase
{
281
282
public
:
283
320
RefInterfaceBase
(
string
newName,
string
newDescription,
321
string
newClassName,
const
type_info & newTypeInfo,
322
string
newRefClassName,
323
const
type_info & newRefTypeInfo,
324
bool
depSafe,
bool
readonly,
325
bool
norebind,
bool
nullable,
bool
defnull);
326
331
string
refClassName
()
const
{
return
theRefClassName
; }
332
337
const
type_info &
refTypeInfo
()
const
{
return
theRefTypeInfo
; }
338
343
bool
noRebind
()
const
{
return
dontRebind
; }
344
349
void
setNoRebind
() {
dontRebind
=
true
; }
350
355
void
setRebind
() {
dontRebind
=
false
; }
356
361
bool
noNull
()
const
{
return
!
isNullable
; }
362
367
void
setNullable
() {
isNullable
=
true
; }
368
373
void
setNotNullable
() {
isNullable
=
false
; }
374
379
bool
defaultIfNull
()
const
{
return
theDefaultIfNull
; }
380
385
void
setDefaultIfNull
() {
theDefaultIfNull
=
true
; }
386
391
void
setNoDefaultIfNull
() {
theDefaultIfNull
=
false
; }
392
393
private
:
394
399
string
theRefClassName
;
400
404
const
type_info &
theRefTypeInfo
;
405
410
bool
dontRebind
;
411
416
bool
isNullable
;
417
422
bool
theDefaultIfNull
;
423
424
};
425
428
inline
double
operator/(
string
,
string
) {
return
0.0; }
429
432
inline
string
operator*(
double
,
string
) {
return
""
; }
433
434
}
435
436
#endif
/* ThePEG_InterfaceBaseH */
ThePEG.h
This is the main config header file for ThePEG.
ThePEG::InterfaceBase
The InterfaceBase class defines a generic interface to any class derived from the InterfacedBase clas...
Definition:
InterfaceBase.h:59
ThePEG::InterfaceBase::rank
void rank(double r)
Set the rank for this interface.
Definition:
InterfaceBase.h:220
ThePEG::InterfaceBase::theClassName
string theClassName
The class name and for the class this interface is defined for.
Definition:
InterfaceBase.h:244
ThePEG::InterfaceBase::notDefault
virtual bool notDefault(InterfacedBase &) const
Returns true if the setting for this interface has been changed from its default value.
ThePEG::InterfaceBase::theRank
double theRank
A rank assigned to this interface.
Definition:
InterfaceBase.h:250
ThePEG::InterfaceBase::rank
double rank() const
Get the rank for this interface.
Definition:
InterfaceBase.h:214
ThePEG::InterfaceBase::InterfaceBase
InterfaceBase(string newName, string newDescription, string newClassName, const type_info &newTypeInfo, bool depSafe, bool readonly)
Standard constructor.
ThePEG::InterfaceBase::NoReadOnly
static bool NoReadOnly
If set to true, all read-only interfaces can be changed.
Definition:
InterfaceBase.h:232
ThePEG::InterfaceBase::setReadWrite
void setReadWrite()
Unset the flag saying that this interface is allowed to change an object.
Definition:
InterfaceBase.h:202
ThePEG::InterfaceBase::rebind
virtual void rebind(InterfacedBase &, const TranslationMap &, const IVector &=IVector()) const
Rebind all references in ib according to the translation map.
Definition:
InterfaceBase.h:128
ThePEG::InterfaceBase::exec
virtual string exec(InterfacedBase &ib, string action, string arguments) const =0
Manipulate an object of the corresponding class.
ThePEG::InterfaceBase::tag
string tag(int pos=-1) const
Create a tag for this interface using its name and optional poisitional argument.
ThePEG::InterfaceBase::objectDefaults
map< string, string > & objectDefaults(InterfacedBase &) const
Returns the map of objectDefaults of the given object.
ThePEG::InterfaceBase::readOnly
bool readOnly() const
Get the flag saying whether this interface is allowed to change an object.
Definition:
InterfaceBase.h:190
ThePEG::InterfaceBase::className
string className() const
Return the class name for the class this interface is defined for.
Definition:
InterfaceBase.h:166
ThePEG::InterfaceBase::dependencySafe
bool dependencySafe() const
Get the flag saying whether changing an object with this interface may change the state of a dependen...
Definition:
InterfaceBase.h:172
ThePEG::InterfaceBase::description
string description() const
Return the description of this interface.
Definition:
InterfaceBase.h:143
ThePEG::InterfaceBase::fullDescription
virtual string fullDescription(const InterfacedBase &ib) const
Return a complete description of this interface.
ThePEG::InterfaceBase::setReadOnly
void setReadOnly()
Set the flag saying that this interface is allowed to change an object.
Definition:
InterfaceBase.h:196
ThePEG::InterfaceBase::type
virtual string type() const =0
Return a code for the type of this interface.
ThePEG::InterfaceBase::doxygenDescription
virtual void doxygenDescription(ostream &stream) const
Print a description to be included in the Doxygen documentation to the given stream.
ThePEG::InterfaceBase::isReadOnly
bool isReadOnly
The flag saying whether this interface is allowed to change an object.
Definition:
InterfaceBase.h:269
ThePEG::InterfaceBase::setDependencySensitive
void setDependencySensitive()
Set the flag saying whether changing an object with this interface may change the state of a dependen...
Definition:
InterfaceBase.h:184
ThePEG::InterfaceBase::theDescription
string theDescription
The description of this interface.
Definition:
InterfaceBase.h:239
ThePEG::InterfaceBase::isDependencySafe
bool isDependencySafe
The flag saying whether changing an object with this interface may change the state of a dependent ob...
Definition:
InterfaceBase.h:263
ThePEG::InterfaceBase::hasDefault
bool hasDefault
A flag indicating whether this interface has a default setting.
Definition:
InterfaceBase.h:257
ThePEG::InterfaceBase::getReferences
virtual IVector getReferences(const InterfacedBase &) const
For derived classes interfacing references between Interfaced objects, return the references for this...
Definition:
InterfaceBase.h:136
ThePEG::InterfaceBase::doxygenType
virtual string doxygenType() const =0
Return a string describing the type of interface to be included in the Doxygen documentation.
ThePEG::InterfaceBase::setHasDefault
void setHasDefault(bool b)
Indicate that this interface has a default value.
Definition:
InterfaceBase.h:225
ThePEG::InterfaceBase::setDependencySafe
void setDependencySafe()
Set the flag saying whether changing an object with this interface may change the state of a dependen...
Definition:
InterfaceBase.h:178
ThePEG::InterfaceBase::~InterfaceBase
virtual ~InterfaceBase()
The destructor.
Definition:
InterfaceBase.h:91
ThePEG::InterfaceBase::anonymous
bool anonymous() const
Return true if this interface is anonyous, ie.
Definition:
InterfaceBase.h:208
ThePEG::InterfacedBase
InterfacedBase is the base class of all Interfaced objects to be handled by the BaseRepository class.
Definition:
InterfacedBase.h:45
ThePEG::Named
The Named class is a simple concrete base class to used by classes of objects with a name.
Definition:
Named.h:24
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::RefInterfaceBase::setNotNullable
void setNotNullable()
Set the flag saying that the interface it is not allowed to set the reference to null.
Definition:
InterfaceBase.h:373
ThePEG::RefInterfaceBase::noRebind
bool noRebind() const
Get the flag saying whether the interface is responsible for rebinding of the corresponding refenerce...
Definition:
InterfaceBase.h:343
ThePEG::RefInterfaceBase::theDefaultIfNull
bool theDefaultIfNull
The flag saying wether a null pointer should be replaced by a default of suitable class when rebind i...
Definition:
InterfaceBase.h:422
ThePEG::RefInterfaceBase::refTypeInfo
const type_info & refTypeInfo() const
Return the type_info object of the class referred to by this interface.
Definition:
InterfaceBase.h:337
ThePEG::RefInterfaceBase::noNull
bool noNull() const
Get the flag saying whether the interface is allowed to set the reference to null.
Definition:
InterfaceBase.h:361
ThePEG::RefInterfaceBase::defaultIfNull
bool defaultIfNull() const
Get the flag saying wether a null pointer should be replaced by a default of suitable class when rebi...
Definition:
InterfaceBase.h:379
ThePEG::RefInterfaceBase::theRefClassName
string theRefClassName
The class name of the class referred to by this interface.
Definition:
InterfaceBase.h:399
ThePEG::RefInterfaceBase::setRebind
void setRebind()
Set the flag saying that the interface is responsible for rebinding refenerces.
Definition:
InterfaceBase.h:355
ThePEG::RefInterfaceBase::setNullable
void setNullable()
Set the flag saying that the interface it is allowed to set the reference to null.
Definition:
InterfaceBase.h:367
ThePEG::RefInterfaceBase::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.
ThePEG::RefInterfaceBase::refClassName
string refClassName() const
Return the class name of the class referred to by this interface.
Definition:
InterfaceBase.h:331
ThePEG::RefInterfaceBase::setDefaultIfNull
void setDefaultIfNull()
Set the flag saying that a null pointer should be replaced by a default of suitable class when rebind...
Definition:
InterfaceBase.h:385
ThePEG::RefInterfaceBase::isNullable
bool isNullable
The flag saying whether the interface is allowed to set a reference to null.
Definition:
InterfaceBase.h:416
ThePEG::RefInterfaceBase::setNoDefaultIfNull
void setNoDefaultIfNull()
Set the flag saying that a null pointer should not be replaced by a default of suitable class when re...
Definition:
InterfaceBase.h:391
ThePEG::RefInterfaceBase::theRefTypeInfo
const type_info & theRefTypeInfo
The type_info object of the class referred to by this interface.
Definition:
InterfaceBase.h:404
ThePEG::RefInterfaceBase::setNoRebind
void setNoRebind()
Set the flag saying that the interface is not responsible for rebinding refenerces.
Definition:
InterfaceBase.h:349
ThePEG::RefInterfaceBase::dontRebind
bool dontRebind
The flag saying whether the interface is responsible for rebinding refenerces.
Definition:
InterfaceBase.h:410
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
Generated on Thu Jun 20 2024 14:47:00 for ThePEG by
1.9.6