GSI Object Oriented Online Offline (Go4)  GO4-6.3.0
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
TGo4FitSlot Class Reference

#include <TGo4FitSlot.h>

+ Inheritance diagram for TGo4FitSlot:

Public Member Functions

 TGo4FitSlot ()
 
 TGo4FitSlot (TNamed *iOwner, TClass *iClass)
 
 TGo4FitSlot (const char *iName, const char *iTitle, TNamed *iOwner, TClass *iClass, Bool_t iNeeded=kFALSE, TObject *iObject=nullptr, Bool_t iOwned=kFALSE)
 
virtual ~TGo4FitSlot ()
 
TClass * GetClass () const
 
void SetDefaults (TNamed *iOwner, TClass *iClass)
 
void SetSaveFlag (Int_t iSaveFlag)
 
Int_t GetSaveFlag () const
 
Bool_t IsSuitable (TObject *obj) const
 
Bool_t IsSuitableClass (TClass *cl) const
 
void ClearObject ()
 
Bool_t SetObject (TObject *iObject, Bool_t iOwned=kFALSE, Bool_t CheckClass=kTRUE)
 
Bool_t ConnectToSlot (TGo4FitSlot *slot)
 
Bool_t CanConnectToSlot (TGo4FitSlot *slot)
 
TGo4FitSlotGetConnectedSlot () const
 
Bool_t IsConnectedToSlot () const
 
void ClearConnectionToSlot ()
 
TObject * GetObject () const
 
const char * GetObjectName () const
 
TObject * CloneObject (const char *newname=nullptr)
 
void Clear (Option_t *="") override
 
Bool_t GetOwned () const
 
void SetOwned (Bool_t iOwned=kTRUE)
 
Bool_t GetNeeded () const
 
void SetNeeded (Bool_t iNeeded)
 
Bool_t IsEmpty () const
 
Bool_t IsObject () const
 
Bool_t IsRequired () const
 
void Print (Option_t *option="") const override
 
- Public Member Functions inherited from TGo4FitNamed
 TGo4FitNamed ()
 
 TGo4FitNamed (const char *Name, const char *Title, TNamed *Owner=nullptr)
 
virtual ~TGo4FitNamed ()
 
const char * GetFullName ()
 
const char * GetOwnerFullName ()
 
void SetOwner (TNamed *iOwner)
 
TNamed * GetOwner ()
 
void Print (Option_t *option="") const override
 

Protected Member Functions

void SetSaveSettings (Int_t save=-1, Int_t own=-1)
 
Bool_t HasSaveSettings ()
 
Bool_t WillBeSaved ()
 
void CheckOwnership ()
 

Protected Attributes

TClass * fxClass {nullptr}
 
Int_t fiSaveFlag {0}
 
Bool_t fbOwned {kFALSE}
 0 - slot save if owned(default), 1 - saved always, 2 - saved never More...
 
Bool_t fbConnected {kFALSE}
 
Bool_t fbNeeded {kFALSE}
 
TObject * fxObject {nullptr}
 
Int_t fiSaveSlot {0}
 
Int_t fiSaveOwnership {0}
 

Friends

class TGo4FitSlotList
 

Detailed Description

Object for managing pointers on specific objects. General purpose of this object - store pointer on any kind of object (derived from TObject) with/without ownership and provide a general interface to set/get and store/restore this object. Slot always belong to another object (has owner). Slot always knows, what kind of object should be assigned to it (via Class property). Slots may be distributed in different places of fitter: in data object (typically for assigning data like TH1, TGraph or other), sometimes in model object (like in TGo4FitModelFromData in slot TGo4FitData object should be placed to provide bins for model component) or complex hierarchy of these objects possible. Fitter has a method to collect a list of all slots from all possible places. Once all slots are collected, fitter know, how many and what kind of objects should be (or can be) assigned to fitter before start fitting. Fitter (see TGo4FitterAbstract description) has a set of function for manipulating with objects in slots.

Definition at line 27 of file TGo4FitSlot.h.

Constructor & Destructor Documentation

◆ TGo4FitSlot() [1/3]

TGo4FitSlot::TGo4FitSlot ( )

Default constructor.

Definition at line 23 of file TGo4FitSlot.cxx.

◆ TGo4FitSlot() [2/3]

TGo4FitSlot::TGo4FitSlot ( TNamed *  iOwner,
TClass *  iClass 
)

Creates TGo4FitSlot object. This constructor should be called in default constructor of object, where slot situated. Constructor only sets owner of slot, desired class of object and if this object should be always owned. The rest values (name, title, object and so on) should be restored by streamer, which typically calls default constructor.

