KaliVeda  1.12/06
Heavy-Ion Analysis Toolkit
List of all members | Classes | Public Member Functions | Protected Attributes | List of all members
KVNameValueList Class Reference

Handles lists of named parameters with different types, a list of KVNamedParameter objects.

Create a list from a string

You can create and initialise a list of parameters with the constructor:

KVNameValueList k("A=10,B=stripes,C=6.751");
k.Print();
KVNameValueList:: : (0x5602712ae5b0)
<A=10>
<B=stripes>
<C=6.751>
Handles lists of named parameters with different types, a list of KVNamedParameter objects.
KVNameValueList()
Default constructor.

Adding and modifying parameters

Parameters are dynamically added or modified by calling SetValue():

KVNameValueList l("MyList", "A list of things");
l.SetValue("a", 6);
l.SetValue("b", 3.14);
l.SetValue("c", "sqrt");
l.SetValue("a", false); <= change value & type of existing parameter
l.Print();
KVNameValueList::MyList : A list of things (0x7f405e51e010)
<a=false>
<b=3.14>
#define b(i)
#define c(i)
int type
VecExpr< UnaryOp< Sqrt< T >, SVector< T, D >, T >, T, D > sqrt(const SVector< T, D > &rhs)
auto * l
auto * a

Retrieving parameters

Before trying to retrieve a parameter from the list, it is advisable to test if a parameter with the correct name and type exists in the list:

l.HasDoubleParameter("a"); => false
l.HasParameter<double>("b"); => true
l.HasBoolParameter("a"); => true

Values can then be retrieved with the following methods:

l.GetValue<bool>("a"); => false
l.GetDoubleValue("b"); => 3.1400
l.GetValue<std::string>("c"); => (std::string) "sqrt"

Some conversions between different types will work implicitly, however be aware that any attempt to convert a non-numeric string parameter into a numerical value will result in zero:

l.GetTStringValue("a"); => (TString) "false"
l.GetValue<int>("b"); => 3
l.GetValue<double>("c"); => 0.0000

Another method allows to test whether a parameter with a given name exists and has a specific value (including of the right type):

l.IsValue("a",false); => (bool) true
l.IsValue("b",3); => (bool) false
l.IsValue("b",3.14); => (bool) true

64-bit parameters

In addition to the four types handled by KVNamedParameter, KVNameValueList adds the possibility to store (unsigned) 64-bit integers using SetValue64bit():

l.SetValue64bit("A64", 1234567890987654321);
l.Print();
KVNameValueList::MyList : A list of things (0x7f405e51e010)
<a=false>
<b=3.14>
<A64_hi=287445236>
<A64_lo=-1318314831>

The 64-bit value is stored as 2 32-bit integers with suffixes "hi" and "lo". Dedicated methods must be used to test for the presence or retrieve the value of a 64-bit parameter:

l.HasValue64bit("A64"); => (bool) true
l.GetValue64bit("A64"); => (unsigned long long) 1234567890987654321
long
Examples
KVClassFactory_examples.C.

Definition at line 115 of file KVNameValueList.h.

Classes

class  Iterator
 

Public Member Functions

 KVNameValueList ()
 Default constructor. More...
 
 KVNameValueList (const Char_t *name, const Char_t *title="")
 
 KVNameValueList (const KVNameValueList &)
 Copy constructor. More...
 
 KVNameValueList (std::initializer_list< KVNamedParameter >)
 
virtual ~KVNameValueList ()
 Destructor. More...
 
void AddValue (const KVNamedParameter &p)
 
Iterator begin () const
 
virtual void Clear (Option_t *opt="")
 
virtual void ClearSelection (TRegexp &)
 
Int_t Compare (const TObject *nvl) const
 
void Copy (TObject &nvl) const
 
Iterator end () const
 
KVNamedParameterFindParameter (const Char_t *name) const
 return the parameter object with the asking name More...
 
