8 enum {kBelongs = BIT(22)};
12 void
StObjLink::Browse(TBrowser* b) {b->Add(fLink);}
14 void StObjLink::Streamer(TBuffer &R__b)
17 if (R__b.IsReading()) {
24 StXRefManager::fgManager->AddColl(urr);
27 const static UInt_t kMustBeOne = kIsOnHeap | kNotDeleted;
28 const static UInt_t kMustBeZero = kCanDelete | kObjInCanvas | kHasUUID
29 | kCannotPick| kNoContextMenu| kZombie;
30 if (!fLink || fLink->TestBits(kMustBeZero|kMustBeOne) !=(int)kMustBeOne)
32 if (!fLink) R__b << UInt_t(0);
33 else fLink->Ztreamer(R__b);
45 for (
int i=0;i<sz;i++)
49 if (to->IsZombie())
continue;
55 TObject** StObjArray::Erase(TObject** it,
int del)
58 if (del) {
delete fV[i]; fV[i]=0;}
59 return &(*(fV.erase(fV.begin()+i)));
62 TObject** StObjArray::Erase(TObject** fst,TObject** lst,
int del)
64 int ifst = fst-&fV[0];
65 int ilst = lst-&fV[0];
66 if (del) {
for (
int i=ifst;i<ilst;i++) {
delete fV[i];fV[i]=0;}}
67 return &(*(fV.erase(fV.begin()+ifst,fV.begin()+ilst)));
70 TObject* StObjArray::find(
const char *name)
const
73 for (
int i=0;i<n;i++) {
75 if (!strcmp(name,fV[i]->GetName()))
return (TObject*)fV[i];
80 void StObjArray::Streamer(TBuffer &b)
87 Version_t v = b.ReadVersion();
if (v){}
90 if (!nobjects)
return;
93 for (Int_t i = 0; i < nobjects; i++) {
94 b >> obj; fV[i] =(obj);}
96 b.WriteVersion(Class());
97 nobjects = getEntries();
100 for (Int_t i = 0; nobjects; i++) {
102 if (to && !to->IsZombie()) {b << to; nobjects--;}
110 void StObjArray::Browse(TBrowser *b)
112 enum { maxBrowsable = 5000};
122 Int_t totalSize = size();
123 for (
int i=0; i<totalSize && ++counter < maxBrowsable ; i++) {
124 obj = at(i);
if (!obj || ((ULong_t)obj)&1)
continue;
125 TString browseName(obj->GetName());
126 if (browseName.IsNull()) browseName = obj->ClassName();
128 sprintf(buffer,
"_%d(%d)",counter,totalSize);
129 browseName += buffer;
130 b->Add(obj,browseName.Data());
134 Bool_t StObjArray::IsFolder()
const
138 void StObjArray::random_shuffle(
int start,
int end)
142 if (start >= lst)
return;
143 if (end > lst) end = lst;
144 ::random_shuffle(begin()+start,begin()+end);
148 void StObjArray::ls(
const char *tit)
const
152 Info(
"ls",
"%s(%s)[%d]",ClassName(),tit,n);
153 for (
int i=0;i<n;i++) {
154 TObject *to = fV[i];
if (!to)
continue;
155 printf(
"%4d - %p %s(%s)\n",i, (
void*)to,to->ClassName(),to->GetName());
165 void StRefArray::Streamer(TBuffer &R__b)
171 if (R__b.IsReading()) {
172 Version_t v = R__b.ReadVersion();
if (v){}
175 if (!nobjects)
return;
176 if (v <=2 || nobjects>0) {
178 for (Int_t i = 0; i < nobjects; i++) {
179 R__b >> obj; push_back(obj);}
182 nobjects = -nobjects;
184 for (Int_t i = 0; i < nobjects; i++) {
185 R__b >> ubj ; urr->push_back(ubj);
187 StXRefManager::fgManager->AddColl(urr);
191 R__b.WriteVersion(Class());
192 int nobjs = nobjects = getEntries();
193 if (StObject::fgTally) nobjs=-nobjs;
195 if (!nobjects)
return;
197 for (Int_t i = 0; nobjects; i++) {
200 if (to->IsZombie())
continue;
202 if (nobjs<0) {((
StObject*)to)->Ztreamer(R__b);}
213 void StStrArray::operator=(
const StStrArray &a)
215 int n,i; TObject *sto;
223 if (sto) sto = ((
StObject*)sto)->clone();
224 sto->ResetBit(kBelongs);
229 StStrArray::StStrArray(
const StStrArray &from){ *
this = from;}
231 void StStrArray::clear()
233 assert(!fV.size() || !fV[0] || ((TObject*)fV[0])->TestBit(TObject::kNotDeleted));
240 if (to->TObject::TestBit(TObject::kNotDeleted)) {
243 Warning(
"clear",
"Object[%d]=%p is already deleted",i,to);
246 mk = StMkDeb::GetName(StMkDeb::GetCurrent());
247 if (mk && *mk) printf(
"*** Now we are in %s ***\n",mk);
248 mk = StMkDeb::GetUser(to);
249 if (mk && *mk) printf(
"*** It was deleted in maker %s ***\n",mk);
257 StStrArray::~StStrArray()
262 void StStrArray::put_at(TObject *obj,
int i)
264 assert(i>=0 && i<
int(size()));
266 if (fV[i]==obj)
return;
267 assert(!obj->TestBit(kBelongs) && obj->TestBit(TObject::kNotDeleted));
268 obj->SetBit(kBelongs);
272 void StStrArray::push_back(
const TObject *
const to)
274 TObject* obj = (TObject*)to;
276 assert(!obj->TestBit(kBelongs) && obj->TestBit(TObject::kNotDeleted));
277 obj->SetBit(kBelongs);
284 void StStrArray::Streamer(TBuffer &R__b)
287 if (R__b.IsReading()) {
288 Version_t R__v = R__b.ReadVersion();
if (R__v) { }
289 StObjArray::Streamer(R__b);
291 StXRefManager::fgManager->AddColl(
this);
293 R__b.WriteVersion(Class());
294 StObjArray::Streamer(R__b);
299 void StStrArray::makeZombie(
int flg)
301 StObject::makeZombie(flg);
303 for (
int i=0;i<n;i++)