BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
XmlTest1Cnv.cxx
Go to the documentation of this file.
1// $Header:
2// /bes/bes/BossCvs/Calibration/CalibSvc/CalibXmlCnvSvc/src/cnv/XmlTest1Cnv.cxx,v 1.1.1.1
3// 2006/04/03 03:04:32 maqm Exp $
4
5#include "XmlTest1Cnv.h"
6#include "GaudiKernel/CnvFactory.h"
7#include "GaudiKernel/DataObject.h"
8#include "GaudiKernel/GenericAddress.h"
9#include "GaudiKernel/IAddressCreator.h"
10#include "GaudiKernel/IConversionSvc.h"
11#include "GaudiKernel/IDataProviderSvc.h"
12#include "GaudiKernel/IOpaqueAddress.h"
13#include "GaudiKernel/MsgStream.h"
14#include <string>
15
16#include "CalibSvc/ICalibMetaCnvSvc.h"
17#include "CalibSvc/ICalibXmlSvc.h"
18
19#include "CalibData/CalibTest1.h"
20#include "CalibData/CalibTime.h"
21#include "xmlBase/Dom.h"
22
23// Temporary. Hope to find a better way to do this
24#include "CalibData/CalibModel.h"
25
26static CnvFactory<XmlTest1Cnv> s_factory;
27const ICnvFactory& XmlTest1CnvFactory = s_factory;
28
30
31const CLID& XmlTest1Cnv::objType() const { return CLID_Calib_CalibTest1; }
32
34
35// Don't need to override in this case
36/*
37StatusCode XmlBaseCnv::i_processObj(DataObject*, // pObject,
38 IOpaqueAddress*) { //pAddress
39 return StatusCode::SUCCESS;
40}
41*/
42
43// Create our specific object
44StatusCode XmlTest1Cnv::i_createObj( const DOMElement* element, DataObject*& refpObject ) {
45 using xmlBase::Dom;
46
47 // Fetch quantities we need: name, value
48 DOMElement* child = Dom::findFirstChildByName( element, "data" );
49 if ( child == 0 ) return StatusCode::FAILURE;
50 child = Dom::findFirstChildByName( child, "leaf" );
51 if ( child == 0 ) return StatusCode::FAILURE;
52
53 std::string name = Dom::getAttribute( child, "name" );
54
55 // std::string valueString = Dom::getAttribute(child, "value");
56
57 // int value = atoi(valueString.c_str());
58 int value;
59 try
60 { value = Dom::getIntAttribute( child, "value" ); } catch ( xmlBase::DomException ex )
61 {
62 std::cerr << "From CalibSvc::XmlTest1Cnv::i_crateObj " << std::endl;
63 std::cerr << ex.getMsg() << std::endl;
64 }
65
66 refpObject = new CalibData::CalibTest1( name, value, *m_vstart, *m_vend, m_serNo );
67
68 return StatusCode::SUCCESS;
69}
const ICnvFactory & XmlTest1CnvFactory
ITime * m_vend
Definition XmlBaseCnv.h:140
ITime * m_vstart
Definition XmlBaseCnv.h:139
XmlBaseCnv(ISvcLocator *svc, const CLID &clid)
const CLID & objType() const
virtual StatusCode i_createObj(const DOMElement *element, DataObject *&refpObject)
XmlTest1Cnv(ISvcLocator *svcs)
static const CLID & classID()