1 #ifndef CondCore_Utilities_Payload2XMLModule_h 2 #define CondCore_Utilities_Payload2XMLModule_h 7 #include <boost/python.hpp> 8 #include "boost/archive/xml_oarchive.hpp" 12 #define XML_CONVERTER_NAME( CLASS_NAME ) (std::string( #CLASS_NAME )+"2xml").c_str() 14 #define PAYLOAD_2XML_MODULE( MODULE_NAME ) \ 15 BOOST_PYTHON_MODULE( MODULE_NAME ) 17 #define PAYLOAD_2XML_CLASS( CLASS_NAME ) \ 18 boost::python::class_< Payload2xml<CLASS_NAME> >( XML_CONVERTER_NAME( CLASS_NAME ), boost::python::init<>()) \ 19 .def("write",&Payload2xml<CLASS_NAME>::write ) \ 24 template <
typename PayloadType>
class Payload2xml {
31 std::unique_ptr< PayloadType >
payload;
32 std::stringbuf sdataBuf;
33 sdataBuf.pubsetbuf( const_cast<char *> ( payloadData.c_str() ), payloadData.size() );
35 std::istream inBuffer( &sdataBuf );
36 eos::portable_iarchive ia( inBuffer );
37 payload.reset(
new PayloadType );
41 std::ostringstream outBuffer;
43 boost::archive::xml_oarchive xmlResult( outBuffer );
44 xmlResult << boost::serialization::make_nvp(
"cmsCondPayload", *payload );
46 return outBuffer.str();
payload
payload postfix for testing