/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Calibration/CalibSvc/CalibXmlCnvSvc/CalibXmlCnvSvc-00-01-01/src/cnv/XmlTest1Cnv.cxx

Go to the documentation of this file.
00001 // $Header: /bes/bes/BossCvs/Calibration/CalibSvc/CalibXmlCnvSvc/src/cnv/XmlTest1Cnv.cxx,v 1.1.1.1 2006/04/03 03:04:32 maqm Exp $
00002 
00003 #include <string>
00004 #include "XmlTest1Cnv.h"
00005 #include "GaudiKernel/CnvFactory.h"
00006 #include "GaudiKernel/IOpaqueAddress.h"
00007 #include "GaudiKernel/DataObject.h"
00008 #include "GaudiKernel/IAddressCreator.h"
00009 #include "GaudiKernel/IDataProviderSvc.h"
00010 #include "GaudiKernel/IConversionSvc.h"
00011 #include "GaudiKernel/MsgStream.h"
00012 #include "GaudiKernel/GenericAddress.h"
00013 
00014 #include "CalibSvc/ICalibXmlSvc.h"
00015 #include "CalibSvc/ICalibMetaCnvSvc.h"
00016 
00017 #include "CalibData/CalibTest1.h"
00018 #include "CalibData/CalibTime.h"
00019 #include "xmlBase/Dom.h"
00020 
00021 // Temporary.  Hope to find a better way to do this
00022 #include "CalibData/CalibModel.h"
00023 
00024 static CnvFactory<XmlTest1Cnv> s_factory;
00025 const  ICnvFactory& XmlTest1CnvFactory = s_factory;
00026 
00027 
00028 
00029 XmlTest1Cnv::XmlTest1Cnv( ISvcLocator* svc) :
00030   XmlBaseCnv(svc, CLID_Calib_CalibTest1) { 
00031 }
00032 
00033 
00034 const CLID& XmlTest1Cnv::objType() const {
00035   return CLID_Calib_CalibTest1;
00036 }
00037 
00038 const CLID& XmlTest1Cnv::classID() {
00039   return CLID_Calib_CalibTest1;
00040 }
00041 
00042 // Don't need to override in this case
00043 /*
00044 StatusCode XmlBaseCnv::i_processObj(DataObject*, // pObject,
00045                                     IOpaqueAddress*)  {  //pAddress
00046   return StatusCode::SUCCESS;
00047 }
00048 */
00049  
00050 
00051 // Create our specific object
00052 StatusCode XmlTest1Cnv::i_createObj(const DOMElement* element, 
00053                                     DataObject*& refpObject)
00054 {
00055   using xmlBase::Dom;
00056 
00057   // Fetch quantities we need: name, value
00058   DOMElement* child = Dom::findFirstChildByName(element, "data");
00059   if (child == 0) return StatusCode::FAILURE;
00060   child = Dom::findFirstChildByName(child, "leaf");
00061   if (child == 0) return StatusCode::FAILURE;
00062 
00063   std::string name = Dom::getAttribute(child, "name");
00064 
00065   //  std::string valueString = Dom::getAttribute(child, "value");
00066 
00067   //  int value = atoi(valueString.c_str());
00068   int value;
00069   try {
00070     value = Dom::getIntAttribute(child, "value");
00071   }
00072   catch (xmlBase::DomException ex) {
00073     std::cerr << "From CalibSvc::XmlTest1Cnv::i_crateObj " << std::endl;
00074     std::cerr << ex.getMsg() << std::endl;
00075   }
00076 
00077   refpObject = new  
00078     CalibData::CalibTest1(name, value, *m_vstart, *m_vend, m_serNo);
00079 
00080   return StatusCode::SUCCESS;
00081 }

Generated on Tue Nov 29 22:57:54 2016 for BOSS_7.0.2 by  doxygen 1.4.7