ATLAS Offline Software
Loading...
Searching...
No Matches
TBXMLWriterToolBase Class Referenceabstract

base class for XML writer tools for 2004 event display More...

#include <TBXMLWriterToolBase.h>

Inheritance diagram for TBXMLWriterToolBase:
Collaboration diagram for TBXMLWriterToolBase:

Public Member Functions

virtual ~TBXMLWriterToolBase ()
virtual StatusCode initialize () override
virtual StatusCode writeOut (std::ostream &outStream, std::string_view entryTag=" ")
virtual StatusCode finalize () override
virtual StatusCode finalize (std::ostream &outStream)
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Protected Member Functions

 TBXMLWriterToolBase (const std::string &type, const std::string &name, const IInterface *parent)
virtual StatusCode writeRunFiles (const std::string &fileDir, unsigned int runNumber)=0
virtual StatusCode writeEvent (std::ostream &theFile, std::string_view entryTag)=0
virtual void openDictionary (std::ostream &outStream, const std::string &dictName, const std::vector< std::string > &listOfElements)
virtual void openDictionary (std::ostream &outStream, const std::string &dictName)
virtual void closeDictionary (std::ostream &outStream)
virtual void addDictElement (std::ostream &outStream, const std::string &theElement, const std::vector< std::string > &listOfElements)
virtual void addAttributes (std::ostream &outStream, const std::string &theElement, const std::vector< std::string > &listOfAttributes)
virtual void openElement (std::ostream &outStream, std::string_view theElement, const std::vector< std::string > &listOfAttr, const std::vector< std::string > &listOfValues)
virtual void closeElement (std::ostream &outStream, const std::string &theElement)
virtual void closeElement (std::ostream &outStream)
virtual void closeAllElements (std::ostream &outStream)
void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Protected Attributes

std::vector< std::string > m_elementList
std::string m_dictionary

Static Protected Attributes

static const std::string m_doubleQuote = "\042"

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default).
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default).
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

base class for XML writer tools for 2004 event display

Definition at line 17 of file TBXMLWriterToolBase.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ TBXMLWriterToolBase()

TBXMLWriterToolBase::TBXMLWriterToolBase ( const std::string & type,
const std::string & name,
const IInterface * parent )
inlineprotected

Definition at line 25 of file TBXMLWriterToolBase.h.

27 : AthAlgTool( type, name, parent )
28 { }
AthAlgTool()
Default constructor:

◆ ~TBXMLWriterToolBase()

virtual TBXMLWriterToolBase::~TBXMLWriterToolBase ( )
inlinevirtual

Definition at line 32 of file TBXMLWriterToolBase.h.

33 { }

Member Function Documentation

◆ addAttributes()

void TBXMLWriterToolBase::addAttributes ( std::ostream & outStream,
const std::string & theElement,
const std::vector< std::string > & listOfAttributes )
protectedvirtual

Definition at line 91 of file TBXMLWriterToolBase.cxx.

95{
96 outStream << " <!ATTLIST " << theElement << std::endl;
97 for ( unsigned int i=0; i<listOfAttr.size(); i++ )
98 {
99 outStream << " " << listOfAttr[i] << std::endl;
100 }
101 outStream << ">" << std::endl;
102}

◆ addDictElement()

void TBXMLWriterToolBase::addDictElement ( std::ostream & outStream,
const std::string & theElement,
const std::vector< std::string > & listOfElements )
protectedvirtual

Definition at line 57 of file TBXMLWriterToolBase.cxx.

61{
62 outStream << "<!ELEMENT " << theElement;
63 // add document as element
64 if ( listOfElements.size() == 0 )
65 {
66 outStream << ">" << std::endl;
67 }
68 else
69 {
70 // store elements
71 if ( listOfElements[0] == "ANY" ||
72 listOfElements[0] == "EMPTY" ||
73 listOfElements[0] == "ALL" )
74 {
75 outStream << " " << listOfElements[0] << " >" << std::endl;
76 }
77 else
78 {
79 outStream << " (" << listOfElements[0];
80 for ( unsigned int i=1; i<listOfElements.size(); i++ )
81 {
82 outStream << "," << listOfElements[i];
83 }
84 outStream << ") >" << std::endl;
85 }
86 }
87}

◆ closeAllElements()

void TBXMLWriterToolBase::closeAllElements ( std::ostream & outStream)
protectedvirtual

Definition at line 159 of file TBXMLWriterToolBase.cxx.

160{
161 for ( int i=m_elementList.size()-1; i>=0; i-- )
162 {
163 outStream << "</" << m_elementList[i] << ">" << std::endl;
164 }
165 m_elementList.clear();
166}
std::vector< std::string > m_elementList

◆ closeDictionary()

void TBXMLWriterToolBase::closeDictionary ( std::ostream & outStream)
protectedvirtual

Definition at line 50 of file TBXMLWriterToolBase.cxx.

51{
52 outStream << "]>" << std::endl;
53}

◆ closeElement() [1/2]

void TBXMLWriterToolBase::closeElement ( std::ostream & outStream)
protectedvirtual

Definition at line 130 of file TBXMLWriterToolBase.cxx.

131{
132 unsigned int thisSize = m_elementList.size() - 1;
133 outStream << "</" << m_elementList[thisSize] << ">" << std::endl;
134 m_elementList.resize(thisSize);
135}

