ROOT » CORE » META » TOptionListItem

class TOptionListItem: public TObject


 All ROOT classes may have RTTI (run time type identification) support
 added. The data is stored in so called DICTIONARY (look at TDictionary).
 Information about a class is stored in TClass.
 This information may be obtained via the cling api - see class TCling.
 TClass has a list of TDataMember objects providing information about all
 data members of described class.

/* */
 TDataMember provides information about name of data member, its type,
 and comment field string. It also tries to find the TMethodCall objects
 responsible for getting/setting a value of it, and gives you pointers
 to these methods. This gives you a unique possibility to access
 protected and private (!) data members if only methods for doing that
 are defined.
 These methods could either be specified in a comment field, or found
 out automatically by ROOT: here's an example:
 suppose you have a class definition:

        class MyClass{
                Float_t fX1;
                void    SetX1(Float_t x) {fX1 = x;};
                Float_t GetX1()          {return fX1;};
 Look at the data member name and method names: a data member name has
 a prefix letter (f) and has a base name X1 . The methods for getting and
 setting this value have names which consist of string Get/Set and the
 same base name. This convention of naming data fields and methods which
 access them allows TDataMember find this methods by itself completely
 automatically. To make this description complete, one should know,
 that names that are automatically recognized may be also:
 for data fields: either fXXX or fIsXXX; and for getter function
 GetXXX() or IsXXX() [where XXX is base name].

 As an example of using it let's analyse a few lines which get and set
 a fEditable field in TCanvas:

    TCanvas     *c  = new TCanvas("c");   // create a canvas
    TClass      *cl = c->IsA();            // get its class description object.
    TDataMember *dm = cl->GetDataMember("fEditable"); //This is our data member
    TMethodCall *getter = dm->GetterMethod(c); //find a method that gets value!
    Long_t l;   // declare a storage for this value;
    getter->Execute(c,"",l);  // Get this Value !!!! It will appear in l !!!
    TMethodCall *setter = dm->SetterMethod(c);
    setter->Execute(c,"0",);   // Set Value 0 !!!

 This trick is widely used in ROOT TContextMenu and dialogs for obtaining
 current values and put them as initial values in dialog fields.

 If you don't want to follow the convention of naming used by ROOT
 you still could benefit from Getter/Setter method support: the solution
 is to instruct ROOT what the names of these routines are.
 The way to do it is putting this information in a comment string to a data
 field in your class declaration:

    class MyClass{
        Int_t mydata;  //  *OPTIONS={GetMethod="Get";SetMethod="Set"} 
        Int_t Get() const { return mydata;};
        void  Set(Int_t i) {mydata=i;};

 However, this getting/setting functions are not the only feature of
 this class. The next point is providing lists of possible settings
 for the concerned data member. The idea is to have a list of possible
 options for this data member, with strings identifying them. This
 is used in dialogs with parameters to set - for details see
 TMethodArg, TRootContextMenu, TContextMenu. This list not only specifies
 the allowed value, but also provides strings naming the options.
 Options are managed via TList of TOptionListItem objects. This list
 is also  created automatically: if a data type is an enum tynpe,
 the list will have items describing every enum value, and named
 according to enum name. If type is Bool_t, two options "On" and "Off"
 with values 0 and 1 are created. For other types you need to instruct
 ROOT about possible options. The way to do it is the same as in case of
 specifying getter/setter method: a comment string to a data field in
 Your header file with class definition.
 The most general format of this string is:

*OPTIONS={GetMethod="getter";SetMethod="setter";Items=(it1="title1",it2="title2", ... ) } 

 While parsing this string ROOT firstly looks for command-tokens:
 GetMethod, SetMethod, Items; They must be preceded by string
 *OPTIONS= , enclosed by {} and separated by semicolons ";".
 All command token should have a form TOKEN=VALUE.
 All tokens are optional.
 The names of getter and setter method must be enclosed by double-quote
 marks (") .
 Specifications of Items is slightly more complicated: you need to
 put token ITEMS= and then enclose all options in curly brackets "()".
 You separate options by comas ",".
 Each option item may have one of the following forms:

         IntegerValue  = "Text Label"
         EnumValue     = "Text Label"
        "TextValue" = Text Label"

 One can sepcify values as Integers or Enums - when data field is an
 Integer, Float or Enum type; as texts - for char (more precisely:

 As mentioned above - this information are mainly used by contextmenu,
 but also in Dump() and Inspect() methods and by the THtml class.

Function Members (Methods)

voidTObject::AbstractMethod(const char* method) const
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidTObject::Browse(TBrowser* b)
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidTObject::Clear(Option_t* = "")
virtual TObject*TObject::Clone(const char* newname = "") const
virtual Int_tTObject::Compare(const TObject* obj) const
virtual voidTObject::Copy(TObject& object) const
virtual voidTObject::Delete(Option_t* option = "")MENU
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidTObject::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual voidTObject::Dump() constMENU
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTObject::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual const char*TObject::GetIconName() const
virtual const char*TObject::GetName() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
virtual const char*TObject::GetTitle() const
virtual UInt_tTObject::GetUniqueID() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTObject::Hash() const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidTObject::Inspect() constMENU
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTObject::IsSortable() const
Bool_tTObject::IsZombie() const
virtual voidTObject::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
virtual Bool_tTObject::Notify()
voidTObject::Obsolete(const char* method, const char* asOfVers, const char* removedFromVers) const
voidTObject::operator delete(void* ptr)
voidTObject::operator delete(void* ptr, void* vp)
voidTObject::operator delete[](void* ptr)
voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
TOptionListItem&operator=(const TOptionListItem&)
virtual voidTObject::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidTObject::Print(Option_t* option = "") const
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
voidTObject::ResetBit(UInt_t f)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTObject::SavePrimitive(ostream& out, Option_t* option = "")
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
static voidTObject::SetObjectStat(Bool_t stat)
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidShowMembers(TMemberInspector& insp) const
virtual voidStreamer(TBuffer&)
voidStreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
TOptionListItem(const TOptionListItem&)
TOptionListItem(TDataMember* m, Long_t val, Long_t valmask, Long_t tglmask, const char* name, const char* label)
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const

Data Members

TDataMember*fDataMember!Data member to which this option belongs
TStringfOptLabelText (or enum) value assigned to option.
TStringfOptNameText assigned to option which appears in option menu
Long_tfToggleMaskBitNot used yet: bitmask used when toggling value
Long_tfValueNumerical value assigned to option
Long_tfValueMaskBitNot used yet: bitmask used when option is a toggle group
static TObject::(anonymous)TObject::kBitMask
static TObject::EStatusBitsTObject::kCanDelete
static TObject::EStatusBitsTObject::kCannotPick
static TObject::EStatusBitsTObject::kHasUUID
static TObject::EStatusBitsTObject::kInvalidObject
static TObject::(anonymous)TObject::kIsOnHeap
static TObject::EStatusBitsTObject::kIsReferenced
static TObject::EStatusBitsTObject::kMustCleanup
static TObject::EStatusBitsTObject::kNoContextMenu
static TObject::(anonymous)TObject::kNotDeleted
static TObject::EStatusBitsTObject::kObjInCanvas
static TObject::(anonymous)TObject::kOverwrite
static TObject::(anonymous)TObject::kSingleKey
static TObject::(anonymous)TObject::kWriteDelete
static TObject::(anonymous)TObject::kZombie

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

TOptionListItem(TDataMember* m, Long_t val, Long_t valmask, Long_t tglmask, const char* name, const char* label)
TDataMember& operator=(const TDataMember&)
TOptionListItem(TDataMember* m, Long_t val, Long_t valmask, Long_t tglmask, const char* name, const char* label)