Bool_t GetBoolValue (const Char_t *name) const
 
Bool_t GetBoolValue (Int_t idx) const
 
Double_t GetDoubleValue (const Char_t *name) const
 
Double_t GetDoubleValue (Int_t idx) const
 
Int_t GetEntries () const
 
Int_t GetIntValue (const Char_t *name) const
 
Int_t GetIntValue (Int_t idx) const
 
KVHashListGetList () const
 
const Char_tGetNameAt (Int_t idx) const
 
Int_t GetNameIndex (const Char_t *name) const
 
Int_t GetNpar () const
 return the number of stored parameters More...
 
KVNamedParameterGetParameter (Int_t idx) const
 return the parameter object with index idx More...
 
const Char_tGetStringValue (const Char_t *name) const
 
const Char_tGetStringValue (Int_t idx) const
 
TString GetTStringValue (const Char_t *name) const
 
TString GetTStringValue (Int_t idx) const
 
template<typename value_type >
value_type GetValue (const Char_t *name) const
 
template<typename value_type >
value_type GetValue (Int_t idx) const
 
ULong64_t GetValue64bit (const Char_t *name) const
 
Bool_t HasBoolParameter (const Char_t *name) const
 
Bool_t HasDoubleParameter (const Char_t *name) const
 
Bool_t HasIntParameter (const Char_t *name) const
 
Bool_t HasNumericParameter (const Char_t *name) const
 
Bool_t HasParameter (const Char_t *name) const
 
template<typename value_type >
Bool_t HasParameter (const Char_t *name) const
 
Bool_t HasStringParameter (const Char_t *name) const
 
Bool_t HasValue64bit (const Char_t *name) const
 
template<typename value_type >
void IncrementValue (const Char_t *name, value_type value)
 
Bool_t IsEmpty () const
 
Bool_t IsOwner () const
 
template<typename value_type >
Bool_t IsValue (const Char_t *name, value_type value) const
 
virtual void ls (Option_t *opt="") const
 
void Merge (const KVNameValueList &)
 
KVNameValueList operator+= (const KVNameValueList &nvl)
 
KVNameValueListoperator= (const KVNameValueList &)
 
virtual void Print (Option_t *opt="") const
 
virtual KVEnvProduceEnvFile ()
 
virtual void ReadEnvFile (const Char_t *filename)
 
void RemoveParameter (const Char_t *name)
 
bool Set (const KVString &)
 
template<typename value_type >
void SetFirstValue (const Char_t *name, value_type value)
 
void SetFromEnv (TEnv *tenv, const TString &prefix="")
 
void SetIgnoreBool (Bool_t ignore=kTRUE)
 
template<typename value_type >
void SetLastValue (const Char_t *name, value_type value)
 
void SetOwner (Bool_t enable=kTRUE)
 
template<typename value_type >
void SetValue (const Char_t *name, value_type value)
 
void SetValue (const KVNamedParameter &)
 add (or replace) a parameter with the same name, type & value as 'p' More...
 
void SetValue64bit (const Char_t *name, ULong64_t)
 
template<typename value_type >
void SetValueAt (const Char_t *name, value_type value, Int_t idx)
 
void Sort (Bool_t order=kSortAscending)
 
void WriteClass (const Char_t *classname, const Char_t *classdesc, const Char_t *base_class="")
 
virtual void WriteEnvFile (const Char_t *filename)
 Write all name-value pairs in this list as a TEnv format file. More...
 
void WriteToEnv (TEnv *tenv, const TString &prefix="")
 
- Public Member Functions inherited from TNamed
 TNamed ()
 
 TNamed (const char *name, const char *title)
 
 TNamed (const TNamed &named)
 
 TNamed (const TString &name, const TString &title)
 
virtual ~TNamed ()
 
virtual TObjectClone (const char *newname="") const
 
virtual void FillBuffer (char *&buffer)
 
virtual const char * GetName () const
 
