ATLAS Offline Software
Loading...
Searching...
No Matches
HanConfigMetadata.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
7
8//Get rid of Root macros that confuse Doxygen
12
13namespace dqi {
14
20
23 :TObject(other),
24 m_name(other.m_name)
25{
26 m_metadata = newTObjArray("metadata", 0, other.m_metadata->GetEntries());
27 TIter nextParMap( other.m_metadata );
28 HanConfigParMap* otherParMap;
29 while( (otherParMap = dynamic_cast<HanConfigParMap*>( nextParMap() )) != 0 ) {
30 HanConfigParMap* parMap = new HanConfigParMap( *otherParMap );
31 m_metadata->Add( parMap );
32 }
33}
34
37{
38 if (this == &other) return *this;
39
40 m_name = other.m_name;
41 m_metadata->Delete(); delete m_metadata;
42 m_metadata = newTObjArray("metadata", 0, other.m_metadata->GetEntries());
43 TIter nextParMap( other.m_metadata );
44 HanConfigParMap* otherParMap;
45 while( (otherParMap = dynamic_cast<HanConfigParMap*>( nextParMap() )) != 0 ) {
46 HanConfigParMap* parMap = new HanConfigParMap( *otherParMap );
47 m_metadata->Add( parMap );
48 }
49
50 return *this;
51}
52
58
59void
61SetName( std::string name_ )
62{
63 m_name.SetString(name_.c_str());
64}
65
66const char*
68GetName() const
69{
70 return m_name.GetName();
71}
72
73void
75AddKeyVal( const HanConfigParMap& keyval_ )
76{
77 HanConfigParMap* parMap = new HanConfigParMap( keyval_ );
78 m_metadata->Add( parMap );
79}
80
83GetKeyVal( std::string name_ ) const
84{
85 HanConfigParMap* parMap = dynamic_cast<HanConfigParMap*>( m_metadata->FindObject(name_.c_str()) );
86 if( parMap == 0 ) {
87 return HanConfigParMap();
88 }
89
90 return *parMap;
91}
92
93
94TIter
96GetAllKeyVals() const
97{
98 return TIter( m_metadata );
99}
100
101TSeqCollection *
103GetList( const TDirectory* /* basedir */, std::map<std::string,TSeqCollection*>& mp )
104{
105 TSeqCollection* mdList = newTList(GetName());
106 mp[mdList->GetName()] = mdList;
107 TIter mdIter(m_metadata);
108 HanConfigParMap* parMap(0);
109 while ((parMap = dynamic_cast<HanConfigParMap*>(mdIter()))) {
110 mdList->Add(parMap->GetList());
111 }
112 return mdList;
113}
114
115
116void
118PrintIOStream( std::ostream& o ) const
119{
120 o << "\nHanConfigMetadata: " << this->GetName() << "\n";
121
122 if (!( m_metadata->IsEmpty())) {
123 TIter nextParMap(m_metadata);
124 HanConfigParMap* parMap;
125 while( (parMap = dynamic_cast<HanConfigParMap*>( nextParMap() )) != 0 ) {
126 o << " " << parMap;
127 }
128 }
129}
130
131}//namespace dqi
132
133std::ostream& operator<<( std::ostream& o, const dqi::HanConfigMetadata& p ){
134 p.PrintIOStream(o);
135 return o;
136}
137
138std::ostream& operator<<( std::ostream& o, const dqi::HanConfigMetadata* p ){
139 p->PrintIOStream(o);
140 return o;
141}
std::ostream & operator<<(std::ostream &o, const dqi::HanConfigMetadata &p)
ClassImp(xAOD::Experimental::RFileChecker) namespace xAOD
HanConfigMetadata & operator=(const HanConfigMetadata &other)
virtual TIter GetAllKeyVals() const
virtual const char * GetName() const
virtual HanConfigParMap GetKeyVal(std::string name_) const
virtual void AddKeyVal(const HanConfigParMap &keyval_)
virtual void PrintIOStream(std::ostream &o) const
TSeqCollection * m_metadata
virtual void SetName(std::string name)
virtual TSeqCollection * GetList(const TDirectory *basedir, std::map< std::string, TSeqCollection * > &mp)
virtual TList * GetList()
TSeqCollection * newTObjArray(const char *name, TObject *obj=0, Int_t size=TCollection::kInitCapacity)
Definition HanUtils.cxx:27
TSeqCollection * newTList(const char *name, TObject *obj=0)
Definition HanUtils.cxx:18