16 #include "Riostream.h"
21 #include "TSeqCollection.h"
22 #include "TObjArray.h"
50 TNamed* iOwner, TClass* iClass,
51 Bool_t iNeeded, TObject* iObject, Bool_t iOwned) :
86 if ((slot==0) || (slot==
this))
return kFALSE;
90 if (conn ==
this)
return kFALSE;
104 if (obj==0)
return kFALSE;
106 else return obj->InheritsFrom(
GetClass());
111 if (cl==0)
return kFALSE;
113 else return cl->InheritsFrom(
GetClass());
127 if (CheckClass && iObject)
128 if (!iObject->InheritsFrom(
GetClass()))
return kFALSE;
146 if (obj && obj->InheritsFrom(TNamed::Class()))
return obj->GetName();
153 if (obj)
return obj->Clone(newname);
159 std::cout <<
"Slot: " << GetName() <<
" for class: " <<
fxClass->GetName()
162 std::cout <<
" Connected to: " << std::endl <<
" ";
167 if (((strcmp(option,
"**")==0) && fbOwned) || (strcmp(option,
"***")==0))
170 std::cout <<
" no object. " << std::endl;
176 TNamed* master =
dynamic_cast<TNamed*
> (
GetOwner());
178 if (master && slave) slave->
SetOwner(master);
198 void TGo4FitSlot::Streamer(TBuffer& b)
202 TGo4FitSlot::Class()->ReadBuffer(b,
this);
206 Bool_t saveflag = kFALSE;
211 if (fxObject->InheritsFrom(TH1::Class()))
217 TGo4FitSlot::Class()->WriteBuffer(b,
this);
219 Bool_t saveflag = kFALSE;
220 Bool_t saveown = kFALSE;
284 return (nslot>=0) && (nslot<=lst->GetLast()) ? dynamic_cast<TGo4FitSlot*> (lst->At(nslot)) : 0;
290 for(Int_t i=0;i<=lst->GetLast();i++) {
292 if (slot && (strcmp(slot->
GetFullName(), FullSlotName)==0))
return slot;
299 if ((slot1==0) || (slot2==0))
return kFALSE;
310 if (obj==0)
return 0;
314 for(Int_t i=0;i<=lst->GetLast();i++) {
316 if (slot==0)
continue;
328 if (obj==0)
return 0;
330 if (PlaceName==0)
return SetObject(obj, iOwned);
337 for(Int_t i=0;i<=lst->GetLast();i++) {
339 if ((slot==0) || !slot->
IsSuitable(obj))
continue;
341 if (strcmp(slot->
GetFullName(),PlaceName)==0) { firstempty = slot; count = 1;
break; }
346 if (slot->
IsEmpty() && (firstempty==0)) firstempty = slot;
354 if ((count==1) && (last!=0)) {
364 if (obj==0)
return 0;
370 for(Int_t i=0;i<=lst->GetLast();i++) {
372 if (slot==0)
continue;
385 for(Int_t i=0;i<=lst->GetLast();i++) {
387 if (slot==0)
continue;
390 std::cout <<
"Required data not provided" << std::endl <<
391 " Name: " << slot->GetName() << std::endl <<
392 " Class: " << slot->
GetClass()->GetName() << std::endl <<
393 " Description: " << slot->GetTitle() << std::endl <<
405 for(Int_t i=0;i<=lst->GetLast();i++) {
407 if (slot==0)
continue;
408 if (slot->
IsEmpty())
return kTRUE;
418 for(Int_t i=0;i<=lst->GetLast();i++) {
420 if (slot==0)
continue;
422 if ((PlaceName!=0) &&
440 if (NonOwned || !owned) {
441 if (!owned) slot->
Clear();
462 for(Int_t i=0;i<=lst->GetLast();i++) {
464 if (slot==0)
continue;
466 if ((PlaceName!=0) &&
478 for(Int_t n1=lst->GetLast();n1>0;n1--) {
481 for(Int_t n2=n1-1;n2>=0;n2--) {
494 for(Int_t n1=0; n1<=lst->GetLast(); n1++) {
499 for(Int_t n1=0; n1<=lst->GetLast(); n1++) {
515 Bool_t isobjsaved = kFALSE;
516 Bool_t isobjowned = kFALSE;
518 for(Int_t n2=0; n2<=lst->GetLast(); n2++) {
526 if (isobjowned) slot2->
SetOwned(kFALSE);
527 else isobjowned = kTRUE;
532 for(Int_t n2=0; n2<=lst->GetLast(); n2++) {
543 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)