1 |
loizides |
1.1 |
//--------------------------------------------------------------------------------------------------
|
2 |
loizides |
1.7 |
// $Id: Collection.h,v 1.6 2008/12/10 11:26:52 loizides Exp $
|
3 |
loizides |
1.1 |
//
|
4 |
|
|
// Collection
|
5 |
|
|
//
|
6 |
|
|
// Unification of read access to a collection of objects (ArrayElements).
|
7 |
|
|
//
|
8 |
|
|
// Authors: C.Loizides
|
9 |
|
|
//--------------------------------------------------------------------------------------------------
|
10 |
|
|
|
11 |
loizides |
1.2 |
#ifndef MITANA_DATACONT_COLLECTION_H
|
12 |
|
|
#define MITANA_DATACONT_COLLECTION_H
|
13 |
loizides |
1.1 |
|
14 |
|
|
#include "MitAna/DataCont/interface/BaseCollection.h"
|
15 |
|
|
|
16 |
|
|
namespace mithep
|
17 |
|
|
{
|
18 |
|
|
template<class ArrayElement>
|
19 |
|
|
class Collection : public BaseCollection
|
20 |
|
|
{
|
21 |
|
|
public:
|
22 |
|
|
Collection() {}
|
23 |
|
|
|
24 |
loizides |
1.6 |
virtual ArrayElement *At(UInt_t idx) = 0;
|
25 |
|
|
virtual const ArrayElement *At(UInt_t idx) const = 0;
|
26 |
|
|
virtual UInt_t GetEntries() const = 0;
|
27 |
|
|
virtual UInt_t GetSize() const = 0;
|
28 |
bendavid |
1.4 |
virtual Bool_t HasObject(const ArrayElement *obj) const = 0;
|
29 |
loizides |
1.6 |
virtual Bool_t IsOwner() const = 0;
|
30 |
|
|
void Print(Option_t *opt="") const;
|
31 |
|
|
virtual void Reset() = 0;
|
32 |
|
|
virtual void Trim() = 0;
|
33 |
|
|
virtual ArrayElement *UncheckedAt(UInt_t idx) = 0;
|
34 |
|
|
virtual const ArrayElement *UncheckedAt(UInt_t idx) const = 0;
|
35 |
|
|
virtual ArrayElement *operator[](UInt_t idx) = 0;
|
36 |
|
|
virtual const ArrayElement *operator[](UInt_t idx) const = 0;
|
37 |
loizides |
1.1 |
|
38 |
loizides |
1.7 |
ClassDef(Collection, 1) // Generic access to a collection of ArrayElements
|
39 |
loizides |
1.1 |
};
|
40 |
|
|
}
|
41 |
loizides |
1.3 |
|
42 |
|
|
//--------------------------------------------------------------------------------------------------
|
43 |
|
|
template<class ArrayElement>
|
44 |
loizides |
1.5 |
void mithep::Collection<ArrayElement>::Print(Option_t */*opt*/) const
|
45 |
loizides |
1.3 |
{
|
46 |
loizides |
1.6 |
// Print information about this collection.
|
47 |
|
|
|
48 |
loizides |
1.3 |
printf("%s: Contains %d (out of %d) objs\n",
|
49 |
|
|
GetName(), GetEntries(), GetSize());
|
50 |
|
|
}
|
51 |
loizides |
1.1 |
#endif
|