-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20215 from ggovi/condcore-utilities-cond2xml-impr…
…ov-0-93X Improvements for conddb dump command
- Loading branch information
Showing
11 changed files
with
163 additions
and
251 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 0 additions & 20 deletions
20
CondCore/EcalPlugins/plugins/EcalCondObjectContainer_EcalTPGCrystalStatusCode_toXML.cc
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ); | ||
} |
Oops, something went wrong.