virtual const char * GetTitle () const
 
virtual ULong_t Hash () const
 
virtual Bool_t IsSortable () const
 
TNamedoperator= (const TNamed &rhs)
 
virtual void SetName (const char *name)
 
virtual void SetNameTitle (const char *name, const char *title)
 
virtual void SetTitle (const char *title="")
 
virtual Int_t Sizeof () const
 
- Public Member Functions inherited from TObject
 TObject ()
 
 TObject (const TObject &object)
 
virtual ~TObject ()
 
void AbstractMethod (const char *method) const
 
virtual void AppendPad (Option_t *option="")
 
virtual void Browse (TBrowser *b)
 
ULong_t CheckedHash ()
 
virtual const char * ClassName () const
 
virtual void Delete (Option_t *option="")
 
virtual Int_t DistancetoPrimitive (Int_t px, Int_t py)
 
virtual void Draw (Option_t *option="")
 
virtual void DrawClass () const
 
virtual TObjectDrawClone (Option_t *option="") const
 
virtual void Dump () const
 
virtual void Error (const char *method, const char *msgfmt,...) const
 
virtual void Execute (const char *method, const char *params, Int_t *error=0)
 
virtual void Execute (TMethod *method, TObjArray *params, Int_t *error=0)
 
virtual void ExecuteEvent (Int_t event, Int_t px, Int_t py)
 
virtual void Fatal (const char *method, const char *msgfmt,...) const
 
virtual TObjectFindObject (const char *name) const
 
virtual TObjectFindObject (const TObject *obj) const
 
virtual Option_tGetDrawOption () const
 
virtual const char * GetIconName () const
 
virtual char * GetObjectInfo (Int_t px, Int_t py) const
 
virtual Option_tGetOption () const
 
virtual UInt_t GetUniqueID () const
 
virtual Bool_t HandleTimer (TTimer *timer)
 
Bool_t HasInconsistentHash () const
 
virtual void Info (const char *method, const char *msgfmt,...) const
 
virtual Bool_t InheritsFrom (const char *classname) const
 
virtual Bool_t InheritsFrom (const TClass *cl) const
 
virtual void Inspect () const
 
void InvertBit (UInt_t f)
 
virtual Bool_t IsEqual (const TObject *obj) const
 
virtual Bool_t IsFolder () const
 
R__ALWAYS_INLINE Bool_t IsOnHeap () const
 
R__ALWAYS_INLINE Bool_t IsZombie () const
 
void MayNotUse (const char *method) const
 
virtual Bool_t Notify ()
 
void Obsolete (const char *method, const char *asOfVers, const char *removedFromVers) const
 
void operator delete (void *ptr)
 
void operator delete[] (void *ptr)
 
voidoperator new (size_t sz)
 
voidoperator new (size_t sz, void *vp)
 
voidoperator new[] (size_t sz)
 
voidoperator new[] (size_t sz, void *vp)
 
TObjectoperator= (const TObject &rhs)
 
virtual void Paint (Option_t *option="")
 
virtual void Pop ()
 
virtual Int_t Read (const char *name)
 
virtual void RecursiveRemove (TObject *obj)
 
void ResetBit (UInt_t f)
 
virtual void SaveAs (const char *filename="", Option_t *option="") const
 
virtual void SavePrimitive (std::ostream &out, Option_t *option="")
 
void SetBit (UInt_t f)
 
void SetBit (UInt_t f, Bool_t set)
 
virtual void SetDrawOption (Option_t *option="")
 
virtual void SetUniqueID (UInt_t uid)
 
virtual void SysError (const char *method, const char *msgfmt,...) const
 
R__ALWAYS_INLINE Bool_t TestBit (UInt_t f) const
 
Int_t TestBits (UInt_t f) const
 
virtual void UseCurrentStyle ()
 
virtual void Warning (const char *method, const char *msgfmt,...) const
 
virtual Int_t Write (const char *name=0, Int_t option=0, Int_t bufsize=0)
 
