21 #include "TObjArray.h" 24 :
TGo4FitNamed(), fxClass(nullptr), fiSaveFlag(0), fbOwned(kFALSE), fbNeeded(kFALSE), fxObject(nullptr),
25 fiSaveSlot(-1), fiSaveOwnership(-1)
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());
203 void 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;
251 fxSlotList =
nullptr;
252 fbUpdateSlotList = kFALSE;
259 fxSlotList =
nullptr;
271 fbUpdateSlotList = kTRUE;
277 fxSlotList =
new TObjArray(10);
278 FillSlotList(fxSlotList);
279 }
else if (fbUpdateSlotList || ForceUpdate) {
281 FillSlotList(fxSlotList);
283 fbUpdateSlotList = kFALSE;
289 return GetSlotList()->GetLast() + 1;
294 const TObjArray *lst = GetSlotList();
295 return (nslot >= 0) && (nslot <= lst->GetLast()) ? dynamic_cast<TGo4FitSlot *>(lst->At(nslot)) :
nullptr;
300 const TObjArray *lst = GetSlotList();
301 for (Int_t i = 0; i <= lst->GetLast(); i++) {
303 if (slot && (strcmp(slot->
GetFullName(), FullSlotName) == 0))
311 if (!slot1 || !slot2)
318 return ConnectSlots(FindSlot(Slot1FullName), FindSlot(Slot2FullName));
326 const TObjArray *lst = GetSlotList();
328 for (Int_t i = 0; i <= lst->GetLast(); i++) {
349 const TObjArray *lst = GetSlotList();
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) {
389 const TObjArray *lst = GetSlotList();
393 for (Int_t i = 0; i <= lst->GetLast(); i++) {
409 const TObjArray *lst = GetSlotList();
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
430 const TObjArray *lst = GetSlotList();
431 for (Int_t i = 0; i <= lst->GetLast(); i++) {
443 const TObjArray *lst = GetSlotList();
445 for (Int_t i = 0; i <= lst->GetLast(); i++) {
450 if (PlaceName && (strcmp(slot->
GetFullName(), PlaceName) != 0) &&
454 ClearSlot(slot, NonOwned);
470 if (NonOwned || !owned) {
476 for (Int_t i = 0; i < NumSlots(); i++) {
492 const TObjArray *lst = GetSlotList();
494 for (Int_t i = 0; i <= lst->GetLast(); i++) {
499 if (PlaceName && (strcmp(slot->
GetFullName(), PlaceName) != 0) &&
509 const TObjArray *lst = GetSlotList();
511 for (Int_t n1 = lst->GetLast(); n1 > 0; n1--) {
515 for (Int_t n2 = n1 - 1; n2 >= 0; n2--) {
527 const TObjArray *lst = GetSlotList();
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 SetSaveSettings(Int_t save=-1, Int_t own=-1)
Bool_t fbOwned
0 - slot save if owned(default), 1 - saved always, 2 - saved never
TGo4FitSlot * SetObject(TObject *obj, Bool_t iOwned=kFALSE)
void Print(Option_t *option="") const override
TGo4FitSlot * GetSlot(Int_t nslot)
TGo4FitSlot * IsObjectInSlots(TObject *obj)
void ClearConnectionToSlot()
virtual ~TGo4FitSlotList()
const char * GetFullName()
TObject * CloneObject(const char *newname=nullptr)
void ClearSlot(TGo4FitSlot *slot, Bool_t NonOwned)
void SetSaveFlag(Int_t iSaveFlag)
void SetOwner(TNamed *iOwner)
void PrepareSlotsForWriting()
const char * GetObjectName() const
const TObjArray * GetSlotList(Bool_t ForceUpdate=kFALSE)
Bool_t ConnectSlots(TGo4FitSlot *slot1, TGo4FitSlot *slot2)
TClass * GetClass() const
TGo4FitSlot * GetConnectedSlot() const
void CheckDuplicatesOnSlot()
Bool_t SetObject(TObject *iObject, Bool_t iOwned=kFALSE, Bool_t CheckClass=kTRUE)
Bool_t IsSuitable(TObject *obj) const
void ClearObjects(const char *PlaceName=nullptr, Bool_t NonOwned=kTRUE)
virtual void FillSlotList(TSeqCollection *lst)
Bool_t CheckObjects(Bool_t MakeOut=kTRUE)
Bool_t IsRequired() const
Bool_t ConnectToSlot(TGo4FitSlot *slot)
Bool_t IsConnectedToSlot() const
const char * GetOwnerFullName()
void SetDefaults(TNamed *iOwner, TClass *iClass)
void SetSaveFlagForObjects(Int_t iSaveFlag, const char *PlaceName=nullptr)
TObject * GetObject() const
void Clear(Option_t *="") override
TGo4FitSlot * FindSlot(const char *FullSlotName)
void SetOwned(Bool_t iOwned=kTRUE)
Bool_t IsSuitableClass(TClass *cl) const
Bool_t CanConnectToSlot(TGo4FitSlot *slot)