/usr/include/ThePEG/Interface/Reference.h is in libthepeg-dev 1.8.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 | // -*- C++ -*-
//
// Reference.h is a part of ThePEG - Toolkit for HEP Event Generation
// Copyright (C) 1999-2011 Leif Lonnblad
//
// ThePEG is licenced under version 2 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
#ifndef ThePEG_Reference_H
#define ThePEG_Reference_H
// This is the declaration of the Reference and ReferenceBase classes.
#include "ThePEG/Config/ThePEG.h"
#include "InterfaceBase.h"
#include "Reference.xh"
#include "Reference.fh"
namespace ThePEG {
/**
* The Reference class and its base class ReferenceBase defines an
* interface to a class derived from the InterfacedBase, through which
* pointers to other InterfacedBase objects may be manipulated.
* Reference is templated on the type of the class and the class of
* the objects pointed to, and is derived from the InterfaceBase class
* via ReferenceBase and RefInterfaceBase.
*
* For each InterfacedBase class exactly one static Reference object
* should created for each member variable which should be
* interfaced. This object will automatically register itself with the
* BaseRepository class.
*
* @see InterfacedBase
* @see InterfaceBase
*
*/
class ReferenceBase: public RefInterfaceBase {
public:
/**
* Standard constructor.
*
* @param newName the name of the interface, may only contain
* letters [a-zA-z0-9_].
*
* @param newDescription a brief description of the interface.
*
* @param newClassName the name of the corresponding class.
*
* @param newTypeInfo the type_info object of the corresponding
* class.
*
* @param newRefClassName the name of the class pointed to.
*
* @param newRefTypeInfo the type_info object of the class pointed
* to.
*
* @param depSafe set to true if calls to this interface for one
* object does not influence other objects.
*
* @param 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.
*
* @param norebind if set to true, this interface is not responsible
* for the rebinding of corresponding objects.
*
* @param nullable if set to true this corresponding references may
* be null.
*
* @param 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.
*/
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);
/**
* The general interface method overriding the one in
* InterfaceBase. For this class, \a action can be any of "set" and
* "get" and \a argument should correspond to the name of an
* InterfacedBase object in the BaseRepository.
*/
virtual string exec(InterfacedBase & ib, string action,
string arguments) const;
/**
* Return a complete description of this reference.
*/
virtual string fullDescription(const InterfacedBase & ib) const;
/**
* Return a code for the type of this reference.
*/
virtual string type() const;
/**
* Return a string describing the type of interface to be included
* in the Doxygen documentation.
*/
virtual string doxygenType() const;
/**
* Set the pointer of \a ib to \a ip.
*/
virtual void set(InterfacedBase & ib, IBPtr ip, bool chk = true)
const = 0;
/**
* Return the pointer of \a ib.
*/
virtual IBPtr get(const InterfacedBase & ib)
const = 0;
/**
* Check if set(ib, ip) will be successfull but do not do
* anything.
*/
virtual bool check(const InterfacedBase & ib, cIBPtr ip) const
= 0;
/**
* In the object \a ib, replace the pointer in this interface with one
* of the translated ones provided by trans. If the pointer is null,
* and defaultIfNull() is true, replace it with the first allowed
* object found in \a defs.
*/
virtual void rebind(InterfacedBase & ib, const TranslationMap & trans,
const IVector & defs) const;
/**
* Return the pointer to another object in \a ib (in a vector).
*/
virtual IVector getReferences(const InterfacedBase & ib) const;
};
/**
* The Reference and its base class ReferenceBase defines an interface
* to a class derived from the InterfacedBase, through which pointers
* to other InterfacedBase objects may be manipulated. Reference is
* templated on the type of the class and the class of the objects
* pointed to, and is derived from the InterfaceBase class via
* ReferenceBase and RefInterfaceBase.
*
* For each InterfacedBase class exactly one static Reference object
* should created for each member variable which should be
* interfaced. This object will automatically register itself with the
* BaseRepository class.
*
* @see InterfacedBase
* @see InterfaceBase
*
*/
template <class T, class R>
class Reference: public ReferenceBase {
public:
/** A pointer to the class of objects referred to. */
typedef typename Ptr<R>::pointer RefPtr;
/** A const pointer to the class of objects referred to. */
typedef typename Ptr<R>::const_pointer cRefPtr;
/** A pointer to a menberfunction to be used for the 'set' action. */
typedef void (T::*SetFn)(RefPtr);
/** A pointer to a menberfunction to be used for the 'check' action. */
typedef bool (T::*CheckFn)(cRefPtr) const;
/** A pointer to a menberfunction to be used for the 'get' action. */
typedef RefPtr (T::*GetFn)() const;
/** Declaration of a direct pointer to the member variable. */
typedef RefPtr T::* Member;
public:
/**
* Standard constructor.
*
* @param newName the name of the interface, may only contain
* letters [a-zA-z0-9_].
*
* @param newDescription a brief description of the interface.
*
* @param newMember a pointer to a Member which is a TypeVector. May
* be null, in which case the pointers to member functions must be
* specified.
*
* @param depSafe set to true if calls to this interface for one
* object does not influence other objects.
*
* @param 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.
*
* @param rebind if set to true, this interface is responsible
* for the rebinding of corresponding objects.
*
* @param nullable if set to true this corresponding references may
* be null.
*
* @param newSetFn optional pointer to member function for the 'set'
* action.
*
* @param newGetFn optional pointer to member function for the
* 'get' action.
*
* @param newCheckFn optional pointer to member function for the
* 'check' action.
*/
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)
: ReferenceBase(newName, newDescription,
ClassTraits<T>::className(), typeid(T),
ClassTraits<R>::className(), typeid(R),
depSafe, readonly, !rebind, nullable, false),
theMember(newMember), theSetFn(newSetFn), theGetFn(newGetFn),
theCheckFn(newCheckFn) {}
/**
* Standard constructor.
*
* @param newName the name of the interface, may only contain
* letters [a-zA-z0-9_].
*
* @param newDescription a brief description of the interface.
*
* @param newMember a pointer to a Member which is a TypeVector. May
* be null, in which case the pointers to member functions must be
* specified.
*
* @param depSafe set to true if calls to this interface for one
* object does not influence other objects.
*
* @param 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.
*
* @param rebind if set to true, this interface is responsible
* for the rebinding of corresponding objects.
*
* @param nullable if set to true this corresponding references may
* be null.
*
* @param 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.
*
* @param newSetFn optional pointer to member function for the 'set'
* action.
*
* @param newGetFn optional pointer to member function for the
* 'get' action.
*
* @param newCheckFn optional pointer to member function for the
* 'check' action.
*/
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)
: ReferenceBase(newName, newDescription,
ClassTraits<T>::className(), typeid(T),
ClassTraits<R>::className(), typeid(R),
depSafe, readonly, !rebind, nullable, defnull),
theMember(newMember), theSetFn(newSetFn), theGetFn(newGetFn),
theCheckFn(newCheckFn) {}
/**
* Set the pointer of \a ib to \a ip.
*/
virtual void set(InterfacedBase & ib, IBPtr ip, bool chk = true) const
;
/**
* Return the pointer of \a ib.
*/
virtual IBPtr get(const InterfacedBase & ib) const
;
/**
* Check if set(ib, ip) will be successfull but do not do
* anything.
*/
virtual bool check(const InterfacedBase & ib, cIBPtr newRef) const
;
/**
* Give a pointer to a member function to be used by 'set()'.
*/
void setSetFunction(SetFn sf) { theSetFn = sf; }
/**
* Give a pointer to a member function to be used by 'get()'.
*/
void setGetFunction(GetFn gf) { theGetFn = gf; }
/**
* Give a pointer to a member function to be used by 'check()'.
*/
void setCheckFunction(CheckFn cf) { theCheckFn = cf; }
private:
/**
* The pointer to the member variable.
*/
Member theMember;
/**
* A pointer to a member function to be used by 'set()'.
*/
SetFn theSetFn;
/**
* Give a pointer to a member function to be used by 'get()'.
*/
GetFn theGetFn;
/**
* Give a pointer to a member function to be used by 'check()'.
*/
CheckFn theCheckFn;
};
}
#include "Reference.tcc"
#endif /* ThePEG_Reference_H */
|