/usr/include/ThePEG/Interface/RefVector.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 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 | // -*- C++ -*-
//
// RefVector.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_RefVector_H
#define ThePEG_RefVector_H
// This is the declaration of the RefVector and RefVectorBase classes.
#include "ThePEG/Config/ThePEG.h"
#include "InterfaceBase.h"
#include "RefVector.xh"
#include "RefVector.fh"
namespace ThePEG {
/**
* The RefVector and its base class RefVectorBase defines an interface
* to a class derived from the InterfacedBase, through which vectors
* (or any other container) of pointers to other InterfacedBase
* objects may be manipulated. RefVector is templated on the type of
* the class and the class of the objects pointed to, and is derived
* from the InterfaceBase class via RefVectorBase and
* RefInterfaceBase.
*
* For each InterfacedBase class exactly one static RefVector object
* should created for each member variable of container type which
* should be interfaced. This object will automatically register
* itself with the BaseRepository class.
*
* @see InterfacedBase
* @see InterfaceBase
*
*/
class RefVectorBase: 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 newSize the size of the container or -1 if varying.
*
* @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.
*/
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);
/**
* The general interface method overriding the one in
* InterfaceBase. For this class, \a action can be any of "set",
* "get", "erase" and "insert" and \a argument should be a something
* which can be read into an integer while the rest of \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 vector.
*/
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 \a i'th element of a container of pointers of \a ib
* to \a ip.
*/
virtual void set(InterfacedBase & ib, IBPtr ip, int i, bool chk = true)
const = 0;
/**
* Insert a new pointer before the \a i'th element of a container of
* pointers of \a ib and set it to \a ip.
*/
virtual void insert(InterfacedBase & ib, IBPtr ip, int i, bool chk = true)
const = 0;
/**
* Remove the \a i'th element of a container of pointers of \a ib.
*/
virtual void erase(InterfacedBase & ib, int i)
const = 0;
/**
* Return a vector of pointers corresponding to the container of
* pointers of \a ib.
*/
virtual IVector get(const InterfacedBase & ib) const
= 0;
/**
* Check if set(ib, ip, i) will be successfull but do not do
* anything.
*/
virtual bool check(const InterfacedBase & ib, cIBPtr ip, int i) const
= 0;
/**
* In the object \a ib, replace all pointers to objects in this
* interface with the translated ones provided by \a trans. If a
* pointer is null, and defaultIfNull() is true, replace it with
* the first alowed object found in \a defs.
*/
virtual void rebind(InterfacedBase & ib, const TranslationMap & trans,
const IVector & defs) const;
/**
* Return pointers to other objects in \a ib.
*/
virtual IVector getReferences(const InterfacedBase & ib) const;
/**
* Get the size of the container being interfaced. If the size() is
* less than 0, the size is allowed to vary.
*/
int size() const { return theSize; }
/**
* Set the size of the container being interfaced. If the size is
* less than 0, the size is allowed to vary.
*/
void setSize(int sz) { theSize = sz; }
/**
* Set the size of the container being interfaced to -1, i.e. the
* size is allowed to vary.
*/
void setVariableSize() { theSize = 0; }
private:
/**
* The size of the container being interfaced.
*/
int theSize;
};
/**
* The RefVector and its base class RefVectorBase defines an interface
* to a class derived from the InterfacedBase, through which vectors
* (or any other container) of pointers to other InterfacedBase
* objects may be manipulated. RefVector is templated on the type of
* the class and the class of the objects pointed to, and is derived
* from the InterfaceBase class via RefVectorBase and
* RefInterfaceBase.
*
* For each InterfacedBase class exactly one static RefVector object
* should created for each member variable of container type which
* should be interfaced. This object will automatically register
* itself with the BaseRepository class.
*
* @see InterfacedBase
* @see InterfaceBase
*
*/
template <class T, class R>
class RefVector: public RefVectorBase {
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, int);
/** A pointer to a menberfunction to be used for the 'insert' action. */
typedef void (T::*InsFn)(RefPtr, int);
/** A pointer to a menberfunction to be used for the 'erase' action. */
typedef void (T::*DelFn)(int);
/** A pointer to a menberfunction to be used for the 'check' action. */
typedef bool (T::*CheckFn)(cRefPtr, int) const;
/** A pointer to a menberfunction to be used for the 'get' action. */
typedef vector<RefPtr> (T::*GetFn)() const;
/**
* Declaration of a direct pointer to the member variable in case it
* is a vector.
*/
typedef vector<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 newSize the size of the container or -1 if varying.
*
* @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 newInsFn optional pointer to member function for the
* 'insert' action.
*
* @param newDelFn optional pointer to member function for the
* 'erase' action.
*
* @param newGetFn optional pointer to member function for the
* 'get' action.
*
* @param newCheckFn optional pointer to member function for the
* 'check' action.
*/
RefVector(string newName, string newDescription,
Member newMember, int newSize, bool depSafe = false,
bool readonly = false, bool rebind = true, bool nullable = true,
SetFn newSetFn = 0, InsFn newInsFn = 0, DelFn newDelFn = 0,
GetFn newGetFn = 0, CheckFn newCheckFn = 0);
/**
* 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 newSize the size of the container or -1 if varying.
*
* @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 newInsFn optional pointer to member function for the
* 'insert' action.
*
* @param newDelFn optional pointer to member function for the
* 'erase' action.
*
* @param newGetFn optional pointer to member function for the
* 'get' action.
*
* @param newCheckFn optional pointer to member function for the
* 'check' action.
*/
RefVector(string newName, string newDescription,
Member newMember, int newSize, bool depSafe,
bool readonly, bool rebind, bool nullable, bool defnull,
SetFn newSetFn = 0, InsFn newInsFn = 0, DelFn newDelFn = 0,
GetFn newGetFn = 0, CheckFn newCheckFn = 0);
/**
* Set the \a i'th element of a container of pointers of \a ib
* to \a ip.
*/
virtual void set(InterfacedBase & ib, IBPtr ip, int i, bool chk = true)
const;
/**
* Insert a new pointer before the \a i'th element of a container of
* pointers of \a ib and set it to \a ip.
*/
virtual void insert(InterfacedBase & ib, IBPtr ip, int i, bool chk = true)
const;
/**
* Remove the \a i'th element of a container of pointers of \a ib.
*/
virtual void erase(InterfacedBase & ib, int i)
const;
/**
* Return a vector of pointers corresponding to the container of
* pointers of \a ib.
*/
virtual IVector get(const InterfacedBase & ib) const
;
/**
* Check if set(ib, ip, i) will be successfull but do not do
* anything.
*/
virtual bool check(const InterfacedBase & ib, cIBPtr, int i) 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 'insert()'.
*/
void setInsertFunction(InsFn ifn) { theInsFn = ifn; }
/**
* 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 'erase()'.
*/
void setEraseFunction(DelFn df) { theDelFn = df; }
/**
* 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 'insert()'.
*/
InsFn theInsFn;
/**
* Give a pointer to a member function to be used by 'erase()'.
*/
DelFn theDelFn;
/**
* 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 "RefVector.tcc"
#endif /* ThePEG_RefVector_H */
|