Skip to content

Commit

Permalink
* Replace XercesString with safer implementation
Browse files Browse the repository at this point in the history
* Set and release locks
* Initialize and cleanup Xerses
  • Loading branch information
Ianna Osborne committed Nov 8, 2016
1 parent e31f76a commit 4da5e35
Show file tree
Hide file tree
Showing 63 changed files with 591 additions and 1,035 deletions.
8 changes: 4 additions & 4 deletions CondTools/Ecal/interface/DOMHelperFunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <string>
#include "CondTools/Ecal/interface/EcalCondHeader.h"
#include "CondTools/Ecal/interface/XMLTags.h"
#include "CondTools/Ecal/interface/XercesString.h"
#include "Utilities/Xerces/interface/XercesStrUtils.h"
#include <xercesc/dom/DOM.hpp>
#include <sstream>

Expand All @@ -42,7 +42,7 @@ namespace xuti {
/// get the node data
template <class T> void GetNodeData(xercesc::DOMNode* node, T& value)
{
std::string value_s = toNative(node->getTextContent());
std::string value_s = cms::xerces::toString(node->getTextContent());
std::stringstream value_ss(value_s);
value_ss>> value;
}
Expand All @@ -55,14 +55,14 @@ namespace xuti {
{

xercesc::DOMDocument * doc = parentNode->getOwnerDocument();
xercesc::DOMElement* new_node = doc->createElement(fromNative(tag).c_str());
xercesc::DOMElement* new_node = doc->createElement(cms::xerces::uStr(tag.c_str()).ptr());
parentNode->appendChild(new_node);

std::stringstream value_ss;
value_ss <<value;

xercesc::DOMText* tvalue =
doc->createTextNode(fromNative(value_ss.str()).c_str());
doc->createTextNode(cms::xerces::uStr(value_ss.str().c_str()).ptr());
new_node->appendChild(tvalue);

}
Expand Down
7 changes: 2 additions & 5 deletions CondTools/Ecal/interface/ESGainXMLTranslator.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,9 @@
#ifndef __ESGainXMLTranslator_h_
#define __ESGainXMLTranslator_h_


#include "CondTools/Ecal/interface/XercesString.h"
#include "CondTools/Ecal/interface/EcalCondHeader.h"
#include <string>



class ESGain;

class ESGainXMLTranslator {
Expand All @@ -24,7 +20,8 @@ class ESGainXMLTranslator {
static int writeXML (const std::string& filename,
const EcalCondHeader& header,
const ESGain& record);

private:

static std::string dumpXML(const EcalCondHeader& header,
const ESGain& record);
};
Expand Down
5 changes: 2 additions & 3 deletions CondTools/Ecal/interface/EcalADCToGeVXMLTranslator.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
#ifndef __EcalADCToGeVXMLTranslator_h_
#define __EcalADCToGeVXMLTranslator_h_


#include "CondTools/Ecal/interface/XercesString.h"
#include "CondTools/Ecal/interface/EcalCondHeader.h"
#include <string>

Expand All @@ -29,7 +27,8 @@ class EcalADCToGeVXMLTranslator {
static int writeXML (const std::string& filename,
const EcalCondHeader& header,
const EcalADCToGeVConstant& record);

private:

static std::string dumpXML(const EcalCondHeader& header,
const EcalADCToGeVConstant& record);
};
Expand Down
8 changes: 3 additions & 5 deletions CondTools/Ecal/interface/EcalAlignmentXMLTranslator.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,10 @@
#ifndef __EcalAlignmentXMLTranslator_h_
#define __EcalAlignmentXMLTranslator_h_


#include "CondTools/Ecal/interface/XercesString.h"
#include "CondTools/Ecal/interface/EcalCondHeader.h"
#include <string>


class AlignTransform;
class Alignments;

class EcalAlignmentXMLTranslator {

Expand All @@ -25,7 +22,8 @@ class EcalAlignmentXMLTranslator {
static int writeXML (const std::string& filename,
const EcalCondHeader& header,
const Alignments& record);

private:

static std::string dumpXML(const EcalCondHeader& header,
const Alignments& record);
};
Expand Down
18 changes: 3 additions & 15 deletions CondTools/Ecal/interface/EcalChannelStatusXMLTranslator.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@

#include "CondFormats/EcalObjects/interface/EcalChannelStatus.h"
#include "CondTools/Ecal/interface/EcalCondHeader.h"
#include "CondTools/Ecal/interface/XMLTags.h"
#include "CondTools/Ecal/interface/XercesString.h"
#include <string>
#include <xercesc/dom/DOMNode.hpp>


class EcalChannelStatusXMLTranslator {

Expand All @@ -28,18 +24,10 @@ class EcalChannelStatusXMLTranslator {
static int writeXML (const std::string& filename,
const EcalCondHeader& header,
const EcalChannelStatus& record);

private:

static std::string dumpXML(const EcalCondHeader& header,
const EcalChannelStatus& record);

const EcalChannelStatus& record);
};



#endif // __EcalChannelStatusXMLTranslator_h_

// Configure (x)emacs for this file ...
// Local Variables:
// mode:c++
// compile-command: "cd ..; scram b"
// End:
9 changes: 2 additions & 7 deletions CondTools/Ecal/interface/EcalClusterCrackCorrXMLTranslator.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,9 @@
#ifndef __EcalClusterCrackCorrXMLTranslator_h_
#define __EcalClusterCrackCorrXMLTranslator_h_

#include "CondTools/Ecal/interface/XercesString.h"
#include "CondTools/Ecal/interface/EcalCondHeader.h"
#include "CondFormats/EcalObjects/interface/EcalFunctionParameters.h"
#include <xercesc/dom/DOMNode.hpp>
#include <string>
#include <vector>


class EcalClusterCrackCorrXMLTranslator {

Expand All @@ -28,13 +24,12 @@ class EcalClusterCrackCorrXMLTranslator {
static int writeXML (const std::string& filename,
const EcalCondHeader& header,
const EcalFunParams& record);


private:
// dump the CMSSW object container to XML
static std::string dumpXML(const EcalCondHeader& header,
const EcalFunParams& record);

};



#endif // __EcalClusterCrackCorrXMLTranslator_h_
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,9 @@
#ifndef __EcalClusterEnergyCorrectionObjectSpecificXMLTranslator_h_
#define __EcalClusterEnergyCorrectionObjectSpecificXMLTranslator_h_

#include "CondTools/Ecal/interface/XercesString.h"
#include "CondTools/Ecal/interface/EcalCondHeader.h"
#include "CondFormats/EcalObjects/interface/EcalFunctionParameters.h"
#include <xercesc/dom/DOMNode.hpp>
#include <string>
#include <vector>


class EcalClusterEnergyCorrectionObjectSpecificXMLTranslator {

Expand All @@ -29,11 +25,10 @@ class EcalClusterEnergyCorrectionObjectSpecificXMLTranslator {
static int writeXML (const std::string& filename,
const EcalCondHeader& header,
const EcalFunParams& record);
private:
// dump the CMSSW object container to XML
static std::string dumpXML(const EcalCondHeader& header,
const EcalFunParams& record);

};


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,9 @@
#ifndef __EcalClusterEnergyCorrectionXMLTranslator_h_
#define __EcalClusterEnergyCorrectionXMLTranslator_h_

#include "CondTools/Ecal/interface/XercesString.h"
#include "CondTools/Ecal/interface/EcalCondHeader.h"
#include "CondFormats/EcalObjects/interface/EcalFunctionParameters.h"
#include <xercesc/dom/DOMNode.hpp>
#include <string>
#include <vector>


class EcalClusterEnergyCorrectionXMLTranslator {

Expand All @@ -29,7 +25,8 @@ class EcalClusterEnergyCorrectionXMLTranslator {
static int writeXML (const std::string& filename,
const EcalCondHeader& header,
const EcalFunParams& record);


private:
// dump the CMSSW object container to XML
static std::string dumpXML(const EcalCondHeader& header,
const EcalFunParams& record);
Expand Down
12 changes: 2 additions & 10 deletions CondTools/Ecal/interface/EcalClusterLocalContCorrXMLTranslator.h
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
/**
Translates a EcalClusterLocalContCorr record to XML
and vice versa
\author
\version $Id: EcalClusterLocalContCorrXMLTranslator.h,v 1.0 $
\date October 2011
*/

#ifndef __EcalClusterLocalContCorrXMLTranslator_h_
#define __EcalClusterLocalContCorrXMLTranslator_h_

#include "CondTools/Ecal/interface/XercesString.h"
#include "CondTools/Ecal/interface/EcalCondHeader.h"
#include "CondFormats/EcalObjects/interface/EcalFunctionParameters.h"
#include <xercesc/dom/DOMNode.hpp>
#include <string>
#include <vector>


class EcalClusterLocalContCorrXMLTranslator {

Expand All @@ -29,11 +21,11 @@ class EcalClusterLocalContCorrXMLTranslator {
static int writeXML (const std::string& filename,
const EcalCondHeader& header,
const EcalFunParams& record);


private:
// dump the CMSSW object container to XML
static std::string dumpXML(const EcalCondHeader& header,
const EcalFunParams& record);

};


Expand Down
9 changes: 2 additions & 7 deletions CondTools/Ecal/interface/EcalDAQTowerStatusXMLTranslator.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,8 @@
#define __EcalDAQTowerStatusXMLTranslator_h_

#include "CondFormats/EcalObjects/interface/EcalDAQTowerStatus.h"

#include "CondTools/Ecal/interface/XercesString.h"
#include "CondTools/Ecal/interface/EcalCondHeader.h"
#include <string>
#include <xercesc/dom/DOMNode.hpp>


//class EcalDAQTowerStatus;

class EcalDAQTowerStatusXMLTranslator {

Expand All @@ -29,7 +23,8 @@ class EcalDAQTowerStatusXMLTranslator {
static int writeXML(const std::string& filename,
const EcalCondHeader& header,
const EcalDAQTowerStatus& record);

private:

static std::string dumpXML(const EcalCondHeader& header,
const EcalDAQTowerStatus& record);

Expand Down
7 changes: 2 additions & 5 deletions CondTools/Ecal/interface/EcalDCSTowerStatusXMLTranslator.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,8 @@
#define __EcalDCSTowerStatusXMLTranslator_h_

#include "CondFormats/EcalObjects/interface/EcalDCSTowerStatus.h"

#include "CondTools/Ecal/interface/XercesString.h"
#include "CondTools/Ecal/interface/EcalCondHeader.h"
#include <string>
#include <xercesc/dom/DOMNode.hpp>


class EcalDCSTowerStatusXMLTranslator {

Expand All @@ -27,7 +23,8 @@ class EcalDCSTowerStatusXMLTranslator {
static int writeXML(const std::string& filename,
const EcalCondHeader& header,
const EcalDCSTowerStatus& record);

private:

static std::string dumpXML(const EcalCondHeader& header,
const EcalDCSTowerStatus& record);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,11 @@
#ifndef __EcalFloatCondObjectContainterXMLTranslator_h_
#define __EcalFloatCondObjectContainterXMLTranslator_h_

#include "CondTools/Ecal/interface/XercesString.h"
#include "CondTools/Ecal/interface/EcalCondHeader.h"
#include "CondFormats/EcalObjects/interface/EcalCondObjectContainer.h"
#include <xercesc/dom/DOMNode.hpp>
#include <string>
#include <vector>


class EcalFloatCondObjectContainerXMLTranslator {

public:
Expand All @@ -34,24 +31,17 @@ class EcalFloatCondObjectContainerXMLTranslator {
static int writeXML (const std::string& filename,
const EcalCondHeader& header,
const EcalFloatCondObjectContainer& record);

// dump the CMSSW object container to XML
static std::string dumpXML(const EcalCondHeader& header,
const EcalFloatCondObjectContainer& record);

// dump the two flat arrays (hashed-indexed as in EBDetId, EEDetId) to XML
static std::string dumpXML(const EcalCondHeader& header,
const std::vector<float>& eb,
const std::vector<float>& ee);
private:

// dump the CMSSW object container to XML
static std::string dumpXML(const EcalCondHeader& header,
const EcalFloatCondObjectContainer& record);

};



#endif // __EcalFloatCondObjectContainerXMLTranslator_h_

// Configure (x)emacs for this file ...
// Local Variables:
// mode:c++
// compile-command: "cd ..; scram b"
// End:
16 changes: 1 addition & 15 deletions CondTools/Ecal/interface/EcalGainRatiosXMLTranslator.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,8 @@
#define __EcalGainRatiosXMLTranslator_h_

#include "CondFormats/EcalObjects/interface/EcalGainRatios.h"

#include "CondTools/Ecal/interface/XercesString.h"
#include "CondTools/Ecal/interface/EcalCondHeader.h"
#include <string>
#include <xercesc/dom/DOMNode.hpp>


class EcalGainRatiosXMLTranslator {

Expand All @@ -29,19 +25,9 @@ class EcalGainRatiosXMLTranslator {
static int writeXML(const std::string& filename,
const EcalCondHeader& header,
const EcalGainRatios& record);

private:
static std::string dumpXML(const EcalCondHeader& header,
const EcalGainRatios& record);


};



#endif // __EcalGainRatiosXMLTranslator_h_

// Configure (x)emacs for this file ...
// Local Variables:
// mode:c++
// compile-command: "cd ..; scram b"
// End:
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,4 @@

typedef EcalFloatCondObjectContainerXMLTranslator EcalIntercalibConstantsMCXMLTranslator;


#endif // __EcalIntercalibConstantsMCXMLTranslator_h_

// Configure (x)emacs for this file ...
// Local Variables:
// mode:c++
// compile-command: "cd ..; scram b"
// End:
Loading

0 comments on commit 4da5e35

Please sign in to comment.