Definition at line 29 of file TGo4FitSlot.cxx.

References TGo4FitNamed::SetOwner().

◆ TGo4FitSlot() [3/3]

TGo4FitSlot::TGo4FitSlot ( const char *  iName,
const char *  iTitle,
TNamed *  iOwner,
TClass *  iClass,
Bool_t  iNeeded = kFALSE,
TObject *  iObject = nullptr,
Bool_t  iOwned = kFALSE 
)

Creates TGo4FitSlot object. This constructor should be placed in normal constructor of object, where slot is situated. Constructor sets name and title of slot, owner of slot, desired class of object and if this object always should be owned. Optionally, requirements of object (is it always needed or not, default - not), pointer on object and ownership flag can be specified.

Definition at line 36 of file TGo4FitSlot.cxx.

◆ ~TGo4FitSlot()

TGo4FitSlot::~TGo4FitSlot ( )
virtual

Destroys TFo4FitSlot object.

Definition at line 43 of file TGo4FitSlot.cxx.

References fbConnected, fbOwned, and fxObject.

Member Function Documentation

◆ CanConnectToSlot()

Bool_t TGo4FitSlot::CanConnectToSlot ( TGo4FitSlot slot)

Checks, if slot can be connected to other

Definition at line 70 of file TGo4FitSlot.cxx.

References GetClass(), and GetConnectedSlot().

Referenced by ConnectToSlot(), TGo4FitPanel::FillPopupForSlot(), and GetSaveFlag().

◆ CheckOwnership()

void TGo4FitSlot::CheckOwnership ( )
protected

Sets up ownership relation between object and owner of slot. If object owned by slot and object derived from TGo4FitNamed class, the owner of slot becomes the owned of object. This gives an ability to combine FullName of TGo4FitNamed object according ownership relation.

Definition at line 177 of file TGo4FitSlot.cxx.

References fbOwned, fxObject, TGo4FitNamed::GetOwner(), IsConnectedToSlot(), and TGo4FitNamed::SetOwner().

Referenced by HasSaveSettings(), and SetObject().

◆ Clear()

void TGo4FitSlot::Clear ( Option_t *  = "")
inlineoverride

Clear pointer on object in slot. If object owned, it will be destroyed.

Definition at line 155 of file TGo4FitSlot.h.

References SetObject().

Referenced by TGo4FitSlotList::ClearSlot().

◆ ClearConnectionToSlot()

void TGo4FitSlot::ClearConnectionToSlot ( )

Clear connection to other slot

Definition at line 83 of file TGo4FitSlot.cxx.

References fbConnected, fbOwned, fxObject, and IsConnectedToSlot().

Referenced by TGo4Fitter::CheckSlotsBeforeDelete(), TGo4FitPanel::ExecutePopupForSlot(), and IsConnectedToSlot().

◆ ClearObject()

void TGo4FitSlot::ClearObject ( )

Method remove object pointer. Should be called if object was destroyed and therefore SetObject cannot be used

Definition at line 112 of file TGo4FitSlot.cxx.

References fbConnected, fbOwned, and fxObject.

Referenced by GetSaveFlag(), TGo4FitDataGraph::SetGraph(), TGo4FitDataHistogram::SetHistogram(), and TGo4FitDataProfile::SetProfile().

◆ CloneObject()

TObject * TGo4FitSlot::CloneObject ( const char *  newname = nullptr)

Clone object in slot and returns pointer on new object. Name of new object can be optionally specified.

Definition at line 153 of file TGo4FitSlot.cxx.

References GetObject().

Referenced by TGo4FitPanel::ExecutePopupForSlot(), and IsConnectedToSlot().

◆ ConnectToSlot()

Bool_t TGo4FitSlot::ConnectToSlot ( TGo4FitSlot slot)

Connect this slot to provided slot. This means, that objects, containing in slot will be also return by GetObject() of current slot. Class of slots should be compatible Returns kTRUE, if operation successful

Definition at line 58 of file TGo4FitSlot.cxx.

References CanConnectToSlot(), fbConnected, fbOwned, and fxObject.

Referenced by TGo4FitSlotList::ConnectSlots(), TGo4FitPanel::ExecutePopupForSlot(), and GetSaveFlag().

◆ GetClass()

TClass* TGo4FitSlot::GetClass ( ) const
inline

◆ GetConnectedSlot()

TGo4FitSlot* TGo4FitSlot::GetConnectedSlot ( ) const
inline

◆ GetNeeded()

Bool_t TGo4FitSlot::GetNeeded ( ) const
inline

