// A RooList is a TList with extra support for working with options
// that are associated with each node. This is a utility class for RooPlot
// END_HTML
#include "RooFit.h"
#include "RooList.h"
#include "RooList.h"
#include "RooMsgService.h"
#include "Riostream.h"
ClassImp(RooList)
TObjOptLink *RooList::findLink(const char *name, const char *caller) const
{
if(0 == strlen(name)) return 0;
TObjLink *link = FirstLink();
while (link) {
TObject *obj= link->GetObject();
if (obj->GetName() && !strcmp(name, obj->GetName())) break;
link = link->Next();
}
if(0 == link) {
if(strlen(caller)) {
coutE(InputArguments) << caller << ": cannot find object named \"" << name << "\"" << endl;
}
return 0;
}
return dynamic_cast<TObjOptLink*>(link);
}
Bool_t RooList::moveBefore(const char *before, const char *target, const char *caller)
{
TObjOptLink *targetLink= findLink(target,caller);
if(0 == targetLink) return kFALSE;
TObjOptLink *beforeLink= findLink(before,caller);
if(0 == beforeLink) return kFALSE;
TObject *obj= targetLink->GetObject();
TString opt= targetLink->GetOption();
Remove(targetLink);
if(beforeLink == fFirst) {
RooList::AddFirst(obj, opt.Data());
}
else {
NewOptLink(obj, opt.Data(), beforeLink->Prev());
fSize++;
Changed();
}
return kTRUE;
}
Bool_t RooList::moveAfter(const char *after, const char *target, const char *caller)
{
TObjOptLink *targetLink= findLink(target,caller);
if(0 == targetLink) return kFALSE;
TObjOptLink *afterLink= findLink(after,caller);
if(0 == afterLink) return kFALSE;
TObject *obj= targetLink->GetObject();
TString opt= targetLink->GetOption();
Remove(targetLink);
if(afterLink == fLast) {
RooList::AddLast(obj, opt.Data());
}
else {
NewOptLink(obj, opt.Data(), afterLink);
fSize++;
Changed();
}
return kTRUE;
}
Last change: Wed Jun 25 08:33:22 2008
Last generated: 2008-06-25 08:33
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.