21 #include "TObjArray.h"
49 TNamed* iOwner, TClass* iClass,
50 Bool_t iNeeded, TObject* iObject, Bool_t iOwned) :
85 if ((slot==0) || (slot==
this))
return kFALSE;
89 if (conn ==
this)
return kFALSE;
103 if (obj==0)
return kFALSE;
105 else return obj->InheritsFrom(
GetClass());
110 if (cl==0)
return kFALSE;
112 else return cl->InheritsFrom(
GetClass());
126 if (CheckClass && iObject)
127 if (!iObject->InheritsFrom(
GetClass()))
return kFALSE;
145 if (obj && obj->InheritsFrom(TNamed::Class()))
return obj->GetName();
152 if (obj)
return obj->Clone(newname);
158 std::cout <<
"Slot: " << GetName() <<
" for class: " <<
fxClass->GetName()
161 std::cout <<
" Connected to: " << std::endl <<
" ";
166 if (((strcmp(option,
"**")==0) && fbOwned) || (strcmp(option,
"***")==0))
169 std::cout <<
" no object. " << std::endl;
175 TNamed* master =
dynamic_cast<TNamed*
> (
GetOwner());
177 if (master && slave) slave->
SetOwner(master);
197 void TGo4FitSlot::Streamer(TBuffer& b)
201 TGo4FitSlot::Class()->ReadBuffer(b,
this);
205 Bool_t saveflag = kFALSE;
210 if (fxObject->InheritsFrom(TH1::Class()))
216 TGo4FitSlot::Class()->WriteBuffer(b,
this);
218 Bool_t saveflag = kFALSE;
219 Bool_t saveown = kFALSE;
283 return (nslot>=0) && (nslot<=lst->GetLast()) ? dynamic_cast<TGo4FitSlot*> (lst->At(nslot)) : 0;
289 for(Int_t i=0;i<=lst->GetLast();i++) {
291 if (slot && (strcmp(slot->
GetFullName(), FullSlotName)==0))
return slot;
298 if ((slot1==0) || (slot2==0))
return kFALSE;
309 if (obj==0)
return 0;
313 for(Int_t i=0;i<=lst->GetLast();i++) {
315 if (slot==0)
continue;
327 if (obj==0)
return 0;
329 if (PlaceName==0)
return SetObject(obj, iOwned);
336 for(Int_t i=0;i<=lst->GetLast();i++) {
338 if ((slot==0) || !slot->
IsSuitable(obj))
continue;
340 if (strcmp(slot->
GetFullName(),PlaceName)==0) { firstempty = slot; count = 1;
break; }
345 if (slot->
IsEmpty() && (firstempty==0)) firstempty = slot;
353 if ((count==1) && (last!=0)) {
363 if (obj==0)
return 0;
369 for(Int_t i=0;i<=lst->GetLast();i++) {
371 if (slot==0)
continue;
384 for(Int_t i=0;i<=lst->GetLast();i++) {
386 if (slot==0)
continue;
389 std::cout <<
"Required data not provided" << std::endl <<
390 " Name: " << slot->GetName() << std::endl <<
391 " Class: " << slot->
GetClass()->GetName() << std::endl <<
392 " Description: " << slot->GetTitle() << std::endl <<
404 for(Int_t i=0;i<=lst->GetLast();i++) {
406 if (slot==0)
continue;
407 if (slot->
IsEmpty())
return kTRUE;
417 for(Int_t i=0;i<=lst->GetLast();i++) {
419 if (slot==0)
continue;
421 if ((PlaceName!=0) &&
439 if (NonOwned || !owned) {
440 if (!owned) slot->
Clear();
461 for(Int_t i=0;i<=lst->GetLast();i++) {
463 if (slot==0)
continue;
465 if ((PlaceName!=0) &&
477 for(Int_t n1=lst->GetLast();n1>0;n1--) {
480 for(Int_t n2=n1-1;n2>=0;n2--) {
493 for(Int_t n1=0; n1<=lst->GetLast(); n1++) {
498 for(Int_t n1=0; n1<=lst->GetLast(); n1++) {
514 Bool_t isobjsaved = kFALSE;
515 Bool_t isobjowned = kFALSE;
517 for(Int_t n2=0; n2<=lst->GetLast(); n2++) {
525 if (isobjowned) slot2->
SetOwned(kFALSE);
526 else isobjowned = kTRUE;
531 for(Int_t n2=0; n2<=lst->GetLast(); n2++) {
542 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
const char * GetObjectName() const
TGo4FitSlot * SetObject(TObject *obj, Bool_t iOwned=kFALSE)
TGo4FitSlot * GetSlot(Int_t nslot)
TGo4FitSlot * IsObjectInSlots(TObject *obj)
void ClearConnectionToSlot()
virtual void Clear(Option_t *="")
virtual ~TGo4FitSlotList()
const char * GetFullName()
void ClearSlot(TGo4FitSlot *slot, Bool_t NonOwned)
void SetSaveFlag(Int_t iSaveFlag)
void SetOwner(TNamed *iOwner)
Bool_t IsConnectedToSlot() const
void SetSaveFlagForObjects(Int_t iSaveFlag, const char *PlaceName=0)
void PrepareSlotsForWriting()
const TObjArray * GetSlotList(Bool_t ForceUpdate=kFALSE)
Bool_t ConnectSlots(TGo4FitSlot *slot1, TGo4FitSlot *slot2)
Bool_t IsRequired() const
Bool_t IsSuitableClass(TClass *cl)
TGo4FitSlot * GetConnectedSlot() const
void CheckDuplicatesOnSlot()
Bool_t SetObject(TObject *iObject, Bool_t iOwned=kFALSE, Bool_t CheckClass=kTRUE)
virtual void FillSlotList(TSeqCollection *lst)
Bool_t CheckObjects(Bool_t MakeOut=kTRUE)
Bool_t ConnectToSlot(TGo4FitSlot *slot)
TObject * CloneObject(const char *newname=0)
const char * GetOwnerFullName()
void SetDefaults(TNamed *iOwner, TClass *iClass)
Bool_t IsSuitable(TObject *obj)
TObject * GetObject() const
TGo4FitSlot * FindSlot(const char *FullSlotName)
void SetOwned(Bool_t iOwned=kTRUE)
virtual void Print(Option_t *option) const
void ClearObjects(const char *PlaceName=0, Bool_t NonOwned=kTRUE)
Bool_t CanConnectToSlot(TGo4FitSlot *slot)