Return requirement status for slot. If kTRUE, object should always be sets before any fitting become possible.

Definition at line 172 of file TGo4FitSlot.h.

References fbNeeded.

Referenced by QFitSlotWidget::FillSpecificData().

◆ GetObject()

TObject * TGo4FitSlot::GetObject ( ) const

◆ GetObjectName()

const char * TGo4FitSlot::GetObjectName ( ) const

Return name of assigned object.

Definition at line 144 of file TGo4FitSlot.cxx.

References GetObject().

Referenced by QFitSlotWidget::FillSpecificData(), IsConnectedToSlot(), and Print().

◆ GetOwned()

Bool_t TGo4FitSlot::GetOwned ( ) const
inline

◆ GetSaveFlag()

Int_t TGo4FitSlot::GetSaveFlag ( ) const
inline

◆ HasSaveSettings()

Bool_t TGo4FitSlot::HasSaveSettings ( )
protected

◆ IsConnectedToSlot()

Bool_t TGo4FitSlot::IsConnectedToSlot ( ) const
inline

◆ IsEmpty()

Bool_t TGo4FitSlot::IsEmpty ( ) const
inline

Return kTRUE, if no object in slot.

Definition at line 182 of file TGo4FitSlot.h.

References GetObject().

Referenced by TGo4FitSlotList::IsEmptySlots(), IsRequired(), and TGo4FitSlotList::SetObject().

◆ IsObject()

Bool_t TGo4FitSlot::IsObject ( ) const
inline

Return kTRUE, if object assigned to slot.

Definition at line 187 of file TGo4FitSlot.h.

References GetObject().

Referenced by TGo4FitPanel::FillPopupForSlot().

◆ IsRequired()

Bool_t TGo4FitSlot::IsRequired ( ) const
inline

Returns kTRUE, if object required, but not yet set.

Definition at line 192 of file TGo4FitSlot.h.

References fbNeeded, IsEmpty(), and Print().

Referenced by TGo4FitSlotList::CheckObjects(), and TGo4FitterAbstract::ProcessObjects().

◆ IsSuitable()

Bool_t TGo4FitSlot::IsSuitable ( TObject *  obj) const

Checks, if object class corresponds to class, specified for slot

Definition at line 92 of file TGo4FitSlot.cxx.

References GetClass(), GetConnectedSlot(), IsConnectedToSlot(), and IsSuitable().

Referenced by GetSaveFlag(), IsSuitable(), TGo4FitterAbstract::ProcessObjects(), TGo4FitSlotList::SetObject(), and TGo4FitPanel::UpdateObjectReferenceInSlot().

◆ IsSuitableClass()

Bool_t TGo4FitSlot::IsSuitableClass ( TClass *  cl) const

Checks, if class corresponds to specified for slot

Definition at line 102 of file TGo4FitSlot.cxx.

References GetClass(), GetConnectedSlot(), IsConnectedToSlot(), and IsSuitableClass().

Referenced by TGo4FitPanel::DropOnPanel(), GetSaveFlag(), and IsSuitableClass().

◆ Print()

void TGo4FitSlot::Print ( Option_t *  option = "") const
override

◆ SetDefaults()

void TGo4FitSlot::SetDefaults ( TNamed *  iOwner,
TClass *  iClass 
)

Set basic fields of slot. See proper constructor for description. Normally should not be called by user.

Definition at line 52 of file TGo4FitSlot.cxx.

References fxClass, and TGo4FitNamed::SetOwner().

Referenced by GetClass(), and TGo4FitData::Print().

◆ SetNeeded()

void TGo4FitSlot::SetNeeded ( Bool_t  iNeeded)
inline

Set requirement flag for object.

Definition at line 177 of file TGo4FitSlot.h.

References fbNeeded.

Referenced by QFitSlotWidget::RequirementChk_toggled().

◆ SetObject()

Bool_t TGo4FitSlot::SetObject ( TObject *  iObject,
Bool_t  iOwned = kFALSE,
Bool_t  CheckClass = kTRUE 
)

Sets object to slot. First, if before another object was set to slot with ownership flag, it will be destroyed. Then, if object should always be owned by slot, but object is assigning without ownership, it will be cloned and clone will be assigned with ownership flag. if CheckClass==kTRUE (default), slot will refuse unsuitable object class. If object owned by slot, it always be destroyed by slot.

Definition at line 119 of file TGo4FitSlot.cxx.

References CheckOwnership(), fbConnected, fbOwned, fxObject, GetClass(), and GetConnectedSlot().