virtual Int_t Write (const char *name=0, Int_t option=0, Int_t bufsize=0) const
 

Protected Attributes

Bool_t fIgnoreBool
 do not convert "yes", "false", "on", etc. in TEnv file to boolean More...
 
KVHashList fList
 list of KVNamedParameter objects More...
 
- Protected Attributes inherited from TNamed
TString fName
 
TString fTitle
 
- Protected Attributes inherited from TObject
 kOnlyPrepStep
 

Additional Inherited Members

- Public Types inherited from TObject
enum  EDeprecatedStatusBits
 
enum  EStatusBits
 
- Static Public Member Functions inherited from TObject
static Longptr_t GetDtorOnly ()
 
static Bool_t GetObjectStat ()
 
static void SetDtorOnly (void *obj)
 
static void SetObjectStat (Bool_t stat)
 
- Public Attributes inherited from TObject
 kBitMask
 
 kCanDelete
 
 kCannotPick
 
 kHasUUID
 
 kInconsistent
 
 kInvalidObject
 
 kIsOnHeap
 
 kIsReferenced
 
 kMustCleanup
 
 kNoContextMenu
 
 kNotDeleted
 
 kObjInCanvas
 
 kOverwrite
 
 kSingleKey
 
 kWriteDelete
 
 kZombie
 
- Protected Member Functions inherited from TObject
virtual void DoError (int level, const char *location, const char *fmt, va_list va) const
 
void MakeZombie ()
 

#include <KVNameValueList.h>

Inheritance diagram for KVNameValueList:
Inheritance graph
[legend]

Constructor & Destructor Documentation

◆ KVNameValueList() [1/4]

KVNameValueList::KVNameValueList ( )

Default constructor.

Definition at line 19 of file KVNameValueList.cpp.

◆ KVNameValueList() [2/4]

KVNameValueList::KVNameValueList ( std::initializer_list< KVNamedParameter l)

Constructor using an initializer list for a given set of KVNamedParameter objects, i.e. this contructor makes it possible to do:

KVNameValueList list{{"A",1.234},{"B",false},{"C","hello"}};
KVNameValueList list2 = {{"A",1.234},{"B",false},{"C","hello"}};

Definition at line 38 of file KVNameValueList.cpp.

◆ KVNameValueList() [3/4]

KVNameValueList::KVNameValueList ( const Char_t name,
const Char_t title = "" 
)

Ctor with name & title

if name contains a comma-separated list of parameter/value pairs, it will be used to initialise the list (no name set)

Definition at line 60 of file KVNameValueList.cpp.

◆ KVNameValueList() [4/4]

KVNameValueList::KVNameValueList ( const KVNameValueList NVL)

Copy constructor.

Definition at line 77 of file KVNameValueList.cpp.

◆ ~KVNameValueList()

KVNameValueList::~KVNameValueList ( )
virtual

Destructor.

Definition at line 89 of file KVNameValueList.cpp.

Member Function Documentation

◆ AddValue()

void KVNameValueList::AddValue ( const KVNamedParameter p)

if a parameter with the same name & type as 'p' exists, add numerical value of p to value of parameter in list, or for strings we add to a comma-separated list of strings. otherwise, add a copy of p to list

Definition at line 413 of file KVNameValueList.cpp.

◆ begin()

Iterator KVNameValueList::begin ( ) const
inline

return iterator to beginning of list

Definition at line 206 of file KVNameValueList.h.

◆ Clear()

void KVNameValueList::Clear ( Option_t opt = "")
virtual

Clear all the stored parameters Deletes the parameter objects if owner & opt!="nodelete"

Reimplemented from TNamed.

Reimplemented in KVValues.

Definition at line 191 of file KVNameValueList.cpp.

◆ ClearSelection()

void KVNameValueList::ClearSelection ( TRegexp sel)
virtual

