#ifndef ROO_ABS_COLLECTION
#define ROO_ABS_COLLECTION
#include "TString.h"
#include "RooAbsArg.h"
#include "RooPrintable.h"
#include "RooLinkedList.h"
#include "RooCmdArg.h"
#include "RooLinkedListIter.h"
#include <string>
class RooAbsCollection : public TObject, public RooPrintable {
public:
RooAbsCollection();
RooAbsCollection(const char *name);
virtual TObject* clone(const char* newname) const = 0 ;
virtual TObject* create(const char* newname) const = 0 ;
virtual TObject* Clone(const char* newname=0) const {
return clone(newname?newname:GetName()) ;
}
virtual ~RooAbsCollection();
RooAbsCollection(const RooAbsCollection& other, const char *name="");
RooAbsCollection& operator=(const RooAbsCollection& other);
RooAbsCollection& assignValueOnly(const RooAbsCollection& other, Bool_t oneSafe=kFALSE) ;
void assignFast(const RooAbsCollection& other, Bool_t setValDirty=kTRUE) ;
RooAbsCollection *snapshot(Bool_t deepCopy=kTRUE) const ;
Bool_t snapshot(RooAbsCollection& output, Bool_t deepCopy=kTRUE) const ;
void setHashTableSize(Int_t i) {
_list.setHashTableSize(i) ;
}
Int_t getHashTableSize() const {
return _list.getHashTableSize() ;
}
virtual Bool_t add(const RooAbsArg& var, Bool_t silent=kFALSE) ;
virtual Bool_t addOwned(RooAbsArg& var, Bool_t silent=kFALSE);
virtual RooAbsArg *addClone(const RooAbsArg& var, Bool_t silent=kFALSE) ;
virtual Bool_t replace(const RooAbsArg& var1, const RooAbsArg& var2) ;
virtual Bool_t remove(const RooAbsArg& var, Bool_t silent=kFALSE, Bool_t matchByNameOnly=kFALSE) ;
virtual void removeAll() ;
virtual Bool_t add(const RooAbsCollection& list, Bool_t silent=kFALSE) ;
virtual Bool_t addOwned(const RooAbsCollection& list, Bool_t silent=kFALSE);
virtual void addClone(const RooAbsCollection& list, Bool_t silent=kFALSE);
Bool_t replace(const RooAbsCollection &other);
Bool_t remove(const RooAbsCollection& list, Bool_t silent=kFALSE, Bool_t matchByNameOnly=kFALSE) ;
void setAttribAll(const Text_t* name, Bool_t value=kTRUE) ;
RooAbsArg *find(const char *name) const ;
RooAbsArg *find(const RooAbsArg&) const ;
Bool_t contains(const RooAbsArg& var) const {
return (0 == find(var)) ? kFALSE:kTRUE;
}
Bool_t containsInstance(const RooAbsArg& var) const {
return (0 == _list.FindObject(&var)) ? kFALSE:kTRUE;
}
RooAbsCollection* selectByAttrib(const char* name, Bool_t value) const ;
RooAbsCollection* selectCommon(const RooAbsCollection& refColl) const ;
RooAbsCollection* selectByName(const char* nameList, Bool_t verbose=kFALSE) const ;
Bool_t equals(const RooAbsCollection& otherColl) const ;
Bool_t overlaps(const RooAbsCollection& otherColl) const ;
inline TIterator* createIterator(Bool_t dir = kIterForward) const {
return _list.MakeIterator(dir);
}
RooLinkedListIter iterator(Bool_t dir = kIterForward) const ;
RooFIter fwdIterator() const { return RooFIter(&_list); }
inline Int_t getSize() const {
return _list.GetSize();
}
inline RooAbsArg *first() const {
return (RooAbsArg*)_list.First();
}
inline virtual void Print(Option_t *options= 0) const {
printStream(defaultPrintStream(),defaultPrintContents(options),defaultPrintStyle(options));
}
std::string contentsString() const ;
virtual void printName(std::ostream& os) const ;
virtual void printTitle(std::ostream& os) const ;
virtual void printClassName(std::ostream& os) const ;
virtual void printValue(std::ostream& os) const ;
virtual void printMultiline(std::ostream& os, Int_t contents, Bool_t verbose=kFALSE, TString indent="") const ;
virtual Int_t defaultPrintContents(Option_t* opt) const ;
void printLatex(const RooCmdArg& arg1=RooCmdArg(), const RooCmdArg& arg2=RooCmdArg(),
const RooCmdArg& arg3=RooCmdArg(), const RooCmdArg& arg4=RooCmdArg(),
const RooCmdArg& arg5=RooCmdArg(), const RooCmdArg& arg6=RooCmdArg(),
const RooCmdArg& arg7=RooCmdArg(), const RooCmdArg& arg8=RooCmdArg()) const ;
void printLatex(std::ostream& ofs, Int_t ncol, const char* option="NEYU", Int_t sigDigit=1,
const RooLinkedList& siblingLists=RooLinkedList(), const RooCmdArg* formatCmd=0) const ;
void setName(const char *name) {
_name= name;
}
const char* GetName() const {
return _name.Data() ;
}
Bool_t isOwning() const {
return _ownCont ;
}
Bool_t allInRange(const char* rangeSpec) const ;
void dump() const ;
void releaseOwnership() { _ownCont = kFALSE ; }
void takeOwnership() { _ownCont = kTRUE ; }
void sort(Bool_t ascend=kTRUE) { _list.Sort(ascend) ; }
protected:
friend class RooMultiCatIter ;
RooLinkedList _list ;
Bool_t _ownCont;
TString _name;
Bool_t _allRRV ;
void safeDeleteList() ;
Bool_t addServerClonesToList(const RooAbsArg& var) ;
inline TNamed* structureTag() { if (_structureTag==0) makeStructureTag() ; return _structureTag ; }
inline TNamed* typedStructureTag() { if (_typedStructureTag==0) makeTypedStructureTag() ; return _typedStructureTag ; }
mutable TNamed* _structureTag ;
mutable TNamed* _typedStructureTag ;
inline void clearStructureTags() { _structureTag=0 ; _typedStructureTag = 0 ; }
void makeStructureTag() ;
void makeTypedStructureTag() ;
private:
ClassDef(RooAbsCollection,2)
};
#endif