ROOT logo
ROOT » CORE » META » TToggle

class TToggle: public TNamed


TToggle

This class defines toggling facility for both - object's method or
variables.
Assume that user provides an object with a two-state field , and
 methods to Get/Set value of this field. This object enables to switch
values via this method when the only thing you know about the field
is the name of the method (or method itself) which sets the field.
This facility is required in context Pop-Up menu, when the only
information about how to toggle a field is a name of methhod which
sets it.
This class may be also used for toggling an integer variable,
which may be important while building universal objects...
When user provides a "set-method" of name SetXXX this object tries
automaticaly find a matching "get-method" by lookin for a method
with name GetXXX, IsXXX or HasXXX for given object.


Function Members (Methods)

public:
TToggle()
TToggle(const TToggle&)
~TToggle()
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 voidTNamed::Clear(Option_t* option = "")
virtual TObject*TNamed::Clone(const char* newname = "") const
virtual Int_tTNamed::Compare(const TObject* obj) const
virtual voidTNamed::Copy(TObject& named) 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 voidTNamed::FillBuffer(char*& buffer)
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()
TMethodCall*GetGetter() const
virtual const char*TObject::GetIconName() const
virtual const char*TNamed::GetName() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Long_tGetOffValue()
virtual Long_tGetOnValue()
virtual Option_t*TObject::GetOption() const
TMethodCall*GetSetter() const
virtual Bool_tGetState()
virtual const char*TNamed::GetTitle() const
virtual UInt_tTObject::GetUniqueID() const
virtual Int_tGetValue()
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTNamed::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
virtual Bool_tIsInitialized()
Bool_tTObject::IsOnHeap() const
virtual Bool_tTNamed::IsSortable() const
Bool_tTObject::IsZombie() const
virtual voidTNamed::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
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static 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)
TToggle&operator=(const TToggle&)
virtual voidTObject::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidTNamed::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)
virtual voidTNamed::SetName(const char* name)MENU
virtual voidTNamed::SetNameTitle(const char* name, const char* title)
static voidTObject::SetObjectStat(Bool_t stat)
virtual voidSetOffValue(Long_t lof)
virtual voidSetOnValue(Long_t lon)
virtual voidSetState(Bool_t state)
virtual voidTNamed::SetTitle(const char* title = "")MENU
virtual voidSetToggledObject(TObject* obj, TMethod* anymethod)
virtual voidSetToggledVariable(Int_t& var)
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidSetValue(Long_t val)
virtual voidShowMembers(TMemberInspector& insp)
virtual Int_tTNamed::Sizeof() const
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& 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
virtual voidToggle()
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
protected:
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidTObject::MakeZombie()

Data Members

protected:
TMethodCall*fGetterMethod to Get a value of fObject;
Bool_tfInitializedTrue if either SetToggledObject or SetToggledVariable called - enables Toggle() method.
TStringTNamed::fNameobject identifier
TObject*fObjectThe object this Toggle belongs to
TMethodCall*fSetterMethod to Set a value of fObject;
Int_t*fTglVariableAlternatively: pointer to an integer value to be Toggled instead of TObjectl
TStringTNamed::fTitleobject title
private:
Long_tfOffValueValue recognized as switched OFF(Def=0)
Long_tfOnValueValue recognized as switched ON (Def=1)
Bool_tfStateObject's state - "a local copy"
Long_tfValueLocal copy of a value returned by called function

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

TToggle()
 TToggle default constructor. You have to initialize it before using
 by making a call to SetToggledVariable() or SetToggledObject().
void SetToggledVariable(Int_t& var)
 Initializes object for use with a variable - you pass it via reference
 so it will be modified by Toggle.
Bool_t GetState()
 Returns the state of Toggle according to its current value and
 fOnValue, returns true if they match.
void SetState(Bool_t state)
 Sets the value of toggle to fOnValue or fOffValue according to passed
 argument.
void SetValue(Long_t val)
 Sets the value of toggle and modifies its state according to whether
 the value is equal to fOnValue.
void Toggle()
 Toggles the Values and State of this object and connected data!
void SetToggledObject(TObject* obj, TMethod* anymethod)
 Initializes it to toggle an object's datamember using this object's
 method.
TToggle()
Bool_t IsInitialized()
{return fInitialized;}
void SetOnValue(Long_t lon)
{fOnValue=lon;}
Long_t GetOnValue()
{return fOnValue;}
void SetOffValue(Long_t lof)
{fOffValue=lof;}
Long_t GetOffValue()
{return fOffValue;}
Int_t GetValue()
{return fValue;}
TMethodCall * GetGetter() const
{ return fGetter; }
TMethodCall * GetSetter() const
{ return fSetter; }