◆ closeElement() [2/2]

void TBXMLWriterToolBase::closeElement ( std::ostream & outStream,
const std::string & theElement )
protectedvirtual

Definition at line 139 of file TBXMLWriterToolBase.cxx.

141{
142 std::vector<std::string>::iterator inVec =
143 find( m_elementList.begin(), m_elementList.end(), theElement);
144 if ( inVec != m_elementList.end() )
145 {
146 outStream << "</" << (*inVec) << ">" << std::endl;
147 m_elementList.erase(inVec);
148 }
149 else
150 {
151 outStream << "<!-- XML Structural Problem! \n\n"
152 << " cannot find an element " << theElement << "!\n\n"
153 << "-->" << std::endl;
154 }
155}
std::string find(const std::string &s)
return a remapped string
Definition hcg.cxx:140

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ finalize() [1/2]

virtual StatusCode TBXMLWriterToolBase::finalize ( )
inlineoverridevirtual

Definition at line 52 of file TBXMLWriterToolBase.h.

53 {
54 return StatusCode::SUCCESS;
55 }

◆ finalize() [2/2]

virtual StatusCode TBXMLWriterToolBase::finalize ( std::ostream & outStream)
inlinevirtual

Definition at line 57 of file TBXMLWriterToolBase.h.

58 {
59 this->closeAllElements(outStream);
60 return this->finalize();
61 }
virtual void closeAllElements(std::ostream &outStream)
virtual StatusCode finalize() override

◆ initialize()

virtual StatusCode TBXMLWriterToolBase::initialize ( )
inlineoverridevirtual

Reimplemented in TBXMLCaloCellWriterTool.

Definition at line 36 of file TBXMLWriterToolBase.h.

37 {
38 return StatusCode::SUCCESS;
39 }

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ openDictionary() [1/2]

void TBXMLWriterToolBase::openDictionary ( std::ostream & outStream,
const std::string & dictName )
protectedvirtual

Definition at line 41 of file TBXMLWriterToolBase.cxx.

43{
44 std::vector<std::string> emptyList;
45 this->openDictionary(outStream,dictName, emptyList);
46}
virtual void openDictionary(std::ostream &outStream, const std::string &dictName, const std::vector< std::string > &listOfElements)

◆ openDictionary() [2/2]

void TBXMLWriterToolBase::openDictionary ( std::ostream & outStream,
const std::string & dictName,
const std::vector< std::string > & listOfElements )
protectedvirtual

Definition at line 18 of file TBXMLWriterToolBase.cxx.

22{
23 // clean up
24 m_elementList.clear();
25 m_dictionary = dictName;
26
27 // write header
28 outStream << "<?XML version=" << m_doubleQuote
29 << "1" << m_doubleQuote << "?>" << std::endl;
30
31 // write begin of dictionary
32 outStream << "<!DOCTYPE " << dictName
33 << " [" << std::endl;
34
35 // add doctype as element
36 this->addDictElement(outStream,dictName,listOfElements);
37}
virtual void addDictElement(std::ostream &outStream, const std::string &theElement, const std::vector< std::string > &listOfElements)
static const std::string m_doubleQuote

◆ openElement()

void TBXMLWriterToolBase::openElement ( std::ostream & outStream,
std::string_view theElement,
const std::vector< std::string > & listOfAttr,
const std::vector< std::string > & listOfValues )
protectedvirtual

Definition at line 106 of file TBXMLWriterToolBase.cxx.

112{
113 m_elementList.emplace_back(theElement);
114 outStream << "<" << theElement;
115 if ( listOfAttr.size() > 0 && listOfValues.size() == listOfAttr.size() )
116 {
117 for ( unsigned int i=0; i<listOfAttr.size(); i++ )
118 {
119 outStream << " " << listOfAttr[i] << "="
120 << m_doubleQuote
121 << listOfValues[i]
122 << m_doubleQuote;
123 }
124 }
125 outStream << ">" << std::endl;
126}

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

◆ writeEvent()

virtual StatusCode TBXMLWriterToolBase::writeEvent ( std::ostream & theFile,
std::string_view entryTag )
protectedpure virtual

◆ writeOut()

virtual StatusCode TBXMLWriterToolBase::writeOut ( std::ostream & outStream,
std::string_view entryTag = " " )
inlinevirtual

Definition at line 46 of file TBXMLWriterToolBase.h.

48 {
49 return this->writeEvent(outStream,entryTag);
50 }
virtual StatusCode writeEvent(std::ostream &theFile, std::string_view entryTag)=0

◆ writeRunFiles()

virtual StatusCode TBXMLWriterToolBase::writeRunFiles ( const std::string & fileDir,
unsigned int runNumber )
protectedpure virtual

Member Data Documentation

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default).

Definition at line 393 of file AthCommonDataStore.h.

◆ m_dictionary

std::string TBXMLWriterToolBase::m_dictionary
protected

Definition at line 108 of file TBXMLWriterToolBase.h.

◆ m_doubleQuote

const std::string TBXMLWriterToolBase::m_doubleQuote = "\042"
staticprotected

Definition at line 110 of file TBXMLWriterToolBase.h.

◆ m_elementList

std::vector<std::string> TBXMLWriterToolBase::m_elementList
protected

Definition at line 107 of file TBXMLWriterToolBase.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default).

Definition at line 390 of file AthCommonDataStore.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: