GSI Object Oriented Online Offline (Go4) GO4-6.4.0
|
Managing pointers on specific objects. More...
#include <TGo4FitSlot.h>
Public Member Functions | |
TGo4FitSlot () | |
Default constructor. | |
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. | |
TGo4FitSlot (TNamed *iOwner, TClass *iClass) | |
Creates TGo4FitSlot object. | |
virtual | ~TGo4FitSlot () |
Destroys TFo4FitSlot object. | |
Bool_t | CanConnectToSlot (TGo4FitSlot *slot) |
Checks, if slot can be connected to other. | |
void | Clear (Option_t *="") override |
Clear pointer on object in slot. | |
void | ClearConnectionToSlot () |
Clear connection to other slot. | |
void | ClearObject () |
Method remove object pointer. | |
TObject * | CloneObject (const char *newname=nullptr) |
Clone object in slot and returns pointer on new object. | |
Bool_t | ConnectToSlot (TGo4FitSlot *slot) |
Connect this slot to provided slot. | |
TClass * | GetClass () const |
Return pointer on class for desired object. | |
TGo4FitSlot * | GetConnectedSlot () const |
Returns pointer to connected slot or 0, if not connected. | |
Bool_t | GetNeeded () const |
Return requirement status for slot. | |
TObject * | GetObject () const |
Return pointer on assigned object. | |
const char * | GetObjectName () const |
Return name of assigned object. | |
Bool_t | GetOwned () const |
Return ownership flag. | |
Int_t | GetSaveFlag () const |
Returns save flag. | |
Bool_t | IsConnectedToSlot () const |
Returns kTRUE, if slot connected to another slot. | |
Bool_t | IsEmpty () const |
Return kTRUE, if no object in slot. | |
Bool_t | IsObject () const |
Return kTRUE, if object assigned to slot. | |
Bool_t | IsRequired () const |
Returns kTRUE, if object required, but not yet set. | |
Bool_t | IsSuitable (TObject *obj) const |
Checks, if object class corresponds to class, specified for slot. | |
Bool_t | IsSuitableClass (TClass *cl) const |
Checks, if class corresponds to specified for slot. | |
void | Print (Option_t *option="") const override |
Print information on standard output. | |
void | SetDefaults (TNamed *iOwner, TClass *iClass) |
Set basic fields of slot. | |
void | SetNeeded (Bool_t iNeeded) |
Set requirement flag for object. | |
Bool_t | SetObject (TObject *iObject, Bool_t iOwned=kFALSE, Bool_t CheckClass=kTRUE) |
Sets object to slot. | |
void | SetOwned (Bool_t iOwned=kTRUE) |
Explicitly sets ownership flag. | |
void | SetSaveFlag (Int_t iSaveFlag) |
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. | |
![]() | |
TGo4FitNamed () | |
Default constructor. | |
TGo4FitNamed (const char *Name, const char *Title, TNamed *Owner=nullptr) | |
Creates TGo4FitNamed object and set name and title. | |
virtual | ~TGo4FitNamed () |
Destroy TGo4FitNamed object. | |
const char * | GetFullName () |
Returns full name of object. | |
TNamed * | GetOwner () |
Return owner of object. | |
const char * | GetOwnerFullName () |
Return full name of owner. | |
void | Print (Option_t *option="") const override |
void | SetOwner (TNamed *iOwner) |
Sets owner of object. | |
Protected Member Functions | |
void | CheckOwnership () |
Sets up ownership relation between object and owner of slot. | |
Bool_t | HasSaveSettings () |
void | SetSaveSettings (Int_t save=-1, Int_t own=-1) |
Bool_t | WillBeSaved () |
Protected Attributes | |
Bool_t | fbConnected {kFALSE} |
If object is connected slot. | |
Bool_t | fbNeeded {kFALSE} |
Flag, is this object should always be set. | |
Bool_t | fbOwned {kFALSE} |
0 - slot save if owned(default), 1 - saved always, 2 - saved never | |
Int_t | fiSaveFlag {0} |
Describe saving of object in slot. | |
Int_t | fiSaveOwnership {0} |
Int_t | fiSaveSlot {0} |
TClass * | fxClass {nullptr} |
Class of object, which should be assigned to slot. | |
TObject * | fxObject {nullptr} |
Pointer on assigned object. | |
Friends | |
class | TGo4FitSlotList |
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 28 of file TGo4FitSlot.h.
TGo4FitSlot::TGo4FitSlot | ( | ) |
Default constructor.
Definition at line 23 of file TGo4FitSlot.cxx.
References TGo4FitNamed::TGo4FitNamed(), fbNeeded, fbOwned, fiSaveFlag, fiSaveOwnership, fiSaveSlot, fxClass, and fxObject.
Referenced by CanConnectToSlot(), ConnectToSlot(), and GetConnectedSlot().
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::TGo4FitNamed(), fbNeeded, fbOwned, fiSaveFlag, fiSaveOwnership, fiSaveSlot, fxClass, fxObject, and TGo4FitNamed::SetOwner().
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.
References TGo4FitNamed::TGo4FitNamed(), fbNeeded, fbOwned, fiSaveFlag, fiSaveOwnership, fiSaveSlot, fxClass, and fxObject.
|
virtual |
Destroys TFo4FitSlot object.
Definition at line 43 of file TGo4FitSlot.cxx.
References fbConnected, fbOwned, and fxObject.
Bool_t TGo4FitSlot::CanConnectToSlot | ( | TGo4FitSlot * | slot | ) |
Checks, if slot can be connected to other.
Definition at line 70 of file TGo4FitSlot.cxx.
References TGo4FitSlot(), GetClass(), and GetConnectedSlot().
Referenced by ConnectToSlot(), and TGo4FitPanel::FillPopupForSlot().
|
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 TGo4FitNamed::TGo4FitNamed(), fbOwned, fxObject, TGo4FitNamed::GetOwner(), IsConnectedToSlot(), and TGo4FitNamed::SetOwner().
Referenced by SetObject().
|
inlineoverride |
Clear pointer on object in slot.
If object owned, it will be destroyed.
Definition at line 156 of file TGo4FitSlot.h.
References SetObject().
Referenced by TGo4FitSlotList::ClearSlot().
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(), and TGo4FitPanel::ExecutePopupForSlot().
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.
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().
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 TGo4FitSlot(), CanConnectToSlot(), fbConnected, fbOwned, and fxObject.
Referenced by TGo4FitSlotList::ConnectSlots(), and TGo4FitPanel::ExecutePopupForSlot().
|
inline |
Return pointer on class for desired object.
Definition at line 62 of file TGo4FitSlot.h.
References fxClass.
Referenced by CanConnectToSlot(), TGo4FitSlotList::CheckObjects(), TGo4FitPanel::ClearObjectReferenceInSlots(), TGo4FitPanel::FillPopupForSlot(), QFitSlotWidget::FillSpecificData(), TGo4FitPanel::GetPadIndexForSlot(), IsSuitable(), IsSuitableClass(), TGo4FitterAbstract::ProcessObjects(), SetObject(), TGo4FitPanel::UpdateObjectReferenceInSlots(), and TGo4FitPanel::UpdateWizStackWidget().
|
inline |
Returns pointer to connected slot or 0, if not connected.
Definition at line 124 of file TGo4FitSlot.h.
References TGo4FitSlot(), fbConnected, fbOwned, and fxObject.
Referenced by CanConnectToSlot(), TGo4Fitter::CheckSlotsBeforeDelete(), TGo4FitSlotList::ClearSlot(), TGo4FitPanel::FillPopupForSlot(), GetObject(), IsConnectedToSlot(), IsSuitable(), IsSuitableClass(), Print(), and SetObject().
|
inline |
Return requirement status for slot.
If kTRUE, object should always be sets before any fitting become possible.
Definition at line 173 of file TGo4FitSlot.h.
References fbNeeded.
Referenced by QFitSlotWidget::FillSpecificData().
TObject * TGo4FitSlot::GetObject | ( | ) | const |
Return pointer on assigned object.
Definition at line 139 of file TGo4FitSlot.cxx.
References fxObject, GetConnectedSlot(), GetObject(), and IsConnectedToSlot().
Referenced by TGo4FitSlotList::CheckDuplicatesOnSlot(), TGo4FitSlotList::ClearSlot(), CloneObject(), TGo4FitComponent::CollectParsTo(), QFitSlotWidget::FillSpecificData(), TGo4FitData::GetAxisTrans(), GetObject(), GetObjectName(), IsEmpty(), IsObject(), TGo4FitSlotList::IsObjectInSlots(), TGo4FitSlotList::PrepareSlotsForWriting(), TGo4FitterAbstract::ProcessObjects(), TGo4FitPanel::UpdateItem(), TGo4FitPanel::UpdateWizStackWidget(), and TGo4FitPanel::Wiz_GetSlotSourceInfo().
const char * TGo4FitSlot::GetObjectName | ( | ) | const |
Return name of assigned object.
Definition at line 144 of file TGo4FitSlot.cxx.
References GetObject().
Referenced by QFitSlotWidget::FillSpecificData(), and Print().
|
inline |
Return ownership flag.
Definition at line 161 of file TGo4FitSlot.h.
References fbOwned.
Referenced by TGo4FitSlotList::CheckDuplicatesOnSlot(), TGo4FitPanel::ClearObjectReferenceInSlots(), TGo4FitSlotList::ClearSlot(), TGo4FitComponent::CollectParsTo(), TGo4FitPanel::FillPopupForSlot(), QFitSlotWidget::FillSpecificData(), TGo4FitPanel::GetPadIndexForSlot(), TGo4FitSlotList::IsObjectInSlots(), TGo4FitSlotList::PrepareSlotsForWriting(), TGo4FitPanel::UpdateObjectReferenceInSlot(), TGo4FitPanel::UpdateWizStackWidget(), and TGo4FitPanel::Wiz_GetSlotSourceInfo().
|
inline |
Returns save flag.
Definition at line 81 of file TGo4FitSlot.h.
References fiSaveFlag.
Referenced by QFitSlotWidget::FillSpecificData().
|
protected |
Definition at line 198 of file TGo4FitSlot.cxx.
References fiSaveOwnership, and fiSaveSlot.
Referenced by TGo4FitSlotList::PrepareSlotsForWriting().
|
inline |
Returns kTRUE, if slot connected to another slot.
Definition at line 129 of file TGo4FitSlot.h.
References GetConnectedSlot().
Referenced by TGo4FitSlotList::CheckDuplicatesOnSlot(), CheckOwnership(), ClearConnectionToSlot(), TGo4FitSlotList::ClearSlot(), GetObject(), IsSuitable(), IsSuitableClass(), TGo4FitSlotList::PrepareSlotsForWriting(), and Print().
|
inline |
Return kTRUE, if no object in slot.
Definition at line 183 of file TGo4FitSlot.h.
References GetObject().
Referenced by TGo4FitSlotList::IsEmptySlots(), IsRequired(), TGo4FitSlotList::SetObject(), and TGo4FitSlotList::SetObject().
|
inline |
Return kTRUE, if object assigned to slot.
Definition at line 188 of file TGo4FitSlot.h.
References GetObject().
Referenced by TGo4FitPanel::FillPopupForSlot().
|
inline |
Returns kTRUE, if object required, but not yet set.
Definition at line 193 of file TGo4FitSlot.h.
References fbNeeded, and IsEmpty().
Referenced by TGo4FitSlotList::CheckObjects(), and TGo4FitterAbstract::ProcessObjects().
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 IsSuitable(), TGo4FitterAbstract::ProcessObjects(), TGo4FitSlotList::SetObject(), TGo4FitSlotList::SetObject(), and TGo4FitPanel::UpdateObjectReferenceInSlot().
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(), and IsSuitableClass().
|
override |
Print information on standard output.
Definition at line 162 of file TGo4FitSlot.cxx.
References fbNeeded, fbOwned, fxClass, fxObject, GetConnectedSlot(), GetObjectName(), IsConnectedToSlot(), and Print().
Referenced by Print().
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().
|
inline |
Set requirement flag for object.
Definition at line 178 of file TGo4FitSlot.h.
References fbNeeded.
Referenced by QFitSlotWidget::RequirementChk_toggled().
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(), TGo4FitterAbstract::ProcessObjects(), TGo4FitSlotList::SetObject(), TGo4FitSlotList::SetObject(), and TGo4FitPanel::UpdateObjectReferenceInSlot().
|
inline |
Explicitly sets ownership flag.
Normally should not be called by user.
Definition at line 167 of file TGo4FitSlot.h.
References fbOwned.
Referenced by TGo4FitSlotList::CheckDuplicatesOnSlot(), TGo4FitSlotList::ClearSlot(), and TGo4FitSlotList::PrepareSlotsForWriting().
|
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 76 of file TGo4FitSlot.h.
References fiSaveFlag.
Referenced by QFitSlotWidget::SaveCmb_activated(), and TGo4FitSlotList::SetSaveFlagForObjects().
|
protected |
Definition at line 192 of file TGo4FitSlot.cxx.
References fiSaveOwnership, and fiSaveSlot.
Referenced by TGo4FitSlotList::PrepareSlotsForWriting().
|
protected |
Definition at line 187 of file TGo4FitSlot.cxx.
References fbOwned, and fiSaveFlag.
Referenced by TGo4FitSlotList::PrepareSlotsForWriting().
|
friend |
Definition at line 202 of file TGo4FitSlot.h.
References TGo4FitSlotList.
Referenced by TGo4FitSlotList.
|
protected |
If object is connected slot.
Definition at line 236 of file TGo4FitSlot.h.
Referenced by ~TGo4FitSlot(), ClearConnectionToSlot(), ClearObject(), ConnectToSlot(), GetConnectedSlot(), and SetObject().
|
protected |
Flag, is this object should always be set.
Definition at line 241 of file TGo4FitSlot.h.
Referenced by TGo4FitSlot(), TGo4FitSlot(), TGo4FitSlot(), GetNeeded(), IsRequired(), Print(), and SetNeeded().
|
protected |
0 - slot save if owned(default), 1 - saved always, 2 - saved never
Ownership flag of object.
Definition at line 231 of file TGo4FitSlot.h.
Referenced by TGo4FitSlot(), TGo4FitSlot(), TGo4FitSlot(), ~TGo4FitSlot(), CheckOwnership(), ClearConnectionToSlot(), ClearObject(), ConnectToSlot(), GetConnectedSlot(), GetOwned(), Print(), SetObject(), SetOwned(), and WillBeSaved().
|
protected |
Describe saving of object in slot.
Definition at line 225 of file TGo4FitSlot.h.
Referenced by TGo4FitSlot(), TGo4FitSlot(), TGo4FitSlot(), GetSaveFlag(), SetSaveFlag(), and WillBeSaved().
|
protected |
Definition at line 249 of file TGo4FitSlot.h.
Referenced by TGo4FitSlot(), TGo4FitSlot(), TGo4FitSlot(), HasSaveSettings(), and SetSaveSettings().
|
protected |
Definition at line 248 of file TGo4FitSlot.h.
Referenced by TGo4FitSlot(), TGo4FitSlot(), TGo4FitSlot(), HasSaveSettings(), and SetSaveSettings().
|
protected |
Class of object, which should be assigned to slot.
Definition at line 220 of file TGo4FitSlot.h.
Referenced by TGo4FitSlot(), TGo4FitSlot(), TGo4FitSlot(), GetClass(), Print(), and SetDefaults().
|
protected |
Pointer on assigned object.
Definition at line 246 of file TGo4FitSlot.h.
Referenced by TGo4FitSlot(), TGo4FitSlot(), TGo4FitSlot(), ~TGo4FitSlot(), CheckOwnership(), ClearConnectionToSlot(), ClearObject(), ConnectToSlot(), GetConnectedSlot(), GetObject(), Print(), and SetObject().