Remove from list all parameters whose name matches the regular expression Examples: remove all parameters starting with "toto": TRegexp sel("^toto") remove all parameters with "toto" in name: TRegexp sel("toto")

Definition at line 206 of file KVNameValueList.cpp.

◆ Compare()

Int_t KVNameValueList::Compare ( const TObject obj) const
virtual

Compare the contents of two KVNameValueList Returns the number of same parameters (name and value)

Reimplemented from TNamed.

Definition at line 313 of file KVNameValueList.cpp.

◆ Copy()

void KVNameValueList::Copy ( TObject nvl) const
virtual

Copy this to the nvl object. Any existing parameters will be destroyed

Reimplemented from TNamed.

Definition at line 174 of file KVNameValueList.cpp.

◆ end()

Iterator KVNameValueList::end ( ) const
inline

return iterator to end of list (a nullptr)

Definition at line 211 of file KVNameValueList.h.

◆ FindParameter()

KVNamedParameter * KVNameValueList::FindParameter ( const Char_t name) const

return the parameter object with the asking name

Definition at line 429 of file KVNameValueList.cpp.

◆ GetBoolValue() [1/2]

Bool_t KVNameValueList::GetBoolValue ( const Char_t name) const
inline

Definition at line 401 of file KVNameValueList.h.

◆ GetBoolValue() [2/2]

Bool_t KVNameValueList::GetBoolValue ( Int_t  idx) const
inline

Definition at line 429 of file KVNameValueList.h.

◆ GetDoubleValue() [1/2]

Double_t KVNameValueList::GetDoubleValue ( const Char_t name) const
inline

Definition at line 405 of file KVNameValueList.h.

◆ GetDoubleValue() [2/2]

Double_t KVNameValueList::GetDoubleValue ( Int_t  idx) const
inline

Definition at line 433 of file KVNameValueList.h.

◆ GetEntries()

Int_t KVNameValueList::GetEntries ( ) const
inline

Definition at line 377 of file KVNameValueList.h.

◆ GetIntValue() [1/2]

Int_t KVNameValueList::GetIntValue ( const Char_t name) const
inline

Definition at line 397 of file KVNameValueList.h.

◆ GetIntValue() [2/2]

Int_t KVNameValueList::GetIntValue ( Int_t  idx) const
inline

Definition at line 425 of file KVNameValueList.h.

◆ GetList()

KVHashList * KVNameValueList::GetList ( ) const

return the pointeur of the KVHashList where parameters are stored with their values

Definition at line 161 of file KVNameValueList.cpp.

◆ GetNameAt()

const Char_t * KVNameValueList::GetNameAt ( Int_t  idx) const

return the name of the parameter store at the idx position in the list if the idx is greater than the number of stored parameters return empty string

Definition at line 513 of file KVNameValueList.cpp.

◆ GetNameIndex()

Int_t KVNameValueList::GetNameIndex ( const Char_t name) const

return the position in the list of a given parameter using its name return -1 if no parameter with such name are present

Definition at line 488 of file KVNameValueList.cpp.

◆ GetNpar()

Int_t KVNameValueList::GetNpar ( void  ) const

return the number of stored parameters

Definition at line 553 of file KVNameValueList.cpp.

◆ GetParameter()

KVNamedParameter * KVNameValueList::GetParameter ( Int_t  idx) const

return the parameter object with index idx

Definition at line 440 of file KVNameValueList.cpp.

◆ GetStringValue() [1/2]

const Char_t* KVNameValueList::GetStringValue ( const Char_t name) const
inline

Definition at line 409 of file KVNameValueList.h.

◆ GetStringValue() [2/2]

const Char_t* KVNameValueList::GetStringValue ( Int_t  idx) const
inline

Definition at line 437 of file KVNameValueList.h.

◆ GetTStringValue() [1/2]

TString KVNameValueList::GetTStringValue ( const Char_t name) const

return the value in TString format for a parameter using its name return string "-1" if no parameter with such name are present

