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