Updated buffer handling with mutex and faster response
[u/mrichter/AliRoot.git] / EVE / EveHLT / AliEveHOMERSourceMap.cxx
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#include "AliEveHOMERSourceMap.h"
a15e6d7d 11
12//______________________________________________________________________
a15e6d7d 13//
ca8fb7ae 14// AliEveHOMERSourceMap is an abstract container for HLT HOMER sources,
15// see AliHLTHOMERSourceDesc.
16//
17// The concrete implementations AliEveHOMERSourceMapByDet and
18// AliEveHOMERSourceMapByType allow retrieval of HOMER sources in proper
19// order as required for their display in EVE object browser.
20//
a15e6d7d 21
22ClassImp(AliEveHOMERSourceMap)
23
24AliEveHOMERSourceMap::AliEveHOMERSourceMap(ESourceGrouping_e grouping) :
25 fGrouping(grouping)
26{
ca8fb7ae 27 // Constructor.
a15e6d7d 28}
29
30AliEveHOMERSourceMap* AliEveHOMERSourceMap::Create(ESourceGrouping_e grouping)
31{
ca8fb7ae 32 // Static constructor - instantiates appropriate sub-class.
33
a15e6d7d 34 switch (grouping)
35 {
36 case kSG_ByDet: return new AliEveHOMERSourceMapByDet(grouping);
37 case kSG_ByType: return new AliEveHOMERSourceMapByType(grouping);
38 }
39 return 0;
40}
41
42Int_t AliEveHOMERSourceMap::iterator::level()
43{
ca8fb7ae 44 // Returns the depth in iteration:
45 // Det / Sub-Det / Sub-Sub-Det / Data-Type.
46
a15e6d7d 47 const AliEveHOMERSource::SourceId& sid = id();
48
49 Int_t lvl = 0;
50 if ( ! sid.fDet.IsNull()) ++lvl;
51 if ( ! sid.fSDet.IsNull()) ++lvl;
52 if ( ! sid.fSSDet.IsNull()) ++lvl;
53 if ( ! sid.fType.IsNull()) ++lvl;
54 return lvl;
55}
56
57void AliEveHOMERSourceMap::PrintXXX()
58{
ca8fb7ae 59 // Print entries in the map.
60
a15e6d7d 61 for (iterator i = begin(); i != end(); ++i)
62 {
63 printf("%*s%s [state=%d, handle=0x%lx] {ssdet='%s'}\n", 4*i.level(), "",
64 i.description().Data(), i.state().fState,
65 (ULong_t) i.state().fHandle,
66 i.id().fSSDet.Data());
67 }
68}