Definition at line 534 of file KVNameValueList.cpp.

◆ GetTStringValue() [2/2]

TString KVNameValueList::GetTStringValue ( Int_t  idx) const

return the value in string format for a parameter using its position return -1 idx is greater than the number of stored parameters

Definition at line 566 of file KVNameValueList.cpp.

◆ GetValue() [1/2]

template<typename value_type >
value_type KVNameValueList::GetValue ( const Char_t name) const
inline

return the value of named parameter returns a default value (-1, false or "-1") if no parameter with such a name is present

Definition at line 387 of file KVNameValueList.h.

◆ GetValue() [2/2]

template<typename value_type >
value_type KVNameValueList::GetValue ( Int_t  idx) const
inline

return the value of parameter at position idx returns a default value (-1, false or "-1") if idx is greater than the number of stored parameters

Definition at line 416 of file KVNameValueList.h.

◆ GetValue64bit()

ULong64_t KVNameValueList::GetValue64bit ( const Char_t name) const

Return a 64-bit integer stored as two 32-bit parameters with names 'name_up' and 'name_lo'

Definition at line 371 of file KVNameValueList.cpp.

◆ HasBoolParameter()

Bool_t KVNameValueList::HasBoolParameter ( const Char_t name) const
inline

Definition at line 346 of file KVNameValueList.h.

◆ HasDoubleParameter()

Bool_t KVNameValueList::HasDoubleParameter ( const Char_t name) const
inline

Returns kTRUE if the list contains a parameter with given name and type Double.

WARNING: only returns kTRUE if paramete is STRICTLY of type Double, will return false for Int parameter.

See also
HasNumericParameter()

Definition at line 350 of file KVNameValueList.h.

◆ HasIntParameter()

Bool_t KVNameValueList::HasIntParameter ( const Char_t name) const
inline

Returns kTRUE if the list contains a parameter with given name and type Int.

WARNING: only returns kTRUE if paramete is STRICTLY of type Int, will return false for Double parameter.

See also
HasNumericParameter()

Definition at line 336 of file KVNameValueList.h.

◆ HasNumericParameter()

Bool_t KVNameValueList::HasNumericParameter ( const Char_t name) const
inline

Returns kTRUE if the list contains a parameter with given name and it is of numeric type, i.e. either Int or Double. Even if the parameter is actually of String type, if the string it contains corresponds to a numeric value, this method returns kTRUE.

This is to avoid ambiguity with HasDoubleParameter() and HasIntParameter() which only return kTRUE if the parameter is strictly of the given type.

Definition at line 364 of file KVNameValueList.h.

◆ HasParameter() [1/2]

Bool_t KVNameValueList::HasParameter ( const Char_t name) const

Check if there is a parameter with the asked name in the list kTRUE, parameter already present kFALSE, if not

Definition at line 472 of file KVNameValueList.cpp.

◆ HasParameter() [2/2]

template<typename value_type >
Bool_t KVNameValueList::HasParameter ( const Char_t name) const
inline

Return kTRUE if list has parameter called 'name' and it is of given type

Definition at line 329 of file KVNameValueList.h.

◆ HasStringParameter()

Bool_t KVNameValueList::HasStringParameter ( const Char_t name) const
inline

Definition at line 360 of file KVNameValueList.h.

◆ HasValue64bit()

Bool_t KVNameValueList::HasValue64bit ( const Char_t name) const

Returns kTRUE if 'name' is stored as a 64-bit value i.e. if integer parameters 'name_lo' and 'name_hi' are defined

Definition at line 393 of file KVNameValueList.cpp.

◆ IncrementValue()

template<typename value_type >
void KVNameValueList::IncrementValue ( const Char_t name,
value_type  value 
)
inline

increment a parameter (define by its name) by a value if the parameter is not in the list, it is added if it's in the list increment its value

Definition at line 303 of file KVNameValueList.h.

