Class to hold information about the processed elements of a file.
Int_t ProcFileElements::ProcFileElement::Compare(
const TObject *o)
const
{
const ProcFileElements::ProcFileElement *
e =
dynamic_cast<const ProcFileElements::ProcFileElement *>(o);
return 0;
}
else if (fFirst < e->
fFirst) {
return -1;
} else {
return 1;
}
}
Int_t ProcFileElements::ProcFileElement::Overlapping(ProcFileElement *
e)
{
if (
fFirst == 0 && fLast == -1) {
return 1;
}
if (fLast >= 0) {
return -1;
} else {
if (fLast ==
e->fFirst - 1) {
return 0;
} else {
return 1;
}
}
} else {
return 1;
}
if (
fFirst == fLast ||
e->fFirst ==
e->fLast)
return 0;
return 1;
} else {
return -1;
} else {
return 0;
} else {
return 1;
}
}
} else {
return 1;
}
}
Warning(
"Overlapping",
"should never be here!");
return -1;
}
Int_t ProcFileElements::ProcFileElement::MergeElement(ProcFileElement *
e)
{
if (Overlapping(
e) < 0)
return -1;
if (fLast == -1 ||
e->fLast == -1) {
fLast = -1;
} else {
if (fLast < e->fLast) fLast =
e->fLast;
}
return 0;
}
void ProcFileElements::ProcFileElement::Print(
Option_t *)
const
{
}
{
if (!fElements) {
Error(
"Add",
"could not create internal list!");
return -1;
}
ProcFileElements::ProcFileElement *ne =
new ProcFileElements::ProcFileElement(fst, lst);
ProcFileElements::ProcFileElement *
e = 0;
while ((
e = (ProcFileElements::ProcFileElement *)nxe())) {
if (
e->MergeElement(ne) == 0)
break;
}
} else {
fElements->Add(ne);
rc = 1;
}
ProcFileElements::ProcFileElement *ep = 0, *en = 0;
TObjLink *olp = fElements->FirstLink(), *oln = 0;
while (olp && (ep = (ProcFileElements::ProcFileElement *) olp->
GetObject())) {
while (oln) {
if ((en = (ProcFileElements::ProcFileElement *) oln->GetObject())) {
if (ep->MergeElement(en) == 0) {
fElements->Remove(en);
delete en;
}
}
}
}
if ((
e = (ProcFileElements::ProcFileElement *) fElements->First()))
fFirst =
e->fFirst;
if ((
e = (ProcFileElements::ProcFileElement *) fElements->Last())) fLast =
e->fLast;
return rc;
}
void ProcFileElements::Print(
Option_t *)
const
{
Printf(
"--- ProcFileElements ----------------------------------------");
Printf(
" File: %s", fName.Data());
Printf(
" # proc elements: %d", fElements ? fElements->GetSize() : 0);
ProcFileElements::ProcFileElement *
e = 0;
while ((
e = (ProcFileElements::ProcFileElement *)nxe())) {
e->Print(); }
Printf(
"-------------------------------------------------------------");
}
{
if (!li) return -1;
ProcFileElements *pfe = 0;
while ((pfe = (ProcFileElements *) nxo())) {
if (strcmp(GetName(), pfe->GetName()))
Warning(
"Merge",
"merging objects of different name! ('%s' != '%s')",
GetName(), pfe->GetName());
TIter nxe(pfe->GetListOfElements());
ProcFileElements::ProcFileElement *
e = 0;
while ((
e = (ProcFileElements::ProcFileElement *)nxe())) {
if (rc == 1) nadd++;
}
}
return nadd;
}
Class to hold information about the processed elements of a file.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
void Printf(const char *fmt,...)
Formats a string in a circular formatting buffer and prints the string.
Collection abstract base class.
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
Wrapper around a TObject so it can be stored in a TList.
TObject * GetObject() const
Mother of all ROOT objects.
A sorted doubly linked list.
TMatrixT< Element > & Add(TMatrixT< Element > &target, Element scalar, const TMatrixT< Element > &source)
Modify addition: target += scalar * source.