Referenced by Clear(), TGo4FitPanel::ClearObjectReferenceInSlots(), TGo4FitPanel::ExecutePopupForSlot(), GetSaveFlag(), TGo4FitterAbstract::ProcessObjects(), TGo4FitDataRidge::SetData(), TGo4FitModelFromData::SetDataAsModel(), TGo4FitDataGraph::SetGraph(), TGo4FitDataHistogram::SetHistogram(), TGo4FitSlotList::SetObject(), TGo4FitDataProfile::SetProfile(), and TGo4FitPanel::UpdateObjectReferenceInSlot().

◆ SetOwned()

void TGo4FitSlot::SetOwned ( Bool_t  iOwned = kTRUE)
inline

Explicitly sets ownership flag. Normally should not be called by user.

Definition at line 166 of file TGo4FitSlot.h.

References fbOwned.

Referenced by TGo4FitSlotList::CheckDuplicatesOnSlot(), TGo4FitSlotList::ClearSlot(), and TGo4FitSlotList::PrepareSlotsForWriting().

◆ SetSaveFlag()

void TGo4FitSlot::SetSaveFlag ( Int_t  iSaveFlag)
inline

Set save flag for saving of object in slot, when slot stored to streamer: 0 - object will be saved if it owned, 1 - object always will be saved 2 - object never will be saved.

Definition at line 75 of file TGo4FitSlot.h.

References fiSaveFlag.

Referenced by QFitSlotWidget::SaveCmb_activated(), and TGo4FitSlotList::SetSaveFlagForObjects().

◆ SetSaveSettings()

void TGo4FitSlot::SetSaveSettings ( Int_t  save = -1,
Int_t  own = -1 
)
protected

Definition at line 192 of file TGo4FitSlot.cxx.

References fiSaveOwnership, and fiSaveSlot.

Referenced by TGo4FitSlotList::PrepareSlotsForWriting().

◆ WillBeSaved()

Bool_t TGo4FitSlot::WillBeSaved ( )
protected

Definition at line 187 of file TGo4FitSlot.cxx.

References fbOwned, and fiSaveFlag.

Referenced by HasSaveSettings(), and TGo4FitSlotList::PrepareSlotsForWriting().

Friends And Related Function Documentation

◆ TGo4FitSlotList

friend class TGo4FitSlotList
friend

Definition at line 201 of file TGo4FitSlot.h.

Member Data Documentation

◆ fbConnected

Bool_t TGo4FitSlot::fbConnected {kFALSE}
protected

If object is connected slot

Definition at line 235 of file TGo4FitSlot.h.

Referenced by ClearConnectionToSlot(), ClearObject(), ConnectToSlot(), GetConnectedSlot(), HasSaveSettings(), SetObject(), and ~TGo4FitSlot().

◆ fbNeeded

Bool_t TGo4FitSlot::fbNeeded {kFALSE}
protected

Flag, is this object should always be set.

Definition at line 240 of file TGo4FitSlot.h.

Referenced by GetNeeded(), HasSaveSettings(), IsRequired(), Print(), and SetNeeded().

◆ fbOwned

Bool_t TGo4FitSlot::fbOwned {kFALSE}
protected

0 - slot save if owned(default), 1 - saved always, 2 - saved never

Ownership flag of object.

Definition at line 230 of file TGo4FitSlot.h.

Referenced by CheckOwnership(), ClearConnectionToSlot(), ClearObject(), ConnectToSlot(), GetConnectedSlot(), GetOwned(), HasSaveSettings(), Print(), SetObject(), SetOwned(), WillBeSaved(), and ~TGo4FitSlot().

◆ fiSaveFlag

Int_t TGo4FitSlot::fiSaveFlag {0}
protected

Describe saving of object in slot.

Definition at line 224 of file TGo4FitSlot.h.

Referenced by GetSaveFlag(), SetSaveFlag(), and WillBeSaved().

◆ fiSaveOwnership

Int_t TGo4FitSlot::fiSaveOwnership {0}
protected

Definition at line 248 of file TGo4FitSlot.h.

Referenced by HasSaveSettings(), and SetSaveSettings().

◆ fiSaveSlot

Int_t TGo4FitSlot::fiSaveSlot {0}
protected

Definition at line 247 of file TGo4FitSlot.h.

Referenced by HasSaveSettings(), and SetSaveSettings().

◆ fxClass

TClass* TGo4FitSlot::fxClass {nullptr}
protected

Class of object, which should be assigned to slot.

Definition at line 219 of file TGo4FitSlot.h.

Referenced by GetClass(), Print(), and SetDefaults().

◆ fxObject

TObject* TGo4FitSlot::fxObject {nullptr}
protected

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