37 TObject *iObject, Bool_t iOwned)
72 if (!slot || (slot ==
this))
99 return obj->InheritsFrom(
GetClass());
109 return cl->InheritsFrom(
GetClass());
123 return conn->SetObject(iObject, iOwned, CheckClass);
125 if (CheckClass && iObject)
126 if (!iObject->InheritsFrom(
GetClass()))
147 if (obj && obj->InheritsFrom(TNamed::Class()))
148 return obj->GetName();
157 return obj->Clone(newname);
164 std::cout <<
"Slot: " << GetName() <<
" for class: " <<
fxClass->GetName() <<
" needed:" <<
fbNeeded
167 std::cout <<
" Connected to: " << std::endl <<
" ";
171 if (((strcmp(option,
"**") == 0) &&
fbOwned) || (strcmp(option,
"***") == 0))
174 std::cout <<
" no object. " << std::endl;
180 TNamed *master =
dynamic_cast<TNamed *
>(
GetOwner());
203void TGo4FitSlot::Streamer(TBuffer &b)
207 TGo4FitSlot::Class()->ReadBuffer(b,
this);
211 Bool_t saveflag = kFALSE;
216 if (
fxObject->InheritsFrom(TH1::Class()))
217 ((TH1 *)
fxObject)->SetDirectory(
nullptr);
218 else if (
fxObject->InheritsFrom(TGo4FitSlot::Class()))
224 TGo4FitSlot::Class()->WriteBuffer(b,
this);
226 Bool_t saveflag = kFALSE;
227 Bool_t saveown = kFALSE;
295 return (nslot >= 0) && (nslot <= lst->GetLast()) ?
dynamic_cast<TGo4FitSlot *
>(lst->At(nslot)) :
nullptr;
301 for (Int_t i = 0; i <= lst->GetLast(); i++) {
303 if (slot && (strcmp(slot->
GetFullName(), FullSlotName) == 0))
311 if (!slot1 || !slot2)
328 for (Int_t i = 0; i <= lst->GetLast(); i++) {
351 TGo4FitSlot *firstempty =
nullptr, *last =
nullptr;
354 for (Int_t i = 0; i <= lst->GetLast(); i++) {
368 if (slot->
IsEmpty() && !firstempty)
376 }
else if ((count == 1) && last) {
377 last->SetObject(obj, iOwned);
393 for (Int_t i = 0; i <= lst->GetLast(); i++) {
410 for (Int_t i = 0; i <= lst->GetLast(); i++) {
416 std::cout <<
"Required data not provided" << std::endl
417 <<
" Name: " << slot->GetName() << std::endl
418 <<
" Class: " << slot->
GetClass()->GetName() << std::endl
419 <<
" Description: " << slot->GetTitle() << std::endl
431 for (Int_t i = 0; i <= lst->GetLast(); i++) {
445 for (Int_t i = 0; i <= lst->GetLast(); i++) {
450 if (PlaceName && (strcmp(slot->
GetFullName(), PlaceName) != 0) &&
470 if (NonOwned || !owned) {
476 for (Int_t i = 0; i <
NumSlots(); i++) {
494 for (Int_t i = 0; i <= lst->GetLast(); i++) {
499 if (PlaceName && (strcmp(slot->
GetFullName(), PlaceName) != 0) &&
511 for (Int_t n1 = lst->GetLast(); n1 > 0; n1--) {
515 for (Int_t n2 = n1 - 1; n2 >= 0; n2--) {
529 for (Int_t n1 = 0; n1 <= lst->GetLast(); n1++) {
535 for (Int_t n1 = 0; n1 <= lst->GetLast(); n1++) {
552 Bool_t isobjsaved = kFALSE, isobjowned = kFALSE;
554 for (Int_t n2 = 0; n2 <= lst->GetLast(); n2++) {
570 for (Int_t n2 = 0; n2 <= lst->GetLast(); n2++) {
584 if (isobjsaved && !isobjowned)
void SetOwner(TNamed *iOwner)
Sets owner of object.
const char * GetOwnerFullName()
Return full name of owner.
TNamed * GetOwner()
Return owner of object.
TGo4FitNamed()
Default constructor.
const char * GetFullName()
Returns full name of object.
virtual void FillSlotList(TSeqCollection *lst)
Fill list of TGo4FitSlot objects to provided collection.
TGo4FitSlot * FindSlot(const char *FullSlotName)
Find slot in list with given full name;.
void ClearSlot(TGo4FitSlot *slot, Bool_t NonOwned)
Clear object in specified slot.
TGo4FitSlot * SetObject(TObject *obj, Bool_t iOwned=kFALSE)
Set object to first suitable slot with defined ownership flag.
Bool_t ConnectSlots(TGo4FitSlot *slot1, TGo4FitSlot *slot2)
Connects first slot to second.
void PrepareSlotsForWriting()
void CheckDuplicatesOnSlot()
Resolve situation, when same object assigned to several slots with ownership flag.
Int_t NumSlots()
Returns number of slots in list.
void SetSaveFlagForObjects(Int_t iSaveFlag, const char *PlaceName=nullptr)
Set save flag for object(s), assigned to fitter.
Bool_t IsEmptySlots()
Return kTRUE, if there are empty slots in list.
virtual ~TGo4FitSlotList()
TGo4FitSlot * GetSlot(Int_t nslot)
Returns slots from list with specified index.
void SetUpdateSlotList()
Update internal list of slots (if exists).
Bool_t CheckObjects(Bool_t MakeOut=kTRUE)
Check, if all necessary objects are provided.
TGo4FitSlot * IsObjectInSlots(TObject *obj)
Checks, if object assign to one of slots.
void ClearObjects(const char *PlaceName=nullptr, Bool_t NonOwned=kTRUE)
Clear object from slot(s), which are defined by PlaceName condition.
const TObjArray * GetSlotList(Bool_t ForceUpdate=kFALSE)
Return pointer in TObjArray with list of all slots in list.
Managing pointers on specific objects.
Bool_t fbConnected
If object is connected slot.
const char * GetObjectName() const
Return name of assigned object.
Bool_t fbOwned
0 - slot save if owned(default), 1 - saved always, 2 - saved never
void ClearConnectionToSlot()
Clear connection to other slot.
TGo4FitSlot * GetConnectedSlot() const
Returns pointer to connected slot or 0, if not connected.
TClass * GetClass() const
Return pointer on class for desired object.
TObject * CloneObject(const char *newname=nullptr)
Clone object in slot and returns pointer on new object.
Bool_t IsEmpty() const
Return kTRUE, if no object in slot.
Bool_t fbNeeded
Flag, is this object should always be set.
TClass * fxClass
Class of object, which should be assigned to slot.
Bool_t IsSuitableClass(TClass *cl) const
Checks, if class corresponds to specified for slot.
Bool_t IsRequired() const
Returns kTRUE, if object required, but not yet set.
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...
TObject * fxObject
Pointer on assigned object.
Bool_t ConnectToSlot(TGo4FitSlot *slot)
Connect this slot to provided slot.
void Print(Option_t *option="") const override
Print information on standard output.
void CheckOwnership()
Sets up ownership relation between object and owner of slot.
Bool_t GetOwned() const
Return ownership flag.
Bool_t IsSuitable(TObject *obj) const
Checks, if object class corresponds to class, specified for slot.
virtual ~TGo4FitSlot()
Destroys TFo4FitSlot object.
Int_t fiSaveFlag
Describe saving of object in slot.
Bool_t CanConnectToSlot(TGo4FitSlot *slot)
Checks, if slot can be connected to other.
void SetDefaults(TNamed *iOwner, TClass *iClass)
Set basic fields of slot.
TGo4FitSlot()
Default constructor.
void Clear(Option_t *="") override
Clear pointer on object in slot.
void SetOwned(Bool_t iOwned=kTRUE)
Explicitly sets ownership flag.
Bool_t IsConnectedToSlot() const
Returns kTRUE, if slot connected to another slot.
void SetSaveSettings(Int_t save=-1, Int_t own=-1)
Bool_t SetObject(TObject *iObject, Bool_t iOwned=kFALSE, Bool_t CheckClass=kTRUE)
Sets object to slot.
void ClearObject()
Method remove object pointer.
TObject * GetObject() const
Return pointer on assigned object.