◆ IsEmpty()

Bool_t KVNameValueList::IsEmpty ( ) const
inline

Definition at line 381 of file KVNameValueList.h.

◆ IsOwner()

Bool_t KVNameValueList::IsOwner ( ) const

return kTRUE if the list owns its objects kFALSE if not

Definition at line 300 of file KVNameValueList.cpp.

◆ IsValue()

template<typename value_type >
Bool_t KVNameValueList::IsValue ( const Char_t name,
value_type  value 
) const
inline

Returns kTRUE if parameter with given name exists and is equal to given value

Definition at line 313 of file KVNameValueList.h.

◆ ls()

void KVNameValueList::ls ( Option_t opt = "") const
virtual

Reimplemented from TNamed.

Definition at line 255 of file KVNameValueList.cpp.

◆ Merge()

void KVNameValueList::Merge ( const KVNameValueList other)

Merge other list into this one. Any parameters in 'other' which do not exist in this one are added. Any parameters which exist in both have their values summed.

Definition at line 749 of file KVNameValueList.cpp.

◆ operator+=()

KVNameValueList KVNameValueList::operator+= ( const KVNameValueList nvl)

Definition at line 683 of file KVNameValueList.cpp.

◆ operator=()

KVNameValueList & KVNameValueList::operator= ( const KVNameValueList o)

Definition at line 99 of file KVNameValueList.cpp.

◆ Print()

void KVNameValueList::Print ( Option_t option = "") const
virtual

Print stored parameters (name, and value) Option can be used to select type of parameters to print: option = "int", "double", or "string"

Reimplemented from TNamed.

Reimplemented in KVValues.

Definition at line 234 of file KVNameValueList.cpp.

◆ ProduceEnvFile()

KVEnv * KVNameValueList::ProduceEnvFile ( )
virtual

Put all name-value pairs in this list as a TEnv format. delete after use

Definition at line 653 of file KVNameValueList.cpp.

◆ ReadEnvFile()

void KVNameValueList::ReadEnvFile ( const Char_t filename)
virtual

Read all name-value pairs in the TEnv format file and store in list. Clears any previously stored values.

values are read as strings from the TEnv and we use TString::IsDigit, TString::IsFloat to decide whether to store them as integers, floats, or strings. booleans are recognized as: TRUE, FALSE, ON, OFF, YES, NO, OK, NOT (to disable this feature and read such values as strings, call SetIgnoreBool(kTRUE))

Special case: if the parameter name contains the string NumberList then we store the value string as is, as in this case it is assumed to be the string representation of a KVNumberList (easily confused with floating point numbers)

Definition at line 598 of file KVNameValueList.cpp.

◆ RemoveParameter()

void KVNameValueList::RemoveParameter ( const Char_t name)

remove parameter from the list, Warning the TNamed object associated is deleted

Definition at line 452 of file KVNameValueList.cpp.

◆ Set()

bool KVNameValueList::Set ( const KVString list)

If list contains a comma-separated list of parameter/value pairs

list = "param1=val1,param2=val2,..."

then use it to initialise the parameters of the list, and return true (any existing parameters will be removed).

If list does not contain at least one '=' character, do nothing and return false.

Definition at line 118 of file KVNameValueList.cpp.

◆ SetFirstValue()

template<typename value_type >
void KVNameValueList::SetFirstValue ( const Char_t name,
value_type  value 
)
inline

associate a parameter (define by its name) and a value if the parameter is not in the list, it is inserted at the begining of the list. if it's in the list replace its value and move it at the begining of the list.

Definition at line 265 of file KVNameValueList.h.

◆ SetFromEnv()

void KVNameValueList::SetFromEnv ( TEnv tenv,
const TString prefix = "" 
)

Update the values of any parameters in the KVNameValueList which are found in the TEnv, optionally using the given prefix. Example: if KVNameValueList contains a parameter "Legs" and if prefix="Large", then if the TEnv contains a value "Large.Legs", it will be used to update "Legs"

