Skip to content

Commit

Permalink
Merge pull request #20215 from ggovi/condcore-utilities-cond2xml-impr…
Browse files Browse the repository at this point in the history
…ov-0-93X

Improvements for conddb dump command
  • Loading branch information
cmsbuild authored Aug 29, 2017
2 parents f91659f + 0d5f27e commit 338287d
Show file tree
Hide file tree
Showing 11 changed files with 163 additions and 251 deletions.
21 changes: 0 additions & 21 deletions CondCore/BeamSpotPlugins/plugins/BeamSpotObjects_toXML.cc

This file was deleted.

8 changes: 0 additions & 8 deletions CondCore/EcalPlugins/plugins/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@
<flags EDM_PLUGIN="1"/>
</library>

<flags CXXFLAGS="-Wno-sign-compare -Wno-unused-variable"/>
<library file="EcalCondObjectContainer_EcalTPGCrystalStatusCode_toXML.cc" name="EcalCondObjectContainer_EcalTPGCrystalStatusCode_toXML">
<use name="CondCore/Utilities"/>
<use name="CondCore/CondDB"/>
<use name="CondFormats/Common"/>
<use name="boost_python"/>
</library>

<library file="EcalPedestals_PayloadInspector.cc" name="EcalPedestals_PayloadInspector">
<use name="CondCore/Utilities"/>
<use name="CondCore/CondDB"/>
Expand Down

This file was deleted.

7 changes: 0 additions & 7 deletions CondCore/SiStripPlugins/plugins/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
<flags CXX_FLAGS="-Wno-unused-variable"/>

<library file="SiStripObjects_toXML.cc" name="SiStripObjects_toXML">
<use name="CondCore/Utilities"/>
<use name="CondCore/CondDB"/>
<use name="CondFormats/Common"/>
<use name="boost_python"/>
</library>

<library file="SiStripDetVOff_PayloadInspector.cc" name="SiStripDetVOff_PayloadInspector">
<use name="CondCore/Utilities"/>
<use name="CondCore/CondDB"/>
Expand Down
26 changes: 0 additions & 26 deletions CondCore/SiStripPlugins/plugins/SiStripObjects_toXML.cc

This file was deleted.

52 changes: 52 additions & 0 deletions CondCore/Utilities/interface/Payload2XMLModule.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#ifndef CondCore_Utilities_Payload2XMLModule_h
#define CondCore_Utilities_Payload2XMLModule_h

#include <string>
#include <memory>

#include <boost/python.hpp>
#include "boost/archive/xml_oarchive.hpp"

#include "CondFormats/Serialization/interface/Archive.h"

#define XML_CONVERTER_NAME( CLASS_NAME ) (std::string( #CLASS_NAME )+"2xml").c_str()

#define PAYLOAD_2XML_MODULE( MODULE_NAME ) \
BOOST_PYTHON_MODULE( MODULE_NAME )

#define PAYLOAD_2XML_CLASS( CLASS_NAME ) \
boost::python::class_< Payload2xml<CLASS_NAME> >( XML_CONVERTER_NAME( CLASS_NAME ), boost::python::init<>()) \
.def("write",&Payload2xml<CLASS_NAME>::write ) \
;

namespace { // Avoid cluttering the global namespace.

template <typename PayloadType> class Payload2xml {
public:
Payload2xml(){
}
//
std::string write( const std::string &payloadData ){
// now to convert
std::unique_ptr< PayloadType > payload;
std::stringbuf sdataBuf;
sdataBuf.pubsetbuf( const_cast<char *> ( payloadData.c_str() ), payloadData.size() );

std::istream inBuffer( &sdataBuf );
eos::portable_iarchive ia( inBuffer );
payload.reset( new PayloadType );
ia >> (*payload);

// now we have the object in memory, convert it to xml in a string and return it
std::ostringstream outBuffer;
{
boost::archive::xml_oarchive xmlResult( outBuffer );
xmlResult << boost::serialization::make_nvp( "cmsCondPayload", *payload );
}
return outBuffer.str();
}
};

} // end namespace

#endif
42 changes: 0 additions & 42 deletions CondCore/Utilities/interface/PayloadToXML.h

This file was deleted.

4 changes: 4 additions & 0 deletions CondCore/Utilities/plugins/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@
<use name="CondCore/Utilities"/>
<use name="boost_python"/>
</library>
<library file="Module_2XML.cc" name="Utilities_payload2xml">
<use name="CondCore/Utilities"/>
<use name="boost_python"/>
</library>
11 changes: 11 additions & 0 deletions CondCore/Utilities/plugins/Module_2XML.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include "CondCore/Utilities/interface/Payload2XMLModule.h"
#include "CondCore/Utilities/src/CondFormats.h"

PAYLOAD_2XML_MODULE( pluginUtilities_payload2xml ){
PAYLOAD_2XML_CLASS( BeamSpotObjects );
PAYLOAD_2XML_CLASS( EcalCondObjectContainer<EcalPedestal> );
PAYLOAD_2XML_CLASS( EcalLaserAPDPNRatios );
PAYLOAD_2XML_CLASS( RunInfo );
PAYLOAD_2XML_CLASS( SiStripLatency );
PAYLOAD_2XML_CLASS( SiStripConfObject );
}
Loading

0 comments on commit 338287d

Please sign in to comment.