Updated buffer handling with mutex and faster response
[u/mrichter/AliRoot.git] / EVE / EveHLT / AliEveHOMERSourceMap.h
CommitLineData
a15e6d7d 1// $Id$
2// Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3
4/**************************************************************************
5 * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
6 * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
7 * full copyright notice. *
8 **************************************************************************/
9
10#ifndef AliEveAliEveHOMERSourceMap_H
11#define AliEveAliEveHOMERSourceMap_H
12
13#include "AliEveHOMERSource.h"
14
15#include <TNamed.h>
16
17#include <map>
18
ca8fb7ae 19//______________________________________________________________________________
20//
21// AliEveHOMERSourceMap is an abstract container for HLT HOMER sources.
22// The concrete implementations AliEveHOMERSourceMapByDet and
23// AliEveHOMERSourceMapByType allow retrieval of HOMER sources in proper
24// order as required for their display in EVE object browser.
25
26
a15e6d7d 27class AliEveHOMERSourceMap : public TNamed
28{
29protected:
4b456ebb 30 // --- Inner structs ---
31
a15e6d7d 32 struct iterator_imp_base
33 {
34 virtual ~iterator_imp_base() {}
35
25c3aaf7 36 virtual const AliEveHOMERSource::SourceId& id() const = 0;
37 virtual const AliEveHOMERSource::SourceState& state() const = 0;
a15e6d7d 38 virtual AliEveHOMERSource::SourceState& state() = 0;
39
25c3aaf7 40 virtual iterator_imp_base* clone() const = 0;
a15e6d7d 41
42 virtual iterator_imp_base& operator++() = 0;
25c3aaf7 43 virtual bool operator!=(const iterator_imp_base& o) const = 0;
a15e6d7d 44
25c3aaf7 45 virtual TString description() const = 0;
a15e6d7d 46 };
47
48public:
4b456ebb 49 // --- Inner structs ---
50
a15e6d7d 51 struct iterator
52 {
53 iterator_imp_base* m_imp;
54
55 iterator() : m_imp(0) {}
c61a7285 56 iterator(const iterator& it) : m_imp(it.m_imp->clone()) {}
a15e6d7d 57 iterator(iterator_imp_base* imp) : m_imp(imp) {}
58 ~iterator() { delete m_imp; }
59
60 iterator& operator= (const iterator& o) { delete m_imp; m_imp = o.m_imp->clone(); return *this; }
61 bool operator!=(const iterator& o) { return m_imp->operator!=(*o.m_imp); }
62
63 const AliEveHOMERSource::SourceId& id() { return m_imp->id(); }
64 AliEveHOMERSource::SourceState& state() { return m_imp->state(); }
65
66 Int_t level();
67 TString description() { return m_imp->description(); }
68
69 iterator& operator++() { m_imp->operator++(); return *this; }
70 iterator& skip_children()
71 {
72 Int_t lvl = level();
73 do operator++(); while (level() > lvl);
74 return *this;
75 }
76 };
77
78 iterator begin() { return iterator(iterator_imp_begin()); }
79 iterator end() { return iterator(iterator_imp_end()); }
4b456ebb 80
a15e6d7d 81 enum ESourceGrouping_e { kSG_ByDet, kSG_ByType };
82
4b456ebb 83 // --- Interface ---
a15e6d7d 84
a15e6d7d 85 AliEveHOMERSourceMap(ESourceGrouping_e grouping);
86 virtual ~AliEveHOMERSourceMap() {}
87
88 static AliEveHOMERSourceMap* Create(ESourceGrouping_e grouping);
89
ca8fb7ae 90 virtual void FillMap(const TList* handles, Bool_t def_state) = 0;
a15e6d7d 91
92 void PrintXXX();
93
4b456ebb 94
95protected:
96 ESourceGrouping_e fGrouping; // Not used so far ...
97
98 virtual iterator_imp_base* iterator_imp_new() = 0; // Not used so far ...
99 virtual iterator_imp_base* iterator_imp_begin() = 0;
100 virtual iterator_imp_base* iterator_imp_end() = 0;
101
102 ClassDef(AliEveHOMERSourceMap, 0); // A map of HOMER sources.
a15e6d7d 103};
104
a15e6d7d 105
f65a2da1 106// Include concrete implementations (used to be in the same file).
a15e6d7d 107
f65a2da1 108#include "AliEveHOMERSourceMapByDet.h"
109#include "AliEveHOMERSourceMapByType.h"
a15e6d7d 110
a15e6d7d 111
112#endif