/usr/include/ThePEG/Interface/ParVector.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 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 | // -*- C++ -*-
//
// ParVector.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_ParVector_H
#define ThePEG_ParVector_H
// This is the declaration of the ParVector, ParVectorTBase and
// ParVectorBase classes.
#include "ThePEG/Config/ThePEG.h"
#include "InterfaceBase.h"
#include "ParVector.fh"
#include <limits>
namespace ThePEG {
/// Helper functions for putUnit
namespace {
template <typename T>
/**
* Helper function for putUnit
*/
inline void putUnitImpl2(ostream & os, T v, T u, DimensionT) {
os << v/u;
}
template <typename T>
/**
* Helper function for putUnit
*/
inline void putUnitImpl2(ostream & os, T v, T u, StandardT) {
if ( u > T() )
os << v/u;
else
os << v;
}
}
/**
* The ParVector and its base classes ParVectorTBase and ParVectorBase
* defines an interface to a class derived from the InterfacedBase,
* through which vectors (or any other container) of simple member
* variables can be manuipulated. ParVector is templated on the type
* of the member variable and the type of the InterfacedBase class,
* and is derived from the InterfaceBase class via
* ParVectorTBase (which is templated only on the class
* of the member variable) and ParVectorBase.
*
* For each InterfacedBase class exactly one static ParVector 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 Parameter
* @see InterfacedBase
* @see InterfaceBase
*
*/
class ParVectorBase: public InterfaceBase {
public:
/** A vector of strings. */
typedef vector<string> StringVector;
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 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 limits determines if the values of the parameters are
* limited from above and/or below. The possible values are given by
* Interface::Limits.
*/
ParVectorBase(string newName, string newDescription,
string newClassName,
const type_info & newTypeInfo, int newSize,
bool depSafe, bool readonly, int limits)
: InterfaceBase(newName, newDescription, newClassName,
newTypeInfo, depSafe,
readonly), limit(limits), theSize(newSize) {
hasDefault = false;
}
/**
* Destructor.
*/
virtual ~ParVectorBase() {}
/**
* The general interface method overriding the one in
* InterfaceBase. For this class, \a action can be any of "set",
* "insert", "erase", "get", "min", "max", "def" and "setdef" and \a
* argument should be a something which can be read into an integer
* and into a variable through a stringstream with the standard '>>'
* operator.
*/
virtual string exec(InterfacedBase &, string action,
string arguments) const;
/**
* Return a complete description of this parameter vector.
*/
virtual string fullDescription(const InterfacedBase & ib) const;
/**
* Set the \a i'th element of a container of member variables of \a
* ib to \a val. \a val should be able to be read into the
* corresponding variable type through a stringstream with the
* standard '>>' operator.
*/
virtual void set(InterfacedBase & ib, string val, int i)
const = 0;
/**
* Insert a new object before the \a i'th element of a container of
* member variables of \a ib and set it to \a val. \a val should be
* able to be read into the corresponding variable type through a
* stringstream with the standard '>>' operator.
*/
virtual void insert(InterfacedBase & ib, string val, int i)
const = 0;
/**
* Remove the \a i'th element of a container of member variables of
* \a ib.
*/
virtual void erase(InterfacedBase & ib, int i)
const = 0;
/**
* Return the values of a container of member variables of \a ib.
*/
virtual StringVector get(const InterfacedBase & ib) const
= 0;
/**
* Return the minimum value allowed for the \a i'th element of a
* container of member variables of \a ib.
*/
virtual string minimum(const InterfacedBase & ib, int i) const
= 0;
/**
* Return the maximum value allowed for the \a i'th element of a
* container of member variables of \a ib.
*/
virtual string maximum(const InterfacedBase & ib, int i) const
= 0;
/**
* Return the default value for the \a i'th element of a container
* of member variables of \a ib.
*/
virtual string def(const InterfacedBase & ib, int i) const
= 0;
/**
* Return the general default value for this parameter vector.
*/
virtual string def() const = 0;
/**
* Set the \a i'th element of a container of member variables of \a
* ib to its default value.
*/
virtual void setDef(InterfacedBase & ib, int i) const
= 0;
/**
* True if there the variable is limited from above and below.
*/
bool limited() const { return limit != Interface::nolimits; }
/**
* True if there the variable is limited from abovew.
*/
bool upperLimit() const {
return limit == Interface::limited || limit == Interface::upperlim;
}
/**
* True if there the variable is limited from below.
*/
bool lowerLimit() const {
return limit == Interface::limited || limit == Interface::lowerlim;
}
/**
* Set a flag indicating that there are limits associated with the
* variables.
*/
void setLimited() { limit = Interface::limited; }
/**
* Set a flag indicating if there are no limits associated with the
* variables.
*/
void setUnlimited() { limit = Interface::nolimits; }
/**
* 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:
/**
* True if there are limits associated with the
* variables.
*/
int limit;
/**
* The size of the container being interfaced.
*/
int theSize;
};
/**
* The ParVector and its base classes ParVectorTBase and ParVectorBase
* defines an interface to a class derived from the InterfacedBase,
* through which vectors (or any other container) of simple member
* variables can be manuipulated. ParVector is templated on the type
* of the member variable and the type of the InterfacedBase class,
* and is derived from the InterfaceBase class via
* ParVectorTBase (which is templated only on the class
* of the member variable) and ParVectorBase.
*
* For each InterfacedBase class exactly one static ParVector 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 Parameter
* @see InterfacedBase
* @see InterfaceBase
*
*/
template <typename Type>
class ParVectorTBase: public ParVectorBase {
public:
/** A vector of objects of the template argument type. */
typedef vector<Type> TypeVector;
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 newUnit the unit assumed when a number is read or written
* to a stream.
*
* @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 limits determines if the values of the parameters are
* limited from above and/or below. The possible values are given by
* Interface::Limits.
*/
ParVectorTBase(string newName, string newDescription,
string newClassName, const type_info & newTypeInfo,
Type newUnit, int newSize, bool depSafe,
bool readonly, int limits)
: ParVectorBase(newName, newDescription, newClassName,
newTypeInfo, newSize,
depSafe, readonly, limits), theUnit(newUnit) {}
/**
* Destructor.
*/
virtual ~ParVectorTBase() {}
/**
* Return a code for the type of this parameter.
*/
virtual string type() const;
/**
* Return a string describing the type of interface to be included
* in the Doxygen documentation.
*/
virtual string doxygenType() const;
/**
* Return a complete description of this parameter vector.
*/
virtual string fullDescription(const InterfacedBase & ib) const;
/**
* Set the \a i'th element of a container of member variables of \a
* ib to val. Uses a stringstream to read the \a val into a Type
* object and then calls tset(InterfacedBase &, Type, int).
*/
virtual void set(InterfacedBase & ib, string val, int i) const
;
/**
* Set the \a i'th element of a container of member variables of \a
* ib to \a val.
*/
virtual void tset(InterfacedBase & ib, Type val, int i)
const = 0;
/**
* Insert a new object before the \a i'th element of a container of
* member variables of \a ib and set it to \a val. Uses a
* stringstream to read the \a val into a Type object and then calls
* tinsert(InterfacedBase &, Type, int).
*/
virtual void insert(InterfacedBase & ib, string val, int i) const
;
private:
/// Implementation of set() for standard types.
void setImpl(InterfacedBase & ib, string val, int i, StandardT)
const;
/// Implementation of set() for dimensioned types.
void setImpl(InterfacedBase & ib, string val, int i, DimensionT)
const;
/// Implementation of insert() for standard types.
void insertImpl(InterfacedBase & ib, string val, int i, StandardT)
const;
/// Implementation of insert() for dimensioned types.
void insertImpl(InterfacedBase & ib, string val, int i, DimensionT)
const;
public:
/**
* Insert a new object before the \a i'th element of a container of
* member variables of \a ib and set it to \a val.
*/
virtual void tinsert(InterfacedBase & ib, Type val, int i)
const = 0;
/**
* Return the values of a container of member variables of \a ib in
* a vector of strings. Calls the The tget(const InterfacedBase &)
* and returns a vector of strings converted with ostringstreams.
*/
virtual StringVector get(const InterfacedBase & ib) const
;
/**
* Return the values of a container of member variables of \a ib in a
* vector of Type.
*/
virtual TypeVector tget(const InterfacedBase & ib) const
= 0;
/**
* Return the minimum value allowed for the \a i'th element of a
* container of member variables of \a ib. Calls tminimum(const
* InterfacedBase &, int) and converts the returned value with an
* ostringstream.
*
*/
virtual string minimum(const InterfacedBase & ib, int i) const
;
/**
* Return the minimum value allowed for the \a i'th element of a
* container of member variables of \a ib.
*/
virtual Type tminimum(const InterfacedBase & ib, int i) const
= 0;
/**
* Return the maximum value allowed for the \a i'th element of a
* container of member variables of \a ib. Calls tmaximum(const
* InterfacedBase &, int) and converts the returned value with an
* ostringstream.
*/
virtual string maximum(const InterfacedBase & ib, int i) const
;
/**
* Return the maximum value allowed for the \a i'th element of a
* container of member variables of \a ib.
*/
virtual Type tmaximum(const InterfacedBase & ib, int i) const
= 0;
/**
* Return the default value for the \a i'th element of a container
* of member variables of \a ib. Calls tdef(const InterfacedBase &,
* int) and converts the returned value with an ostringstream.
*/
virtual string def(const InterfacedBase & ib, int i) const
;
/**
* Return the default value for the \a i'th element of a container of
* member variables of \a ib.
*/
virtual Type tdef(const InterfacedBase & ib, int i) const
= 0;
/**
* Return the general default value for this parameter vector. Calls
* tdef() and converts the returned value with an ostringstream.
*/
virtual string def() const;
/**
* Return the general default value for this parameter vector.
*/
virtual Type tdef() const = 0;
/**
* set the \a i'th element of a container of member variables of \a ib to
* its default value.
*/
virtual void setDef(InterfacedBase & ib, int i) const
;
/**
* Get the unit which an Type object is divided (multiplied) by when
* written to (read from) a stream via a double. If unit() is zero,
* the Type object is written/read directly.
*/
Type unit() const { return theUnit; }
/**
* Set the unit which an Type object is divided (multiplied) by when
* written to (read from) a stream via a double. If unit() is zero,
* the Type object is written/read directly.
*/
void unit(Type u) { theUnit = u; }
protected:
/**
* Write a numer to a stream with the unit specified with unit().
*/
void putUnit(ostream & os, Type val) const {
putUnitImpl2(os, val, unit(), typename TypeTraits<Type>::DimType());
}
private:
/**
* The unit which an Type object is divided (multiplied) by
* when written to (read from) a stream via a double. If unit() is
* zero, the Type object is written/read directly.
*/
Type theUnit;
};
/**
* The ParVector and its base classes ParVectorTBase and ParVectorBase
* defines an interface to a class derived from the InterfacedBase,
* through which vectors (or any other container) of simple member
* variables can be manuipulated. ParVector is templated on the type
* of the member variable and the type of the InterfacedBase class,
* and is derived from the InterfaceBase class via
* ParVectorTBase (which is templated only on the class
* of the member variable) and ParVectorBase.
*
* For each InterfacedBase class exactly one static ParVector 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 Parameter
* @see InterfacedBase
* @see InterfaceBase
*
*/
template <typename T, typename Type>
class ParVector: public ParVectorTBase<Type> {
public:
/**
* The declaration of member functions which can be used by this
* ParVector interface for 'set' actions.
*/
typedef void (T::*SetFn)(Type, int);
/**
* The declaration of member functions which can be used by this
* ParVector interface for 'insert' actions.
*/
typedef void (T::*InsFn)(Type, int);
/**
* The declaration of member functions which can be used by this
* ParVector interface for 'erase' actions.
*/
typedef void (T::*DelFn)(int);
/**
* A vector of objects of the template parameter Type.
*/
typedef vector<Type> TypeVector;
/**
* The declaration of member functions which can be used by this
* ParVector interface for 'get' actions.
*/
typedef TypeVector (T::*GetFn)() const;
/**
* A vector of strings.
*/
typedef vector<string> StringVector;
/**
* The declaration of member functions which can be used by this
* ParVector interface for 'get' actions.
*/
typedef StringVector (T::*StringGetFn)() const;
/**
* The declaration of member functions which can be used by this
* ParVector interface for 'erase' actions.
*/
typedef Type (T::*DefFn)(int) const;
/**
* Declaration of a direct pointer to the member variable in case it
* is a vector.
*/
typedef TypeVector 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 newDef the default value of the corresponding parameters.
*
* @param newMin the minimum value of the corresponding parameters.
*
* @param newMax the maximum value of the corresponding parameters.
*
* @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 limits determines if the values of the parameters are
* limited from above and below.
*
* @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 newDefFn optional pointer to member function for the
* 'default' action.
*
* @param newGetFn optional pointer to member function for the
* 'get' action.
*
* @param newMinFn optional pointer to member function for the
* 'minimum' action.
*
* @param newMaxFn optional pointer to member function for the
* 'maximum' action.
*
* @param newStringGetFn optional pointer to member function for the
* 'get' action.
*/
ParVector(string newName, string newDescription,
Member newMember, int newSize, Type newDef, Type newMin,
Type newMax, bool depSafe = false, bool readonly = false,
bool limits = true, SetFn newSetFn = 0,
InsFn newInsFn = 0, DelFn newDelFn = 0, GetFn newGetFn = 0,
DefFn newDefFn = 0, DefFn newMinFn = 0, DefFn newMaxFn = 0,
StringGetFn newStringGetFn = 0)
: ParVectorTBase<Type>(newName, newDescription, ClassTraits<T>::className(),
typeid(T), Type(), newSize, depSafe, readonly,
limits),
theMember(newMember), theDef(newDef), theMin(newMin), theMax(newMax),
theSetFn(newSetFn), theInsFn(newInsFn), theDelFn(newDelFn),
theGetFn(newGetFn), theDefFn(newDefFn), theMinFn(newMinFn),
theMaxFn(newMaxFn), theStringGetFn(newStringGetFn) {}
/**
* 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 newUnit the unit assumed when a number is read or written
* to a stream.
*
* @param newSize the size of the container or -1 if varying.
*
* @param newDef the default value of the corresponding parameters.
*
* @param newGetFn optional pointer to member function for the
* 'get' action.
*
* @param newMin the minimum value of the corresponding parameters.
*
* @param newMax the maximum value of the corresponding parameters.
*
* @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 limits determines if the values of the parameters are
* limited from above and below.
*
* @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 newDefFn optional pointer to member function for the
* 'default' action.
*
* @param newMinFn optional pointer to member function for the
* 'minimum' action.
*
* @param newMaxFn optional pointer to member function for the
* 'maximum' action.
*
* @param newStringGetFn optional pointer to member function for the
* 'get' action.
*/
ParVector(string newName, string newDescription, Member newMember,
Type newUnit, int newSize, Type newDef, Type newMin,
Type newMax, bool depSafe = false, bool readonly = false,
bool limits = true, SetFn newSetFn = 0,
InsFn newInsFn = 0, DelFn newDelFn = 0, GetFn newGetFn = 0,
DefFn newDefFn = 0, DefFn newMinFn = 0, DefFn newMaxFn = 0,
StringGetFn newStringGetFn = 0)
: ParVectorTBase<Type>(newName, newDescription, ClassTraits<T>::className(),
typeid(T), newUnit, newSize, depSafe, readonly,
limits),
theMember(newMember), theDef(newDef), theMin(newMin), theMax(newMax),
theSetFn(newSetFn), theInsFn(newInsFn), theDelFn(newDelFn),
theGetFn(newGetFn), theDefFn(newDefFn), theMinFn(newMinFn),
theMaxFn(newMaxFn), theStringGetFn(newStringGetFn) {}
/**
* 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 newDef the default value of the corresponding parameters.
*
* @param newMin the minimum value of the corresponding parameters.
*
* @param newMax the maximum value of the corresponding parameters.
*
* @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 limits determines if the values of the parameters are
* limited from above and/or below. The possible values are given by
* Interface::Limits.
*
* @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 newDefFn optional pointer to member function for the
* 'default' action.
*
* @param newGetFn optional pointer to member function for the
* 'get' action.
*
* @param newMinFn optional pointer to member function for the
* 'minimum' action.
*
* @param newMaxFn optional pointer to member function for the
* 'maximum' action.
*
* @param newStringGetFn optional pointer to member function for the
* 'get' action.
*/
ParVector(string newName, string newDescription,
Member newMember, int newSize, Type newDef, Type newMin,
Type newMax, bool depSafe = false, bool readonly = false,
int limits = Interface::limited, SetFn newSetFn = 0,
InsFn newInsFn = 0, DelFn newDelFn = 0, GetFn newGetFn = 0,
DefFn newDefFn = 0, DefFn newMinFn = 0, DefFn newMaxFn = 0,
StringGetFn newStringGetFn = 0)
: ParVectorTBase<Type>(newName, newDescription, ClassTraits<T>::className(),
typeid(T), Type(), newSize, depSafe, readonly,
limits),
theMember(newMember), theDef(newDef), theMin(newMin), theMax(newMax),
theSetFn(newSetFn), theInsFn(newInsFn), theDelFn(newDelFn),
theGetFn(newGetFn), theDefFn(newDefFn), theMinFn(newMinFn),
theMaxFn(newMaxFn), theStringGetFn(newStringGetFn) {}
/**
* 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 newUnit the unit assumed when a number is read or written
* to a stream.
*
* @param newSize the size of the container or -1 if varying.
*
* @param newDef the default value of the corresponding parameters.
*
* @param newGetFn optional pointer to member function for the
* 'get' action.
*
* @param newMin the minimum value of the corresponding parameters.
*
* @param newMax the maximum value of the corresponding parameters.
*
* @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 limits determines if the values of the parameters are
* limited from above and/or below. The possible values are given by
* Interface::Limits.
*
* @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 newDefFn optional pointer to member function for the
* 'default' action.
*
* @param newMinFn optional pointer to member function for the
* 'minimum' action.
*
* @param newMaxFn optional pointer to member function for the
* 'maximum' action.
*
* @param newStringGetFn optional pointer to member function for the
* 'get' action.
*/
ParVector(string newName, string newDescription, Member newMember,
Type newUnit, int newSize, Type newDef, Type newMin,
Type newMax, bool depSafe = false, bool readonly = false,
int limits = Interface::limited, SetFn newSetFn = 0,
InsFn newInsFn = 0, DelFn newDelFn = 0, GetFn newGetFn = 0,
DefFn newDefFn = 0, DefFn newMinFn = 0, DefFn newMaxFn = 0,
StringGetFn newStringGetFn = 0)
: ParVectorTBase<Type>(newName, newDescription, ClassTraits<T>::className(),
typeid(T), newUnit, newSize, depSafe, readonly,
limits),
theMember(newMember), theDef(newDef), theMin(newMin), theMax(newMax),
theSetFn(newSetFn), theInsFn(newInsFn), theDelFn(newDelFn),
theGetFn(newGetFn), theDefFn(newDefFn), theMinFn(newMinFn),
theMaxFn(newMaxFn), theStringGetFn(newStringGetFn) {}
/**
* Set the \a i'th element of a container of member variables of \a
* ib to \a val.
*/
virtual void tset(InterfacedBase & ib, Type val, int i) const
;
/**
* Insert a new object before the \a i'th element of a container of
* member variables of \a ib and set it to \a val.
*/
virtual void tinsert(InterfacedBase & ib, Type val, int i) const
;
/**
* Remove the \a i'th element of a container of
* member variables of \a ib.
*/
virtual void erase(InterfacedBase & ib, int i)
const;
/**
* Return the values of a container of member variables of \a ib in
* a vector of strings. Calls the The tget(const InterfacedBase &)
* and returns a vector of strings converted with ostringstreams.
*/
virtual StringVector get(const InterfacedBase & ib) const
;
/**
* Return the values of a container of member variables of \a ib in a
* vector of Type.
*/
virtual TypeVector tget(const InterfacedBase & ib) const
;
/**
* Return the minimum value allowed for the \a i'th element of a
* container of member variables of \a ib.
*/
virtual Type tminimum(const InterfacedBase & ib, int i) const
;
/**
* Return the maximum value allowed for the \a i'th element of a
* container of member variables of \a ib.
*/
virtual Type tmaximum(const InterfacedBase & ib, int i) const
;
/**
* Return the default value for the \a i'th element of a container of
* member variables of \a ib.
*/
virtual Type tdef(const InterfacedBase &, int) const
;
/**
* Return the general default value for this parameter vector.
*/
virtual Type tdef() const;
/**
* Give a pointer to a member function to be used by tset().
*/
void setSetFunction(SetFn sf) { theSetFn = sf; }
/**
* Give a pointer to a member function to be used by tinsert().
*/
void setInsertFunction(InsFn ifn) { theInsFn = ifn; }
/**
* Give a pointer to a member function to be used by tget().
*/
void setGetFunction(GetFn gf) { theGetFn = gf; }
/**
* Give a pointer to a member function to be used by terase().
*/
void setEraseFunction(DelFn df) { theDelFn = df; }
/**
* Give a pointer to a member function to be used by tdef().
*/
void setDefaultFunction(GetFn df) { theDefFn = df; }
/**
* Give a pointer to a member function to be used by tminimum().
*/
void setMinFunction(GetFn mf) { theMinFn = mf; }
/**
* Give a pointer to a member function to be used by tmaximum().
*/
void setMaxFunction(GetFn mf) { theMaxFn = mf; }
/**
* Give a pointer to a member function to be used by get().
*/
void setStringGetFunction(StringGetFn gf) { theStringGetFn = gf; }
/**
* Print a description to be included in the Doxygen documentation
* to the given \a stream.
*/
virtual void doxygenDescription(ostream & stream) const;
private:
/**
* The pointer to the member variable.
*/
Member theMember;
/**
* Default value to be used if no corresponding member function
* pointer is given.
*/
Type theDef;
/**
* Minimum value to be used if no corresponding member function
* pointer is given.
*/
Type theMin;
/**
* Maximum value to be used if no
* corresponding member function pointer is given.
*/
Type theMax;
/**
* A pointer to a member function to be used by tset().
*/
SetFn theSetFn;
/**
* A pointer to a member function to be used by tinsert().
*/
InsFn theInsFn;
/**
* A pointer to a member function to be used by terase().
*/
DelFn theDelFn;
/**
* A pointer to a member function to be used by tget().
*/
GetFn theGetFn;
/**
* Pointer to member function to be used by tdef().
*/
DefFn theDefFn;
/**
* Pointer to member function to be used by tminimum().
*/
DefFn theMinFn;
/**
* Pointer to member function to be used by tmaximum().
*/
DefFn theMaxFn;
/**
* A pointer to a member function to be used by set().
*/
StringGetFn theStringGetFn;
};
}
#ifndef ThePEG_TEMPLATES_IN_CC_FILE
#include "ParVector.tcc"
#endif
#endif /* ThePEG_ParVector_H */
|