Definition at line 717 of file KVNameValueList.cpp.

◆ SetIgnoreBool()

void KVNameValueList::SetIgnoreBool ( Bool_t  ignore = kTRUE)
inline

When reading a list from a file using ReadEnvFile(), any string values matching TRUE, FALSE, ON, OFF, YES, NO, OK, NOT are automatically converted to boolean parameters. If you want to disable this and keep such strings as strings, call this method first.

Definition at line 458 of file KVNameValueList.h.

◆ SetLastValue()

template<typename value_type >
void KVNameValueList::SetLastValue ( const Char_t name,
value_type  value 
)
inline

associate a parameter (define by its name) and a value if the parameter is not in the list, it is inserted at the end of the list. if it's in the list replace its value and move it at the end of the list.

Definition at line 284 of file KVNameValueList.h.

◆ SetOwner()

void KVNameValueList::SetOwner ( Bool_t  enable = kTRUE)

set if the KVNameValueList owns its objects or not by default it is owner

Definition at line 287 of file KVNameValueList.cpp.

◆ SetValue() [1/2]

template<typename value_type >
void KVNameValueList::SetValue ( const Char_t name,
value_type  value 
)
inline

associate a parameter (define by its name) and a value if the parameter is not in the list, it is added if it's in the list replace its value

Examples
KVClassFactory_examples.C.

Definition at line 232 of file KVNameValueList.h.

◆ SetValue() [2/2]

void KVNameValueList::SetValue ( const KVNamedParameter p)

add (or replace) a parameter with the same name, type & value as 'p'

Definition at line 337 of file KVNameValueList.cpp.

◆ SetValue64bit()

void KVNameValueList::SetValue64bit ( const Char_t name,
ULong64_t  x 
)

Store a 64-bit integer in the list as two 32-bit parameters with names 'name_up' and 'name_lo'

Definition at line 352 of file KVNameValueList.cpp.

◆ SetValueAt()

template<typename value_type >
void KVNameValueList::SetValueAt ( const Char_t name,
value_type  value,
Int_t  idx 
)
inline

associate a parameter (define by its name) and a value if the parameter is not in the list, it is inserted at location idx in the list. if it's in the list replace its value and move it at location idx in the list.

Definition at line 246 of file KVNameValueList.h.

◆ Sort()

void KVNameValueList::Sort ( Bool_t  order = kSortAscending)
inline

Sort a list of numerical values into ascending order (by default). Use order = kSortDescending to reverse order.

Definition at line 447 of file KVNameValueList.h.

◆ WriteClass()

void KVNameValueList::WriteClass ( const Char_t classname,
const Char_t classdesc,
const Char_t base_class = "" 
)

Generate a class with member variables and Get/Set methods corresponding to the names and types of the parameters in the list For booleans we use Isxxxx/SetIsxxx

Examples
KVClassFactory_examples.C.

Definition at line 698 of file KVNameValueList.cpp.

◆ WriteEnvFile()

void KVNameValueList::WriteEnvFile ( const Char_t filename)
virtual

Write all name-value pairs in this list as a TEnv format file.

Definition at line 669 of file KVNameValueList.cpp.

◆ WriteToEnv()

void KVNameValueList::WriteToEnv ( TEnv tenv,
const TString prefix = "" 
)

Write the values of all parameters in the KVNameValueList in the TEnv, optionally using the given prefix.

Definition at line 734 of file KVNameValueList.cpp.

Member Data Documentation

◆ fIgnoreBool

Bool_t KVNameValueList::fIgnoreBool
protected

do not convert "yes", "false", "on", etc. in TEnv file to boolean

Definition at line 118 of file KVNameValueList.h.

◆ fList

KVHashList KVNameValueList::fList
protected

list of KVNamedParameter objects

Definition at line 117 of file KVNameValueList.h.


The documentation for this class was generated from the following files: