Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements for conddb dump command #20215

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @ggovi - please add an include guard

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true, just forgotten - done now.

#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