Import Geant4 10.5.0 source tree

This commit is contained in:
Gabriele Cosmo
2018-12-07 15:15:39 +01:00
parent 6aa23be517
commit db49709b53
11370 changed files with 187480 additions and 160142 deletions
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4HepRep.hh 66373 2012-12-18 09:41:34Z gcosmo $
//
/**
@@ -24,7 +24,6 @@
// ********************************************************************
//
//
// $Id: G4HepRepFile.hh 66373 2012-12-18 09:41:34Z gcosmo $
//
//
// John Allison 5th April 2001
@@ -24,7 +24,6 @@
// ********************************************************************
//
//
// $Id: G4HepRepFileSceneHandler.hh 99152 2016-09-07 08:04:30Z gcosmo $
//
//
// Joseph Perl 27th January 2002
@@ -24,7 +24,6 @@
// ********************************************************************
//
//
// $Id: G4HepRepFileViewer.hh 66373 2012-12-18 09:41:34Z gcosmo $
//
//
// John Allison 5th April 2001
@@ -26,7 +26,6 @@
//
//--------------------------------------------------------------------------
// File and Version Information:
// $Id: G4HepRepFileXMLWriter.hh 66373 2012-12-18 09:41:34Z gcosmo $
//
// Description:
// Create a HepRep XML File (HepRep version 1).
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4HepRepMessenger.hh 68043 2013-03-13 14:27:49Z gcosmo $
//
//
#ifndef G4HepRepMessenger_HH
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4HepRepSceneHandler.hh 99152 2016-09-07 08:04:30Z gcosmo $
//
/**
@@ -23,7 +23,6 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4HepRepViewer.hh 66373 2012-12-18 09:41:34Z gcosmo $
//
/**
@@ -1,48 +1,47 @@
// Copyright FreeHEP, 2005.
#ifndef ABSTRACTXMLWRITER_H
#define ABSTRACTXMLWRITER_H 1
#include "cheprep/config.h"
#include <string>
/**
* @author Mark Donszelmann
* @version $Id: AbstractXMLWriter.h 66373 2012-12-18 09:41:34Z gcosmo $
*/
namespace cheprep {
class AbstractXMLWriter {
public:
AbstractXMLWriter(std::string aDefaultNameSpace) : defaultNameSpace(aDefaultNameSpace) {
}
virtual ~AbstractXMLWriter() {
}
virtual void openTag(std::string ns, std::string name) = 0;
virtual void printTag(std::string ns, std::string name) = 0;
virtual void setAttribute(std::string ns, std::string name, std::string value) = 0;
virtual void setAttribute(std::string ns, std::string name, double value) = 0;
virtual void close() = 0;
virtual void openDoc(std::string version = "1.0", std::string encoding = "", bool standalone = false) = 0;
virtual void closeDoc(bool force = false) = 0;
virtual void openTag(std::string name) = 0;
virtual void closeTag() = 0;
virtual void printTag(std::string name) = 0;
virtual void setAttribute(std::string name, char* value) = 0;
virtual void setAttribute(std::string name, std::string value) = 0;
virtual void setAttribute(std::string name, std::vector<double> value) = 0;
virtual void setAttribute(std::string name, int64 value) = 0;
virtual void setAttribute(std::string name, int value) = 0;
virtual void setAttribute(std::string name, bool value) = 0;
virtual void setAttribute(std::string name, double value) = 0;
protected:
std::string defaultNameSpace;
};
} // cheprep
#endif // ABSTRACTXMLWRITER_H
// Copyright FreeHEP, 2005.
#ifndef ABSTRACTXMLWRITER_H
#define ABSTRACTXMLWRITER_H 1
#include "cheprep/config.h"
#include <string>
/**
* @author Mark Donszelmann
*/
namespace cheprep {
class AbstractXMLWriter {
public:
AbstractXMLWriter(std::string aDefaultNameSpace) : defaultNameSpace(aDefaultNameSpace) {
}
virtual ~AbstractXMLWriter() {
}
virtual void openTag(std::string ns, std::string name) = 0;
virtual void printTag(std::string ns, std::string name) = 0;
virtual void setAttribute(std::string ns, std::string name, std::string value) = 0;
virtual void setAttribute(std::string ns, std::string name, double value) = 0;
virtual void close() = 0;
virtual void openDoc(std::string version = "1.0", std::string encoding = "", bool standalone = false) = 0;
virtual void closeDoc(bool force = false) = 0;
virtual void openTag(std::string name) = 0;
virtual void closeTag() = 0;
virtual void printTag(std::string name) = 0;
virtual void setAttribute(std::string name, char* value) = 0;
virtual void setAttribute(std::string name, std::string value) = 0;
virtual void setAttribute(std::string name, std::vector<double> value) = 0;
virtual void setAttribute(std::string name, int64 value) = 0;
virtual void setAttribute(std::string name, int value) = 0;
virtual void setAttribute(std::string name, bool value) = 0;
virtual void setAttribute(std::string name, double value) = 0;
protected:
std::string defaultNameSpace;
};
} // cheprep
#endif // ABSTRACTXMLWRITER_H
@@ -1,131 +1,130 @@
// Copyright FreeHEP, 2005.
#ifndef CHEPREP_BHEPREPWRITER_H
#define CHEPREP_BHEPREPWRITER_H
#include "cheprep/config.h"
#include <string>
#include <iostream>
#include <vector>
#include <map>
#include "cheprep/AbstractXMLWriter.h"
/**
* @author Mark Donszelmann
* @version $Id: BHepRepWriter.h 66870 2013-01-14 23:38:59Z adotti $
*/
namespace cheprep {
class BHepRepWriter : public AbstractXMLWriter {
public:
BHepRepWriter(std::ostream& os);
virtual ~BHepRepWriter();
void close();
void openDoc(std::string version = "BinaryHepRep/1.0", std::string encoding = "UTF-8", bool standalone = false);
void closeDoc(bool force = false);
void openTag(std::string name);
void closeTag();
void printTag(std::string name);
void setAttribute(std::string name, char* value);
void setAttribute(std::string name, std::string value);
void setAttribute(std::string name, std::vector<double> value);
void setAttribute(std::string name, int64 value);
void setAttribute(std::string name, int value);
void setAttribute(std::string name, bool value);
void setAttribute(std::string name, double value);
//
// Can be removed when we can properly inherit those (since names are equal to overloaded ones).
//
void openTag(std::string ns, std::string name) {
openTag(ns == defaultNameSpace ? name : ns.append(":").append(name));
}
void printTag(std::string ns, std::string name) {
printTag(ns == defaultNameSpace ? name : ns.append(":").append(name));
}
void setAttribute(std::string ns, std::string name, std::string value) {
setAttribute(ns.append(":").append(name), value);
}
void setAttribute(std::string ns, std::string name, double value) {
setAttribute(ns.append(":").append(name), value);
}
private:
static const unsigned char WBXML_VERSION = 0x03;
static const unsigned char UNKNOWN_PID = 0x01;
static const unsigned char UTF8 = 0x6a;
// standard tags
static const unsigned char SWITCH_PAGE = 0x00;
static const unsigned char END = 0x01;
static const unsigned char ENTITY = 0x02;
static const unsigned char STR_I = 0x03;
static const unsigned char LITERAL = 0x04;
static const unsigned char CONTENT = 0x40;
static const unsigned char EXT_I_0 = 0x40;
static const unsigned char EXT_I_1 = 0x41;
static const unsigned char EXT_I_2 = 0x42;
static const unsigned char PI = 0x43;
static const unsigned char LITERAL_C = 0x44;
static const unsigned char ATTRIBUTE = 0x80;
static const unsigned char EXT_T_0 = 0x80;
static const unsigned char EXT_T_1 = 0x81;
static const unsigned char EXT_T_2 = 0x82;
static const unsigned char STR_T = 0x83;
static const unsigned char LITERAL_A = 0x84;
static const unsigned char EXT_0 = 0xC0;
static const unsigned char EXT_1 = 0xC1;
static const unsigned char EXT_2 = 0xC2;
static const unsigned char OPAQUE = 0xC3;
static const unsigned char LITERAL_AC = 0xC4;
// our own extensions
static const unsigned char STR_D = EXT_I_0;
static const unsigned char STR_R = EXT_T_0;
// class definitions
static std::map<std::string, unsigned char> tags;
static std::map<std::string, unsigned char> attributes;
static std::map<std::string, unsigned char> values;
// outputstream variables
std::ostream& os;
bool singlePrecision;
bool isBigEndian;
// document variables
std::map<std::string, unsigned int> stringValues;
// tag variables
std::map<std::string, std::string> stringAttributes;
std::map<std::string, std::vector<double> > colorAttributes;
std::map<std::string, int64> longAttributes;
std::map<std::string, int> intAttributes;
std::map<std::string, bool> booleanAttributes;
std::map<std::string, double> doubleAttributes;
// point array
std::vector<double> points;
// methods
void writeTag(std::string name, bool content = false);
void writePoints();
void writeStringDefine(std::string s);
void writeMultiByteInt(unsigned int ui);
void writeReal(double ui);
void writeLong(int64 i);
void writeInt(int i);
void writeByte(unsigned char b);
void writeString(std::string s);
};
} // cheprep
#endif // CHEPREP_BHEPREPWRITER_H
// Copyright FreeHEP, 2005.
#ifndef CHEPREP_BHEPREPWRITER_H
#define CHEPREP_BHEPREPWRITER_H
#include "cheprep/config.h"
#include <string>
#include <iostream>
#include <vector>
#include <map>
#include "cheprep/AbstractXMLWriter.h"
/**
* @author Mark Donszelmann
*/
namespace cheprep {
class BHepRepWriter : public AbstractXMLWriter {
public:
BHepRepWriter(std::ostream& os);
virtual ~BHepRepWriter();
void close();
void openDoc(std::string version = "BinaryHepRep/1.0", std::string encoding = "UTF-8", bool standalone = false);
void closeDoc(bool force = false);
void openTag(std::string name);
void closeTag();
void printTag(std::string name);
void setAttribute(std::string name, char* value);
void setAttribute(std::string name, std::string value);
void setAttribute(std::string name, std::vector<double> value);
void setAttribute(std::string name, int64 value);
void setAttribute(std::string name, int value);
void setAttribute(std::string name, bool value);
void setAttribute(std::string name, double value);
//
// Can be removed when we can properly inherit those (since names are equal to overloaded ones).
//
void openTag(std::string ns, std::string name) {
openTag(ns == defaultNameSpace ? name : ns.append(":").append(name));
}
void printTag(std::string ns, std::string name) {
printTag(ns == defaultNameSpace ? name : ns.append(":").append(name));
}
void setAttribute(std::string ns, std::string name, std::string value) {
setAttribute(ns.append(":").append(name), value);
}
void setAttribute(std::string ns, std::string name, double value) {
setAttribute(ns.append(":").append(name), value);
}
private:
static const unsigned char WBXML_VERSION = 0x03;
static const unsigned char UNKNOWN_PID = 0x01;
static const unsigned char UTF8 = 0x6a;
// standard tags
static const unsigned char SWITCH_PAGE = 0x00;
static const unsigned char END = 0x01;
static const unsigned char ENTITY = 0x02;
static const unsigned char STR_I = 0x03;
static const unsigned char LITERAL = 0x04;
static const unsigned char CONTENT = 0x40;
static const unsigned char EXT_I_0 = 0x40;
static const unsigned char EXT_I_1 = 0x41;
static const unsigned char EXT_I_2 = 0x42;
static const unsigned char PI = 0x43;
static const unsigned char LITERAL_C = 0x44;
static const unsigned char ATTRIBUTE = 0x80;
static const unsigned char EXT_T_0 = 0x80;
static const unsigned char EXT_T_1 = 0x81;
static const unsigned char EXT_T_2 = 0x82;
static const unsigned char STR_T = 0x83;
static const unsigned char LITERAL_A = 0x84;
static const unsigned char EXT_0 = 0xC0;
static const unsigned char EXT_1 = 0xC1;
static const unsigned char EXT_2 = 0xC2;
static const unsigned char OPAQUE = 0xC3;
static const unsigned char LITERAL_AC = 0xC4;
// our own extensions
static const unsigned char STR_D = EXT_I_0;
static const unsigned char STR_R = EXT_T_0;
// class definitions
static std::map<std::string, unsigned char> tags;
static std::map<std::string, unsigned char> attributes;
static std::map<std::string, unsigned char> values;
// outputstream variables
std::ostream& os;
bool singlePrecision;
bool isBigEndian;
// document variables
std::map<std::string, unsigned int> stringValues;
// tag variables
std::map<std::string, std::string> stringAttributes;
std::map<std::string, std::vector<double> > colorAttributes;
std::map<std::string, int64> longAttributes;
std::map<std::string, int> intAttributes;
std::map<std::string, bool> booleanAttributes;
std::map<std::string, double> doubleAttributes;
// point array
std::vector<double> points;
// methods
void writeTag(std::string name, bool content = false);
void writePoints();
void writeStringDefine(std::string s);
void writeMultiByteInt(unsigned int ui);
void writeReal(double ui);
void writeLong(int64 i);
void writeInt(int i);
void writeByte(unsigned char b);
void writeString(std::string s);
};
} // cheprep
#endif // CHEPREP_BHEPREPWRITER_H
@@ -1,63 +1,62 @@
// Copyright FreeHEP, 2005.
#ifndef CHEPREP_DEFAULTHEPREP_H
#define CHEPREP_DEFAULTHEPREP_H 1
#include "cheprep/config.h"
#include <string>
#include <vector>
#include <set>
#include "HEPREP/HepRep.h"
#include "HEPREP/HepRepSelectFilter.h"
#include "HEPREP/HepRepWriter.h"
#include "HEPREP/HepRepType.h"
#include "HEPREP/HepRepTypeTree.h"
#include "HEPREP/HepRepInstanceTree.h"
/**
* @author Mark Donszelmann
* @version $Id: DefaultHepRep.h 66373 2012-12-18 09:41:34Z gcosmo $
*/
namespace cheprep {
class DefaultHepRep : public virtual HEPREP::HepRep {
private:
std::vector<std::string> layers;
std::vector<HEPREP::HepRepTypeTree*> typeTrees;
std::vector<HEPREP::HepRepInstanceTree*> instanceTrees;
public:
DefaultHepRep();
~DefaultHepRep();
HEPREP::HepRep* copy(HEPREP::HepRepSelectFilter* filter);
std::vector<std::string> getLayerOrder();
void addLayer(std::string layer);
void addTypeTree(HEPREP::HepRepTypeTree* typeTree);
void removeTypeTree(HEPREP::HepRepTypeTree* typeTree);
HEPREP::HepRepTypeTree* getTypeTree(std::string name, std::string version);
std::vector<HEPREP::HepRepTypeTree*> getTypeTreeList();
void addInstanceTree(HEPREP::HepRepInstanceTree* instanceTree);
void overlayInstanceTree(HEPREP::HepRepInstanceTree * instanceTree);
void removeInstanceTree(HEPREP::HepRepInstanceTree* instanceTree);
HEPREP::HepRepInstanceTree* getInstanceTreeTop(std::string name, std::string version);
HEPREP::HepRepInstanceTree* getInstances(std::string name, std::string version,
std::vector<std::string> typeNames);
HEPREP::HepRepInstanceTree* getInstancesAfterAction(
std::string name,
std::string version,
std::vector<std::string> typeNames,
std::vector<HEPREP::HepRepAction*> actions,
bool getPoints,
bool getDrawAtts,
bool getNonDrawAtts,
std::vector<std::string> invertAtts);
std::string checkForException();
std::vector<HEPREP::HepRepInstanceTree*> getInstanceTreeList();
};
} // cheprep
#endif
// Copyright FreeHEP, 2005.
#ifndef CHEPREP_DEFAULTHEPREP_H
#define CHEPREP_DEFAULTHEPREP_H 1
#include "cheprep/config.h"
#include <string>
#include <vector>
#include <set>
#include "HEPREP/HepRep.h"
#include "HEPREP/HepRepSelectFilter.h"
#include "HEPREP/HepRepWriter.h"
#include "HEPREP/HepRepType.h"
#include "HEPREP/HepRepTypeTree.h"
#include "HEPREP/HepRepInstanceTree.h"
/**
* @author Mark Donszelmann
*/
namespace cheprep {
class DefaultHepRep : public virtual HEPREP::HepRep {
private:
std::vector<std::string> layers;
std::vector<HEPREP::HepRepTypeTree*> typeTrees;
std::vector<HEPREP::HepRepInstanceTree*> instanceTrees;
public:
DefaultHepRep();
~DefaultHepRep();
HEPREP::HepRep* copy(HEPREP::HepRepSelectFilter* filter);
std::vector<std::string> getLayerOrder();
void addLayer(std::string layer);
void addTypeTree(HEPREP::HepRepTypeTree* typeTree);
void removeTypeTree(HEPREP::HepRepTypeTree* typeTree);
HEPREP::HepRepTypeTree* getTypeTree(std::string name, std::string version);
std::vector<HEPREP::HepRepTypeTree*> getTypeTreeList();
void addInstanceTree(HEPREP::HepRepInstanceTree* instanceTree);
void overlayInstanceTree(HEPREP::HepRepInstanceTree * instanceTree);
void removeInstanceTree(HEPREP::HepRepInstanceTree* instanceTree);
HEPREP::HepRepInstanceTree* getInstanceTreeTop(std::string name, std::string version);
HEPREP::HepRepInstanceTree* getInstances(std::string name, std::string version,
std::vector<std::string> typeNames);
HEPREP::HepRepInstanceTree* getInstancesAfterAction(
std::string name,
std::string version,
std::vector<std::string> typeNames,
std::vector<HEPREP::HepRepAction*> actions,
bool getPoints,
bool getDrawAtts,
bool getNonDrawAtts,
std::vector<std::string> invertAtts);
std::string checkForException();
std::vector<HEPREP::HepRepInstanceTree*> getInstanceTreeList();
};
} // cheprep
#endif
@@ -1,35 +1,34 @@
// Copyright FreeHEP, 2005.
#ifndef CHEPREP_DEFAULTHEPREPACTION_H
#define CHEPREP_DEFAULTHEPREPACTION_H 1
#include "cheprep/config.h"
#include <string>
#include "HEPREP/HepRepAction.h"
/**
* @author Mark Donszelmann
* @version $Id: DefaultHepRepAction.h 66373 2012-12-18 09:41:34Z gcosmo $
*/
namespace cheprep {
class DefaultHepRepAction : public virtual HEPREP::HepRepAction {
private:
std::string name;
std::string expression;
public:
DefaultHepRepAction(std::string name, std::string expression);
~DefaultHepRepAction();
std::string getName();
std::string getExpression();
HEPREP::HepRepAction* copy();
};
} // cheprep
#endif
// Copyright FreeHEP, 2005.
#ifndef CHEPREP_DEFAULTHEPREPACTION_H
#define CHEPREP_DEFAULTHEPREPACTION_H 1
#include "cheprep/config.h"
#include <string>
#include "HEPREP/HepRepAction.h"
/**
* @author Mark Donszelmann
*/
namespace cheprep {
class DefaultHepRepAction : public virtual HEPREP::HepRepAction {
private:
std::string name;
std::string expression;
public:
DefaultHepRepAction(std::string name, std::string expression);
~DefaultHepRepAction();
std::string getName();
std::string getExpression();
HEPREP::HepRepAction* copy();
};
} // cheprep
#endif
@@ -1,37 +1,36 @@
// Copyright FreeHEP, 2005.
#ifndef CHEPREP_DEFAULTHEPREPATTDEF_H
#define CHEPREP_DEFAULTHEPREPATTDEF_H 1
#include "cheprep/config.h"
#include <string>
#include "HEPREP/HepRepAttDef.h"
/**
* @author Mark Donszelmann
* @version $Id: DefaultHepRepAttDef.h 66373 2012-12-18 09:41:34Z gcosmo $
*/
namespace cheprep {
class DefaultHepRepAttDef : public virtual HEPREP::HepRepAttDef {
private:
std::string name, desc, category, extra;
public:
DefaultHepRepAttDef(std::string name, std::string desc, std::string category, std::string extra);
~DefaultHepRepAttDef();
HEPREP::HepRepAttDef* copy();
std::string getName();
std::string getLowerCaseName();
std::string getDescription();
std::string getCategory();
std::string getExtra();
};
} // cheprep
#endif
// Copyright FreeHEP, 2005.
#ifndef CHEPREP_DEFAULTHEPREPATTDEF_H
#define CHEPREP_DEFAULTHEPREPATTDEF_H 1
#include "cheprep/config.h"
#include <string>
#include "HEPREP/HepRepAttDef.h"
/**
* @author Mark Donszelmann
*/
namespace cheprep {
class DefaultHepRepAttDef : public virtual HEPREP::HepRepAttDef {
private:
std::string name, desc, category, extra;
public:
DefaultHepRepAttDef(std::string name, std::string desc, std::string category, std::string extra);
~DefaultHepRepAttDef();
HEPREP::HepRepAttDef* copy();
std::string getName();
std::string getLowerCaseName();
std::string getDescription();
std::string getCategory();
std::string getExtra();
};
} // cheprep
#endif
@@ -1,76 +1,75 @@
// Copyright FreeHEP, 2005.
#ifndef CHEPREP_DEFAULTHEPREPATTVALUE_H
#define CHEPREP_DEFAULTHEPREPATTVALUE_H 1
#include "cheprep/config.h"
#include <string>
#include "HEPREP/HepRepAttValue.h"
/**
* @author Mark Donszelmann
* @version $Id: DefaultHepRepAttValue.h 66870 2013-01-14 23:38:59Z adotti $
*/
namespace cheprep {
class DefaultHepRepAttValue : public virtual HEPREP::HepRepAttValue {
private:
enum { LABELSTRINGS_LEN = 4 };
std::string name;
int type;
// values implemented as separate items, so that they do not take up unnecessary space for an Object
// only ONE of these is filled
std::string stringValue;
int64 longValue;
double doubleValue;
bool booleanValue;
std::vector<double> colorValue;
int showLabelValue;
static std::string labelStrings[LABELSTRINGS_LEN];
void init();
public:
DefaultHepRepAttValue(std::string name, std::string value, int showLabel);
DefaultHepRepAttValue(std::string name, int64 value, int showLabel);
DefaultHepRepAttValue(std::string name, int value, int showLabel);
DefaultHepRepAttValue(std::string name, double value, int showLabel);
DefaultHepRepAttValue(std::string name, bool value, int showLabel);
DefaultHepRepAttValue(std::string name, std::vector<double> value, int showLabel);
~DefaultHepRepAttValue();
HEPREP::HepRepAttValue* copy();
std::string getName();
std::string getLowerCaseName();
int getType();
std::string getTypeName();
int showLabel();
std::string getString();
std::string getLowerCaseString();
int64 getLong();
int getInteger();
double getDouble();
bool getBoolean();
std::vector<double> getColor();
std::string getAsString();
static std::string getAsString(std::vector<double> c);
static std::string getAsString(int i);
static std::string getAsString(int64 i);
static std::string getAsString(double d);
static std::string getAsString(bool b);
std::string toShowLabel();
static std::string toShowLabel(int showLabel);
};
} // cheprep
#endif
// Copyright FreeHEP, 2005.
#ifndef CHEPREP_DEFAULTHEPREPATTVALUE_H
#define CHEPREP_DEFAULTHEPREPATTVALUE_H 1
#include "cheprep/config.h"
#include <string>
#include "HEPREP/HepRepAttValue.h"
/**
* @author Mark Donszelmann
*/
namespace cheprep {
class DefaultHepRepAttValue : public virtual HEPREP::HepRepAttValue {
private:
enum { LABELSTRINGS_LEN = 4 };
std::string name;
int type;
// values implemented as separate items, so that they do not take up unnecessary space for an Object
// only ONE of these is filled
std::string stringValue;
int64 longValue;
double doubleValue;
bool booleanValue;
std::vector<double> colorValue;
int showLabelValue;
static std::string labelStrings[LABELSTRINGS_LEN];
void init();
public:
DefaultHepRepAttValue(std::string name, std::string value, int showLabel);
DefaultHepRepAttValue(std::string name, int64 value, int showLabel);
DefaultHepRepAttValue(std::string name, int value, int showLabel);
DefaultHepRepAttValue(std::string name, double value, int showLabel);
DefaultHepRepAttValue(std::string name, bool value, int showLabel);
DefaultHepRepAttValue(std::string name, std::vector<double> value, int showLabel);
~DefaultHepRepAttValue();
HEPREP::HepRepAttValue* copy();
std::string getName();
std::string getLowerCaseName();
int getType();
std::string getTypeName();
int showLabel();
std::string getString();
std::string getLowerCaseString();
int64 getLong();
int getInteger();
double getDouble();
bool getBoolean();
std::vector<double> getColor();
std::string getAsString();
static std::string getAsString(std::vector<double> c);
static std::string getAsString(int i);
static std::string getAsString(int64 i);
static std::string getAsString(double d);
static std::string getAsString(bool b);
std::string toShowLabel();
static std::string toShowLabel(int showLabel);
};
} // cheprep
#endif
@@ -1,51 +1,50 @@
// Copyright FreeHEP, 2005.
#ifndef CHEPREP_DEFAULTHEPREPATTRIBUTE_H
#define CHEPREP_DEFAULTHEPREPATTRIBUTE_H 1
#include "cheprep/config.h"
#include <string>
#include <map>
#include <set>
#include <vector>
#include "HEPREP/HepRepAttribute.h"
#include "HEPREP/HepRepAttValue.h"
#include "HEPREP/HepRepConstants.h"
#include "HEPREP/HepRepWriter.h"
/**
* @author Mark Donszelmann
* @version $Id: DefaultHepRepAttribute.h 66373 2012-12-18 09:41:34Z gcosmo $
*/
namespace cheprep {
class DefaultHepRepAttribute : public virtual HEPREP::HepRepAttribute {
private:
std::map<std::string, HEPREP::HepRepAttValue*> attValues;
public:
DefaultHepRepAttribute();
~DefaultHepRepAttribute();
std::set<HEPREP::HepRepAttValue*> getAttValuesFromNode();
void addAttValue(HEPREP::HepRepAttValue* hepRepAttValue);
void addAttValue(std::string key, char *value, int showLabel);
void addAttValue(std::string key, std::string value, int showLabel);
void addAttValue(std::string key, int value, int showLabel);
void addAttValue(std::string key, int64 value, int showLabel);
void addAttValue(std::string key, double value, int showLabel);
void addAttValue(std::string key, bool value, int showLabel);
void addAttValue(std::string key, std::vector<double> value, int showLabel);
void addAttValue(std::string key, double red, double green, double blue, double alpha, int showLabel);
HEPREP::HepRepAttValue* getAttValueFromNode(std::string lowerCaseName);
HEPREP::HepRepAttValue* removeAttValue(std::string key);
HEPREP::HepRepAttValue* getAttValue(std::string name) = 0;
};
} // cheprep
#endif
// Copyright FreeHEP, 2005.
#ifndef CHEPREP_DEFAULTHEPREPATTRIBUTE_H
#define CHEPREP_DEFAULTHEPREPATTRIBUTE_H 1
#include "cheprep/config.h"
#include <string>
#include <map>
#include <set>
#include <vector>
#include "HEPREP/HepRepAttribute.h"
#include "HEPREP/HepRepAttValue.h"
#include "HEPREP/HepRepConstants.h"
#include "HEPREP/HepRepWriter.h"
/**
* @author Mark Donszelmann
*/
namespace cheprep {
class DefaultHepRepAttribute : public virtual HEPREP::HepRepAttribute {
private:
std::map<std::string, HEPREP::HepRepAttValue*> attValues;
public:
DefaultHepRepAttribute();
~DefaultHepRepAttribute();
std::set<HEPREP::HepRepAttValue*> getAttValuesFromNode();
void addAttValue(HEPREP::HepRepAttValue* hepRepAttValue);
void addAttValue(std::string key, char *value, int showLabel);
void addAttValue(std::string key, std::string value, int showLabel);
void addAttValue(std::string key, int value, int showLabel);
void addAttValue(std::string key, int64 value, int showLabel);
void addAttValue(std::string key, double value, int showLabel);
void addAttValue(std::string key, bool value, int showLabel);
void addAttValue(std::string key, std::vector<double> value, int showLabel);
void addAttValue(std::string key, double red, double green, double blue, double alpha, int showLabel);
HEPREP::HepRepAttValue* getAttValueFromNode(std::string lowerCaseName);
HEPREP::HepRepAttValue* removeAttValue(std::string key);
HEPREP::HepRepAttValue* getAttValue(std::string name) = 0;
};
} // cheprep
#endif
@@ -1,43 +1,42 @@
// Copyright FreeHEP, 2005.
#ifndef CHEPREP_DEFAULTHEPREPDEFINITION_H
#define CHEPREP_DEFAULTHEPREPDEFINITION_H 1
#include "cheprep/config.h"
#include <string>
#include <vector>
#include <set>
#include "HEPREP/HepRepDefinition.h"
#include "HEPREP/HepRepWriter.h"
#include "DefaultHepRepAttribute.h"
/**
* @author Mark Donszelmann
* @version $Id: DefaultHepRepDefinition.h 66373 2012-12-18 09:41:34Z gcosmo $
*/
namespace cheprep {
class DefaultHepRepDefinition : public DefaultHepRepAttribute, public virtual HEPREP::HepRepDefinition {
private:
std::map<std::string, HEPREP::HepRepAttDef*> attDefs;
public:
DefaultHepRepDefinition();
~DefaultHepRepDefinition();
void addAttDef(HEPREP::HepRepAttDef* hepRepAttDef);
void addAttDef(std::string name, std::string desc, std::string type, std::string extra);
std::set<HEPREP::HepRepAttDef *> getAttDefsFromNode();
HEPREP::HepRepAttDef* getAttDefFromNode(std::string lowerCaseName);
HEPREP::HepRepAttDef* getAttDef(std::string name) = 0;
HEPREP::HepRepAttValue* getAttValue(std::string name) = 0;
};
} // cheprep
#endif
// Copyright FreeHEP, 2005.
#ifndef CHEPREP_DEFAULTHEPREPDEFINITION_H
#define CHEPREP_DEFAULTHEPREPDEFINITION_H 1
#include "cheprep/config.h"
#include <string>
#include <vector>
#include <set>
#include "HEPREP/HepRepDefinition.h"
#include "HEPREP/HepRepWriter.h"
#include "DefaultHepRepAttribute.h"
/**
* @author Mark Donszelmann
*/
namespace cheprep {
class DefaultHepRepDefinition : public DefaultHepRepAttribute, public virtual HEPREP::HepRepDefinition {
private:
std::map<std::string, HEPREP::HepRepAttDef*> attDefs;
public:
DefaultHepRepDefinition();
~DefaultHepRepDefinition();
void addAttDef(HEPREP::HepRepAttDef* hepRepAttDef);
void addAttDef(std::string name, std::string desc, std::string type, std::string extra);
std::set<HEPREP::HepRepAttDef *> getAttDefsFromNode();
HEPREP::HepRepAttDef* getAttDefFromNode(std::string lowerCaseName);
HEPREP::HepRepAttDef* getAttDef(std::string name) = 0;
HEPREP::HepRepAttValue* getAttValue(std::string name) = 0;
};
} // cheprep
#endif
@@ -1,55 +1,54 @@
// Copyright FreeHEP, 2005.
#ifndef CHEPREP_DEFAULTHEPREPFACTORY_H
#define CHEPREP_DEFAULTHEPREPFACTORY_H 1
#include "cheprep/config.h"
#include <string>
#include <iostream>
#include "HEPREP/HepRep.h"
#include "HEPREP/HepRepFactory.h"
#include "HEPREP/HepRepReader.h"
#include "HEPREP/HepRepWriter.h"
#include "HEPREP/HepRepPoint.h"
#include "HEPREP/HepRepInstance.h"
#include "HEPREP/HepRepInstanceTree.h"
#include "HEPREP/HepRepTreeID.h"
#include "HEPREP/HepRepAction.h"
#include "HEPREP/HepRepType.h"
#include "HEPREP/HepRepTypeTree.h"
/**
* @author Mark Donszelmann
* @version $Id: DefaultHepRepFactory.h 66373 2012-12-18 09:41:34Z gcosmo $
*/
namespace cheprep {
class DefaultHepRepFactory : public virtual HEPREP::HepRepFactory {
public:
DefaultHepRepFactory();
~DefaultHepRepFactory();
// static HEPREP::HepRepFactory* create();
HEPREP::HepRepReader* createHepRepReader (std::istream* in);
HEPREP::HepRepReader* createHepRepReader (std::string filename);
HEPREP::HepRepWriter* createHepRepWriter (std::ostream* out, bool randomAccess, bool compress);
HEPREP::HepRepPoint* createHepRepPoint (HEPREP::HepRepInstance* instance,
double x, double y, double z);
HEPREP::HepRepInstance* createHepRepInstance (HEPREP::HepRepInstance* parent, HEPREP::HepRepType* type);
HEPREP::HepRepInstance* createHepRepInstance (HEPREP::HepRepInstanceTree* parent, HEPREP::HepRepType* type);
HEPREP::HepRepTreeID* createHepRepTreeID (std::string name, std::string version, std::string qualifier = "top-level");
HEPREP::HepRepAction* createHepRepAction (std::string name, std::string expression);
HEPREP::HepRepInstanceTree* createHepRepInstanceTree (std::string name, std::string version,
HEPREP::HepRepTreeID* typeTreeID);
HEPREP::HepRepType* createHepRepType (HEPREP::HepRepType* parent, std::string name);
HEPREP::HepRepType* createHepRepType (HEPREP::HepRepTypeTree* parent, std::string name);
HEPREP::HepRepTypeTree* createHepRepTypeTree (HEPREP::HepRepTreeID* treeID);
HEPREP::HepRep* createHepRep ();
};
} // cheprep
#endif
// Copyright FreeHEP, 2005.
#ifndef CHEPREP_DEFAULTHEPREPFACTORY_H
#define CHEPREP_DEFAULTHEPREPFACTORY_H 1
#include "cheprep/config.h"
#include <string>
#include <iostream>
#include "HEPREP/HepRep.h"
#include "HEPREP/HepRepFactory.h"
#include "HEPREP/HepRepReader.h"
#include "HEPREP/HepRepWriter.h"
#include "HEPREP/HepRepPoint.h"
#include "HEPREP/HepRepInstance.h"
#include "HEPREP/HepRepInstanceTree.h"
#include "HEPREP/HepRepTreeID.h"
#include "HEPREP/HepRepAction.h"
#include "HEPREP/HepRepType.h"
#include "HEPREP/HepRepTypeTree.h"
/**
* @author Mark Donszelmann
*/
namespace cheprep {
class DefaultHepRepFactory : public virtual HEPREP::HepRepFactory {
public:
DefaultHepRepFactory();
~DefaultHepRepFactory();
// static HEPREP::HepRepFactory* create();
HEPREP::HepRepReader* createHepRepReader (std::istream* in);
HEPREP::HepRepReader* createHepRepReader (std::string filename);
HEPREP::HepRepWriter* createHepRepWriter (std::ostream* out, bool randomAccess, bool compress);
HEPREP::HepRepPoint* createHepRepPoint (HEPREP::HepRepInstance* instance,
double x, double y, double z);
HEPREP::HepRepInstance* createHepRepInstance (HEPREP::HepRepInstance* parent, HEPREP::HepRepType* type);
HEPREP::HepRepInstance* createHepRepInstance (HEPREP::HepRepInstanceTree* parent, HEPREP::HepRepType* type);
HEPREP::HepRepTreeID* createHepRepTreeID (std::string name, std::string version, std::string qualifier = "top-level");
HEPREP::HepRepAction* createHepRepAction (std::string name, std::string expression);
HEPREP::HepRepInstanceTree* createHepRepInstanceTree (std::string name, std::string version,
HEPREP::HepRepTreeID* typeTreeID);
HEPREP::HepRepType* createHepRepType (HEPREP::HepRepType* parent, std::string name);
HEPREP::HepRepType* createHepRepType (HEPREP::HepRepTypeTree* parent, std::string name);
HEPREP::HepRepTypeTree* createHepRepTypeTree (HEPREP::HepRepTreeID* treeID);
HEPREP::HepRep* createHepRep ();
};
} // cheprep
#endif
@@ -1,59 +1,58 @@
// Copyright FreeHEP, 2005.
#ifndef CHEPREP_DEFAULTHEPREPINSTANCE_H
#define CHEPREP_DEFAULTHEPREPINSTANCE_H 1
#include "cheprep/config.h"
#include <string>
#include <vector>
#include "HEPREP/HepRep.h"
#include "HEPREP/HepRepSelectFilter.h"
#include "HEPREP/HepRepInstanceTree.h"
#include "HEPREP/HepRepInstance.h"
#include "HEPREP/HepRepWriter.h"
#include "HEPREP/HepRepType.h"
#include "HEPREP/HepRepPoint.h"
#include "HEPREP/HepRepAttValue.h"
#include "DefaultHepRepAttribute.h"
/**
* @author Mark Donszelmann
* @version $Id: DefaultHepRepInstance.h 66373 2012-12-18 09:41:34Z gcosmo $
*/
namespace cheprep {
class DefaultHepRepInstance : public DefaultHepRepAttribute, public virtual HEPREP::HepRepInstance {
private:
HEPREP::HepRepInstance* parent;
HEPREP::HepRepType* type;
std::vector<HEPREP::HepRepPoint*> points;
std::vector<HEPREP::HepRepInstance*> instances;
public:
DefaultHepRepInstance(HEPREP::HepRepInstance* parent, HEPREP::HepRepType* type);
DefaultHepRepInstance(HEPREP::HepRepInstanceTree* parent, HEPREP::HepRepType* type);
~DefaultHepRepInstance();
void overlay(HEPREP::HepRepInstance * instance);
HEPREP::HepRepInstance* copy(HEPREP::HepRepTypeTree* typeTree, HEPREP::HepRepInstance* parent, HEPREP::HepRepSelectFilter* filter);
HEPREP::HepRepInstance* copy(HEPREP::HepRepTypeTree* typeTree, HEPREP::HepRepInstanceTree* parent, HEPREP::HepRepSelectFilter* filter);
HEPREP::HepRepType* getType();
void addPoint(HEPREP::HepRepPoint* point);
std::vector<HEPREP::HepRepPoint *> getPoints();
HEPREP::HepRepInstance* getSuperInstance();
void addInstance(HEPREP::HepRepInstance* instance);
void removeInstance(HEPREP::HepRepInstance* instance);
std::vector<HEPREP::HepRepInstance *> getInstances();
HEPREP::HepRepAttValue* getAttValue(std::string name);
void *getParent() { return parent; }
};
} // cheprep
#endif
// Copyright FreeHEP, 2005.
#ifndef CHEPREP_DEFAULTHEPREPINSTANCE_H
#define CHEPREP_DEFAULTHEPREPINSTANCE_H 1
#include "cheprep/config.h"
#include <string>
#include <vector>
#include "HEPREP/HepRep.h"
#include "HEPREP/HepRepSelectFilter.h"
#include "HEPREP/HepRepInstanceTree.h"
#include "HEPREP/HepRepInstance.h"
#include "HEPREP/HepRepWriter.h"
#include "HEPREP/HepRepType.h"
#include "HEPREP/HepRepPoint.h"
#include "HEPREP/HepRepAttValue.h"
#include "DefaultHepRepAttribute.h"
/**
* @author Mark Donszelmann
*/
namespace cheprep {
class DefaultHepRepInstance : public DefaultHepRepAttribute, public virtual HEPREP::HepRepInstance {
private:
HEPREP::HepRepInstance* parent;
HEPREP::HepRepType* type;
std::vector<HEPREP::HepRepPoint*> points;
std::vector<HEPREP::HepRepInstance*> instances;
public:
DefaultHepRepInstance(HEPREP::HepRepInstance* parent, HEPREP::HepRepType* type);
DefaultHepRepInstance(HEPREP::HepRepInstanceTree* parent, HEPREP::HepRepType* type);
~DefaultHepRepInstance();
void overlay(HEPREP::HepRepInstance * instance);
HEPREP::HepRepInstance* copy(HEPREP::HepRepTypeTree* typeTree, HEPREP::HepRepInstance* parent, HEPREP::HepRepSelectFilter* filter);
HEPREP::HepRepInstance* copy(HEPREP::HepRepTypeTree* typeTree, HEPREP::HepRepInstanceTree* parent, HEPREP::HepRepSelectFilter* filter);
HEPREP::HepRepType* getType();
void addPoint(HEPREP::HepRepPoint* point);
std::vector<HEPREP::HepRepPoint *> getPoints();
HEPREP::HepRepInstance* getSuperInstance();
void addInstance(HEPREP::HepRepInstance* instance);
void removeInstance(HEPREP::HepRepInstance* instance);
std::vector<HEPREP::HepRepInstance *> getInstances();
HEPREP::HepRepAttValue* getAttValue(std::string name);
void *getParent() { return parent; }
};
} // cheprep
#endif
@@ -1,50 +1,49 @@
// Copyright FreeHEP, 2005.
#ifndef CHEPREP_DEFAULTHEPREPINSTANCETREE_H
#define CHEPREP_DEFAULTHEPREPINSTANCETREE_H 1
#include "cheprep/config.h"
#include <string>
#include <vector>
#include <set>
#include "HEPREP/HepRep.h"
#include "HEPREP/HepRepSelectFilter.h"
#include "HEPREP/HepRepInstanceTree.h"
#include "HEPREP/HepRepInstance.h"
#include "HEPREP/HepRepWriter.h"
#include "HEPREP/HepRepTreeID.h"
#include "DefaultHepRepTreeID.h"
/**
* @author Mark Donszelmann
* @version $Id: DefaultHepRepInstanceTree.h 66373 2012-12-18 09:41:34Z gcosmo $
*/
namespace cheprep {
class DefaultHepRepInstanceTree : public DefaultHepRepTreeID, public virtual HEPREP::HepRepInstanceTree {
private:
HEPREP::HepRepTreeID* typeTree;
std::vector<HEPREP::HepRepInstance*> instances;
std::vector<HEPREP::HepRepTreeID*> instanceTrees;
public:
DefaultHepRepInstanceTree(std::string name, std::string version, HEPREP::HepRepTreeID* typeTree);
~DefaultHepRepInstanceTree();
void overlay(HEPREP::HepRepInstanceTree * instanceTree);
HEPREP::HepRepInstanceTree* copy(HEPREP::HepRepTypeTree* typeTree, HEPREP::HepRepSelectFilter* filter);
void addInstance(HEPREP::HepRepInstance* instance);
void removeInstance(HEPREP::HepRepInstance* instance);
std::vector<HEPREP::HepRepInstance*> getInstances();
void addInstanceTree(HEPREP::HepRepTreeID* treeID);
HEPREP::HepRepTreeID* getTypeTree();
std::vector<HEPREP::HepRepTreeID*> getInstanceTreeList();
};
} // cheprep
#endif
// Copyright FreeHEP, 2005.
#ifndef CHEPREP_DEFAULTHEPREPINSTANCETREE_H
#define CHEPREP_DEFAULTHEPREPINSTANCETREE_H 1
#include "cheprep/config.h"
#include <string>
#include <vector>
#include <set>
#include "HEPREP/HepRep.h"
#include "HEPREP/HepRepSelectFilter.h"
#include "HEPREP/HepRepInstanceTree.h"
#include "HEPREP/HepRepInstance.h"
#include "HEPREP/HepRepWriter.h"
#include "HEPREP/HepRepTreeID.h"
#include "DefaultHepRepTreeID.h"
/**
* @author Mark Donszelmann
*/
namespace cheprep {
class DefaultHepRepInstanceTree : public DefaultHepRepTreeID, public virtual HEPREP::HepRepInstanceTree {
private:
HEPREP::HepRepTreeID* typeTree;
std::vector<HEPREP::HepRepInstance*> instances;
std::vector<HEPREP::HepRepTreeID*> instanceTrees;
public:
DefaultHepRepInstanceTree(std::string name, std::string version, HEPREP::HepRepTreeID* typeTree);
~DefaultHepRepInstanceTree();
void overlay(HEPREP::HepRepInstanceTree * instanceTree);
HEPREP::HepRepInstanceTree* copy(HEPREP::HepRepTypeTree* typeTree, HEPREP::HepRepSelectFilter* filter);
void addInstance(HEPREP::HepRepInstance* instance);
void removeInstance(HEPREP::HepRepInstance* instance);
std::vector<HEPREP::HepRepInstance*> getInstances();
void addInstanceTree(HEPREP::HepRepTreeID* treeID);
HEPREP::HepRepTreeID* getTypeTree();
std::vector<HEPREP::HepRepTreeID*> getInstanceTreeList();
};
} // cheprep
#endif
@@ -1,62 +1,61 @@
// Copyright FreeHEP, 2005.
#ifndef CHEPREP_DEFAULTHEPREPPOINT_H
#define CHEPREP_DEFAULTHEPREPPOINT_H 1
#include "cheprep/config.h"
#include <string>
#include <vector>
#include "HEPREP/HepRepInstance.h"
#include "HEPREP/HepRepWriter.h"
#include "HEPREP/HepRepAttValue.h"
#include "HEPREP/HepRepPoint.h"
#include "DefaultHepRepAttribute.h"
/**
* @author Mark Donszelmann
* @version $Id: DefaultHepRepPoint.h 66373 2012-12-18 09:41:34Z gcosmo $
*/
namespace cheprep {
class DefaultHepRepPoint : public DefaultHepRepAttribute, public virtual HEPREP::HepRepPoint {
private:
HEPREP::HepRepInstance* instance;
protected:
double x, y, z;
public:
DefaultHepRepPoint(HEPREP::HepRepInstance* instance, double x, double y, double z);
~DefaultHepRepPoint();
HEPREP::HepRepInstance* getInstance();
HEPREP::HepRepAttValue* getAttValue(std::string lowerCaseName);
HEPREP::HepRepPoint* copy(HEPREP::HepRepInstance* parent);
double getX();
double getY();
double getZ();
std::vector<double>* getXYZ(std::vector<double>* xyz);
double getRho();
double getPhi();
double getTheta();
double getR();
double getEta();
double getX(double xVertex, double yVertex, double zVertex);
double getY(double xVertex, double yVertex, double zVertex);
double getZ(double xVertex, double yVertex, double zVertex);
double getRho(double xVertex, double yVertex, double zVertex);
double getPhi(double xVertex, double yVertex, double zVertex);
double getTheta(double xVertex, double yVertex, double zVertex);
double getR(double xVertex, double yVertex, double zVertex);
double getEta(double xVertex, double yVertex, double zVertex);
};
} // cheprep
#endif
// Copyright FreeHEP, 2005.
#ifndef CHEPREP_DEFAULTHEPREPPOINT_H
#define CHEPREP_DEFAULTHEPREPPOINT_H 1
#include "cheprep/config.h"
#include <string>
#include <vector>
#include "HEPREP/HepRepInstance.h"
#include "HEPREP/HepRepWriter.h"
#include "HEPREP/HepRepAttValue.h"
#include "HEPREP/HepRepPoint.h"
#include "DefaultHepRepAttribute.h"
/**
* @author Mark Donszelmann
*/
namespace cheprep {
class DefaultHepRepPoint : public DefaultHepRepAttribute, public virtual HEPREP::HepRepPoint {
private:
HEPREP::HepRepInstance* instance;
protected:
double x, y, z;
public:
DefaultHepRepPoint(HEPREP::HepRepInstance* instance, double x, double y, double z);
~DefaultHepRepPoint();
HEPREP::HepRepInstance* getInstance();
HEPREP::HepRepAttValue* getAttValue(std::string lowerCaseName);
HEPREP::HepRepPoint* copy(HEPREP::HepRepInstance* parent);
double getX();
double getY();
double getZ();
std::vector<double>* getXYZ(std::vector<double>* xyz);
double getRho();
double getPhi();
double getTheta();
double getR();
double getEta();
double getX(double xVertex, double yVertex, double zVertex);
double getY(double xVertex, double yVertex, double zVertex);
double getZ(double xVertex, double yVertex, double zVertex);
double getRho(double xVertex, double yVertex, double zVertex);
double getPhi(double xVertex, double yVertex, double zVertex);
double getTheta(double xVertex, double yVertex, double zVertex);
double getR(double xVertex, double yVertex, double zVertex);
double getEta(double xVertex, double yVertex, double zVertex);
};
} // cheprep
#endif
@@ -1,37 +1,36 @@
// Copyright FreeHEP, 2005.
#ifndef CHEPREP_DEFAULTHEPREPTREEID_H
#define CHEPREP_DEFAULTHEPREPTREEID_H 1
#include "cheprep/config.h"
#include <string>
#include "HEPREP/HepRepTreeID.h"
/**
* @author Mark Donszelmann
* @version $Id: DefaultHepRepTreeID.h 66373 2012-12-18 09:41:34Z gcosmo $
*/
namespace cheprep {
class DefaultHepRepTreeID : public virtual HEPREP::HepRepTreeID {
private:
std::string name;
std::string version;
std::string qualifier;
public:
DefaultHepRepTreeID(std::string name, std::string version, std::string qualifier = "top_level");
~DefaultHepRepTreeID();
std::string getQualifier();
void setQualifier(std::string qualifier);
std::string getName();
std::string getVersion();
};
} // cheprep
#endif
// Copyright FreeHEP, 2005.
#ifndef CHEPREP_DEFAULTHEPREPTREEID_H
#define CHEPREP_DEFAULTHEPREPTREEID_H 1
#include "cheprep/config.h"
#include <string>
#include "HEPREP/HepRepTreeID.h"
/**
* @author Mark Donszelmann
*/
namespace cheprep {
class DefaultHepRepTreeID : public virtual HEPREP::HepRepTreeID {
private:
std::string name;
std::string version;
std::string qualifier;
public:
DefaultHepRepTreeID(std::string name, std::string version, std::string qualifier = "top_level");
~DefaultHepRepTreeID();
std::string getQualifier();
void setQualifier(std::string qualifier);
std::string getName();
std::string getVersion();
};
} // cheprep
#endif
@@ -1,56 +1,55 @@
// Copyright FreeHEP, 2005.
#ifndef CHEPREP_DEFAULTHEPREPTYPE_H
#define CHEPREP_DEFAULTHEPREPTYPE_H 1
#include "cheprep/config.h"
#include <string>
#include <vector>
#include <set>
#include "HEPREP/HepRep.h"
#include "HEPREP/HepRepType.h"
#include "HEPREP/HepRepAttDef.h"
#include "HEPREP/HepRepAttValue.h"
#include "HEPREP/HepRepWriter.h"
#include "DefaultHepRepDefinition.h"
/**
* @author Mark Donszelmann
* @version $Id: DefaultHepRepType.h 66373 2012-12-18 09:41:34Z gcosmo $
*/
namespace cheprep {
class DefaultHepRepType : public DefaultHepRepDefinition, public virtual HEPREP::HepRepType {
private:
HEPREP::HepRepType* parent;
std::vector<HEPREP::HepRepType*> types;
std::string name;
std::string description;
std::string infoURL;
public:
DefaultHepRepType(HEPREP::HepRepType* parent, std::string name);
DefaultHepRepType(HEPREP::HepRepTypeTree* parent, std::string name);
~DefaultHepRepType();
HEPREP::HepRepType* getSuperType();
HEPREP::HepRepAttDef* getAttDef(std::string name);
HEPREP::HepRepAttValue* getAttValue(std::string name);
HEPREP::HepRepType* copy(HEPREP::HepRepType* parent);
std::string getName();
std::string getFullName();
std::string getDescription();
void setDescription(std::string description);
std::string getInfoURL();
void setInfoURL(std::string infoURL);
void addType(HEPREP::HepRepType* type);
std::vector<HEPREP::HepRepType*> getTypeList();
};
} // cheprep
#endif
// Copyright FreeHEP, 2005.
#ifndef CHEPREP_DEFAULTHEPREPTYPE_H
#define CHEPREP_DEFAULTHEPREPTYPE_H 1
#include "cheprep/config.h"
#include <string>
#include <vector>
#include <set>
#include "HEPREP/HepRep.h"
#include "HEPREP/HepRepType.h"
#include "HEPREP/HepRepAttDef.h"
#include "HEPREP/HepRepAttValue.h"
#include "HEPREP/HepRepWriter.h"
#include "DefaultHepRepDefinition.h"
/**
* @author Mark Donszelmann
*/
namespace cheprep {
class DefaultHepRepType : public DefaultHepRepDefinition, public virtual HEPREP::HepRepType {
private:
HEPREP::HepRepType* parent;
std::vector<HEPREP::HepRepType*> types;
std::string name;
std::string description;
std::string infoURL;
public:
DefaultHepRepType(HEPREP::HepRepType* parent, std::string name);
DefaultHepRepType(HEPREP::HepRepTypeTree* parent, std::string name);
~DefaultHepRepType();
HEPREP::HepRepType* getSuperType();
HEPREP::HepRepAttDef* getAttDef(std::string name);
HEPREP::HepRepAttValue* getAttValue(std::string name);
HEPREP::HepRepType* copy(HEPREP::HepRepType* parent);
std::string getName();
std::string getFullName();
std::string getDescription();
void setDescription(std::string description);
std::string getInfoURL();
void setInfoURL(std::string infoURL);
void addType(HEPREP::HepRepType* type);
std::vector<HEPREP::HepRepType*> getTypeList();
};
} // cheprep
#endif
@@ -1,43 +1,42 @@
// Copyright FreeHEP, 2005.
#ifndef CHEPREP_DEFAULTHEPREPTYPETREE_H
#define CHEPREP_DEFAULTHEPREPTYPETREE_H 1
#include "cheprep/config.h"
#include <string>
#include <vector>
#include <set>
#include "HEPREP/HepRep.h"
#include "HEPREP/HepRepTypeTree.h"
#include "HEPREP/HepRepType.h"
#include "HEPREP/HepRepWriter.h"
#include "HEPREP/HepRepTreeID.h"
#include "DefaultHepRepTreeID.h"
/**
* @author Mark Donszelmann
* @version $Id: DefaultHepRepTypeTree.h 66373 2012-12-18 09:41:34Z gcosmo $
*/
namespace cheprep {
class DefaultHepRepTypeTree : public DefaultHepRepTreeID, public virtual HEPREP::HepRepTypeTree {
private:
std::vector<HEPREP::HepRepType*> types;
public:
DefaultHepRepTypeTree(HEPREP::HepRepTreeID* typeTree);
~DefaultHepRepTypeTree();
HEPREP::HepRepTypeTree* copy();
void addType(HEPREP::HepRepType* type);
std::vector<HEPREP::HepRepType* > getTypeList();
HEPREP::HepRepType* getType(std::string name);
};
} // cheprep
#endif
// Copyright FreeHEP, 2005.
#ifndef CHEPREP_DEFAULTHEPREPTYPETREE_H
#define CHEPREP_DEFAULTHEPREPTYPETREE_H 1
#include "cheprep/config.h"
#include <string>
#include <vector>
#include <set>
#include "HEPREP/HepRep.h"
#include "HEPREP/HepRepTypeTree.h"
#include "HEPREP/HepRepType.h"
#include "HEPREP/HepRepWriter.h"
#include "HEPREP/HepRepTreeID.h"
#include "DefaultHepRepTreeID.h"
/**
* @author Mark Donszelmann
*/
namespace cheprep {
class DefaultHepRepTypeTree : public DefaultHepRepTreeID, public virtual HEPREP::HepRepTypeTree {
private:
std::vector<HEPREP::HepRepType*> types;
public:
DefaultHepRepTypeTree(HEPREP::HepRepTreeID* typeTree);
~DefaultHepRepTypeTree();
HEPREP::HepRepTypeTree* copy();
void addType(HEPREP::HepRepType* type);
std::vector<HEPREP::HepRepType* > getTypeList();
HEPREP::HepRepType* getType(std::string name);
};
} // cheprep
#endif
@@ -1,99 +1,98 @@
// Copyright FreeHEP, 2005.
#ifndef CHEPREP_DEFLATEOUTPUTSTREAMBUF_H
#define CHEPREP_DEFLATEOUTPUTSTREAMBUF_H
#include <vector>
#include <iostream>
#include <string>
#include <cstdio>
#ifndef CHEPREP_NO_ZLIB
#include <zlib.h>
#endif // CHEPREP_NO_ZLIB
/**
* @author Mark Donszelmann
* @version $Id: DeflateOutputStreamBuffer.h 66870 2013-01-14 23:38:59Z adotti $
*/
namespace cheprep {
class DeflateOutputStreamBuffer : public std::streambuf {
public:
DeflateOutputStreamBuffer(std::streambuf *buffer);
void init(bool compress);
void finish();
virtual ~DeflateOutputStreamBuffer();
protected:
int overflow(int c = EOF);
#ifndef CHEPREP_NO_ZLIB
bool flushOut();
#endif // CHEPREP_NO_ZLIB
inline void putUI(unsigned int ui) {
unsigned char* ucp = reinterpret_cast<unsigned char *>(&ui);
unsigned int i = (static_cast<unsigned int>(ucp[ 3 ]) << 24) +
(static_cast<unsigned int>(ucp[ 2 ]) << 16) +
(static_cast<unsigned int>(ucp[ 1 ]) << 8 ) +
(static_cast<unsigned int>(ucp[ 0 ]));
buffer->sputn(reinterpret_cast<char *>(&i), sizeof(unsigned int));
}
inline void putUS(unsigned short us) {
unsigned char* ucp = reinterpret_cast<unsigned char *>(&us);
unsigned short s = (static_cast<unsigned short>(ucp[ 1 ]) << 8 ) +
(static_cast<unsigned short>(ucp[ 0 ]));
buffer->sputn(reinterpret_cast<char *>(&s), sizeof(unsigned short));
}
inline void putUB(unsigned char ub) {
buffer->sputc(ub);
}
inline void putS(const std::string s) {
buffer->sputn(s.c_str(), s.length());
}
inline std::streampos pos() {
std::ostream os(buffer);
return os.tellp();
}
inline unsigned int getSize() {
return size;
}
inline unsigned int getCRC() {
return crc;
}
private:
static unsigned long crctable[256];
std::streambuf *buffer;
unsigned int crc;
unsigned int size;
#ifndef CHEPREP_NO_ZLIB
static const unsigned int inSize = 1000;
static const unsigned int outSize = 1000;
z_stream zStream;
bool zStreamOpen;
std::vector<char> in;
std::vector<char> out;
#endif // CHEPREP_NO_ZLIB
};
} // cheprep
#endif // CHEPREP_DEFLATEOUTPUTSTREAMBUF_H
// Copyright FreeHEP, 2005.
#ifndef CHEPREP_DEFLATEOUTPUTSTREAMBUF_H
#define CHEPREP_DEFLATEOUTPUTSTREAMBUF_H
#include <vector>
#include <iostream>
#include <string>
#include <cstdio>
#ifndef CHEPREP_NO_ZLIB
#include <zlib.h>
#endif // CHEPREP_NO_ZLIB
/**
* @author Mark Donszelmann
*/
namespace cheprep {
class DeflateOutputStreamBuffer : public std::streambuf {
public:
DeflateOutputStreamBuffer(std::streambuf *buffer);
void init(bool compress);
void finish();
virtual ~DeflateOutputStreamBuffer();
protected:
int overflow(int c = EOF);
#ifndef CHEPREP_NO_ZLIB
bool flushOut();
#endif // CHEPREP_NO_ZLIB
inline void putUI(unsigned int ui) {
unsigned char* ucp = reinterpret_cast<unsigned char *>(&ui);
unsigned int i = (static_cast<unsigned int>(ucp[ 3 ]) << 24) +
(static_cast<unsigned int>(ucp[ 2 ]) << 16) +
(static_cast<unsigned int>(ucp[ 1 ]) << 8 ) +
(static_cast<unsigned int>(ucp[ 0 ]));
buffer->sputn(reinterpret_cast<char *>(&i), sizeof(unsigned int));
}
inline void putUS(unsigned short us) {
unsigned char* ucp = reinterpret_cast<unsigned char *>(&us);
unsigned short s = (static_cast<unsigned short>(ucp[ 1 ]) << 8 ) +
(static_cast<unsigned short>(ucp[ 0 ]));
buffer->sputn(reinterpret_cast<char *>(&s), sizeof(unsigned short));
}
inline void putUB(unsigned char ub) {
buffer->sputc(ub);
}
inline void putS(const std::string s) {
buffer->sputn(s.c_str(), s.length());
}
inline std::streampos pos() {
std::ostream os(buffer);
return os.tellp();
}
inline unsigned int getSize() {
return size;
}
inline unsigned int getCRC() {
return crc;
}
private:
static unsigned long crctable[256];
std::streambuf *buffer;
unsigned int crc;
unsigned int size;
#ifndef CHEPREP_NO_ZLIB
static const unsigned int inSize = 1000;
static const unsigned int outSize = 1000;
z_stream zStream;
bool zStreamOpen;
std::vector<char> in;
std::vector<char> out;
#endif // CHEPREP_NO_ZLIB
};
} // cheprep
#endif // CHEPREP_DEFLATEOUTPUTSTREAMBUF_H
@@ -1,34 +1,33 @@
// Copyright FreeHEP, 2005.
#ifndef CHEPREP_GZIPOUTPUTSTREAM_H
#define CHEPREP_GZIPOUTPUTSTREAM_H
#include <string>
#include "cheprep/GZIPOutputStreamBuffer.h"
/**
* @author Mark Donszelmann
* @version $Id: GZIPOutputStream.h 66373 2012-12-18 09:41:34Z gcosmo $
*/
namespace cheprep {
class GZIPOutputStream : public std::ostream {
public:
GZIPOutputStream(std::ostream &os);
void setFilename(const std::string &filename);
void setComment(const std::string &comment);
void close();
virtual ~GZIPOutputStream();
private:
GZIPOutputStreamBuffer *buffer;
};
} // cheprep.
#endif // CHEPREP_GZIPOUTPUTSTREAM_H
// Copyright FreeHEP, 2005.
#ifndef CHEPREP_GZIPOUTPUTSTREAM_H
#define CHEPREP_GZIPOUTPUTSTREAM_H
#include <string>
#include "cheprep/GZIPOutputStreamBuffer.h"
/**
* @author Mark Donszelmann
*/
namespace cheprep {
class GZIPOutputStream : public std::ostream {
public:
GZIPOutputStream(std::ostream &os);
void setFilename(const std::string &filename);
void setComment(const std::string &comment);
void close();
virtual ~GZIPOutputStream();
private:
GZIPOutputStreamBuffer *buffer;
};
} // cheprep.
#endif // CHEPREP_GZIPOUTPUTSTREAM_H
@@ -1,42 +1,41 @@
// Copyright FreeHEP, 2005.
#ifndef CHEPREP_GZIPOUTPUTSTREAMBUF_H
#define CHEPREP_GZIPOUTPUTSTREAMBUF_H
#include <string>
#include "cheprep/DeflateOutputStreamBuffer.h"
/**
* @author Mark Donszelmann
* @version $Id: GZIPOutputStreamBuffer.h 66373 2012-12-18 09:41:34Z gcosmo $
*/
namespace cheprep {
class GZIPOutputStreamBuffer : public DeflateOutputStreamBuffer {
public:
GZIPOutputStreamBuffer( std::streambuf *outbuf );
int overflow(int);
void setFilename( const std::string &filename );
void setComment( const std::string &comment );
void close() ;
virtual ~GZIPOutputStreamBuffer() ;
private:
void writeHeader();
void writeTrailer();
std::string filename;
std::string comment;
bool open;
};
} // cheprep
#endif // CHEPREP_GZIPOUTPUTSTREAMBUF_H
// Copyright FreeHEP, 2005.
#ifndef CHEPREP_GZIPOUTPUTSTREAMBUF_H
#define CHEPREP_GZIPOUTPUTSTREAMBUF_H
#include <string>
#include "cheprep/DeflateOutputStreamBuffer.h"
/**
* @author Mark Donszelmann
*/
namespace cheprep {
class GZIPOutputStreamBuffer : public DeflateOutputStreamBuffer {
public:
GZIPOutputStreamBuffer( std::streambuf *outbuf );
int overflow(int);
void setFilename( const std::string &filename );
void setComment( const std::string &comment );
void close() ;
virtual ~GZIPOutputStreamBuffer() ;
private:
void writeHeader();
void writeTrailer();
std::string filename;
std::string comment;
bool open;
};
} // cheprep
#endif // CHEPREP_GZIPOUTPUTSTREAMBUF_H
@@ -1,55 +1,54 @@
// Copyright FreeHEP, 2005.
#ifndef CHEPREP_INDENTPRINTWRITER_H
#define CHEPREP_INDENTPRINTWRITER_H 1
#include "cheprep/config.h"
#include <iostream>
#include <string>
/**
* A PrintWriter that keeps track of an indentation level
* and indents the output appropriately.
*
* <b>Warning:</b> Only print and println methods taking strings have been overriden,
* print, println methods taking other arguments may not be indented properly.
*
* @author Mark Donszelmann
* @version $Id: IndentPrintWriter.h 66373 2012-12-18 09:41:34Z gcosmo $
*/
namespace cheprep {
class IndentPrintWriter {
public:
IndentPrintWriter(std::ostream* out, int level = 0);
virtual ~IndentPrintWriter();
void close();
IndentPrintWriter& operator<< (const std::string & s);
IndentPrintWriter& operator<< (std::ostream& (*pf)(std::ostream&));
void println(const std::string & s);
void print(const std::string & s);
void println();
void indent();
void outdent();
int getIndent() const;
void setIndent(const int level);
std::string getIndentString() const;
void setIndentString(const std::string & indentString);
private:
void doIndent();
std::ostream* out;
bool closed;
int indentLevel;
bool indented;
std::string indentString;
};
} // cheprep
#endif
// Copyright FreeHEP, 2005.
#ifndef CHEPREP_INDENTPRINTWRITER_H
#define CHEPREP_INDENTPRINTWRITER_H 1
#include "cheprep/config.h"
#include <iostream>
#include <string>
/**
* A PrintWriter that keeps track of an indentation level
* and indents the output appropriately.
*
* <b>Warning:</b> Only print and println methods taking strings have been overriden,
* print, println methods taking other arguments may not be indented properly.
*
* @author Mark Donszelmann
*/
namespace cheprep {
class IndentPrintWriter {
public:
IndentPrintWriter(std::ostream* out, int level = 0);
virtual ~IndentPrintWriter();
void close();
IndentPrintWriter& operator<< (const std::string & s);
IndentPrintWriter& operator<< (std::ostream& (*pf)(std::ostream&));
void println(const std::string & s);
void print(const std::string & s);
void println();
void indent();
void outdent();
int getIndent() const;
void setIndent(const int level);
std::string getIndentString() const;
void setIndentString(const std::string & indentString);
private:
void doIndent();
std::ostream* out;
bool closed;
int indentLevel;
bool indented;
std::string indentString;
};
} // cheprep
#endif
@@ -1,33 +1,32 @@
// Copyright FreeHEP, 2005.
#ifndef XMLHEPREPFACTORY_H
#define XMLHEPREPFACTORY_H 1
#include <string>
#include <iostream>
#include "HEPREP/HepRepReader.h"
#include "HEPREP/HepRepWriter.h"
#include "DefaultHepRepFactory.h"
/**
* @author Mark Donszelmann
* @version $Id: XMLHepRepFactory.h 66373 2012-12-18 09:41:34Z gcosmo $
*/
namespace cheprep {
class XMLHepRepFactory : public DefaultHepRepFactory {
public:
XMLHepRepFactory();
~XMLHepRepFactory();
HEPREP::HepRepReader* createHepRepReader (std::istream* in);
HEPREP::HepRepReader* createHepRepReader (std::string filename);
HEPREP::HepRepWriter* createHepRepWriter (std::ostream* out, bool randomAccess, bool compress);
};
} // cheprep
#endif
// Copyright FreeHEP, 2005.
#ifndef XMLHEPREPFACTORY_H
#define XMLHEPREPFACTORY_H 1
#include <string>
#include <iostream>
#include "HEPREP/HepRepReader.h"
#include "HEPREP/HepRepWriter.h"
#include "DefaultHepRepFactory.h"
/**
* @author Mark Donszelmann
*/
namespace cheprep {
class XMLHepRepFactory : public DefaultHepRepFactory {
public:
XMLHepRepFactory();
~XMLHepRepFactory();
HEPREP::HepRepReader* createHepRepReader (std::istream* in);
HEPREP::HepRepReader* createHepRepReader (std::string filename);
HEPREP::HepRepWriter* createHepRepWriter (std::ostream* out, bool randomAccess, bool compress);
};
} // cheprep
#endif
@@ -1,73 +1,72 @@
// Copyright FreeHEP, 2005.
#ifndef CHEPREP_XMLHEPREPWRITER_H
#define CHEPREP_XMLHEPREPWRITER_H 1
#include "cheprep/config.h"
#include <iostream>
#include <string>
#include <stack>
#include <set>
#include <vector>
#include <map>
#include "HEPREP/HepRep.h"
#include "HEPREP/HepRepFactory.h"
#include "HEPREP/HepRepWriter.h"
#include "HEPREP/HepRepPoint.h"
#include "HEPREP/HepRepInstance.h"
#include "HEPREP/HepRepInstanceTree.h"
#include "HEPREP/HepRepTreeID.h"
#include "HEPREP/HepRepAction.h"
#include "HEPREP/HepRepType.h"
#include "HEPREP/HepRepTypeTree.h"
#include "HEPREP/HepRepAttDef.h"
#include "HEPREP/HepRepAttValue.h"
#include "HEPREP/HepRepAttribute.h"
#include "cheprep/AbstractXMLWriter.h"
#include "cheprep/ZipOutputStream.h"
#include "cheprep/GZIPOutputStream.h"
/**
* @author Mark Donszelmann
* @version $Id: XMLHepRepWriter.h 66373 2012-12-18 09:41:34Z gcosmo $
*/
namespace cheprep {
class XMLHepRepWriter : public virtual HEPREP::HepRepWriter {
private:
std::ostream *out;
bool compress;
std::string nameSpace;
AbstractXMLWriter *xml;
cheprep::ZipOutputStream *zip;
cheprep::GZIPOutputStream *gz;
std::map<std::string, std::string> properties;
public:
XMLHepRepWriter(std::ostream* out, bool randomAccess, bool compress);
~XMLHepRepWriter();
bool addProperty(std::string key, std::string value);
bool close();
bool write(HEPREP::HepRep* heprep, std::string name);
bool write(std::vector<std::string> layers);
bool write(HEPREP::HepRepTypeTree* typeTree);
bool write(HEPREP::HepRepType* type);
bool write(HEPREP::HepRepTreeID* treeID);
bool write(HEPREP::HepRepAction* action);
bool write(HEPREP::HepRepInstanceTree* instanceTree);
bool write(HEPREP::HepRepInstance* instance);
bool write(HEPREP::HepRepPoint* point);
bool write(HEPREP::HepRepAttribute* attribute);
bool write(HEPREP::HepRepDefinition* definition);
bool write(HEPREP::HepRepAttValue* attValue);
bool write(HEPREP::HepRepAttDef* attDef);
};
} // cheprep
#endif
// Copyright FreeHEP, 2005.
#ifndef CHEPREP_XMLHEPREPWRITER_H
#define CHEPREP_XMLHEPREPWRITER_H 1
#include "cheprep/config.h"
#include <iostream>
#include <string>
#include <stack>
#include <set>
#include <vector>
#include <map>
#include "HEPREP/HepRep.h"
#include "HEPREP/HepRepFactory.h"
#include "HEPREP/HepRepWriter.h"
#include "HEPREP/HepRepPoint.h"
#include "HEPREP/HepRepInstance.h"
#include "HEPREP/HepRepInstanceTree.h"
#include "HEPREP/HepRepTreeID.h"
#include "HEPREP/HepRepAction.h"
#include "HEPREP/HepRepType.h"
#include "HEPREP/HepRepTypeTree.h"
#include "HEPREP/HepRepAttDef.h"
#include "HEPREP/HepRepAttValue.h"
#include "HEPREP/HepRepAttribute.h"
#include "cheprep/AbstractXMLWriter.h"
#include "cheprep/ZipOutputStream.h"
#include "cheprep/GZIPOutputStream.h"
/**
* @author Mark Donszelmann
*/
namespace cheprep {
class XMLHepRepWriter : public virtual HEPREP::HepRepWriter {
private:
std::ostream *out;
bool compress;
std::string nameSpace;
AbstractXMLWriter *xml;
cheprep::ZipOutputStream *zip;
cheprep::GZIPOutputStream *gz;
std::map<std::string, std::string> properties;
public:
XMLHepRepWriter(std::ostream* out, bool randomAccess, bool compress);
~XMLHepRepWriter();
bool addProperty(std::string key, std::string value);
bool close();
bool write(HEPREP::HepRep* heprep, std::string name);
bool write(std::vector<std::string> layers);
bool write(HEPREP::HepRepTypeTree* typeTree);
bool write(HEPREP::HepRepType* type);
bool write(HEPREP::HepRepTreeID* treeID);
bool write(HEPREP::HepRepAction* action);
bool write(HEPREP::HepRepInstanceTree* instanceTree);
bool write(HEPREP::HepRepInstance* instance);
bool write(HEPREP::HepRepPoint* point);
bool write(HEPREP::HepRepAttribute* attribute);
bool write(HEPREP::HepRepDefinition* definition);
bool write(HEPREP::HepRepAttValue* attValue);
bool write(HEPREP::HepRepAttDef* attDef);
};
} // cheprep
#endif
@@ -1,81 +1,80 @@
// Copyright FreeHEP, 2005.
#ifndef CHEPREP_XMLWRITER_H
#define CHEPREP_XMLWRITER_H 1
#include "cheprep/config.h"
#include <iostream>
#include <map>
#include <stack>
#include <vector>
#include <string>
#include "cheprep/AbstractXMLWriter.h"
#include "cheprep/IndentPrintWriter.h"
/**
* @author Mark Donszelmann
* @version $Id: XMLWriter.h 66373 2012-12-18 09:41:34Z gcosmo $
*/
namespace cheprep {
class XMLWriter : public AbstractXMLWriter {
public:
XMLWriter(std::ostream* out, std::string indentString = " ", std::string defaultNameSpace = "");
virtual ~XMLWriter();
void close();
void openDoc(std::string version = "1.0", std::string encoding = "", bool standalone = false);
void referToDTD(std::string name, std::string pid, std::string ref);
void referToDTD(std::string name, std::string system);
void closeDoc(bool force = false);
void printComment(std::string comment);
void printPlain(std::string text);
void print(std::string text);
void println(std::string text);
void openTag(std::string name);
void closeTag();
void printTag(std::string name);
void setAttribute(std::string name, char* value);
void setAttribute(std::string name, std::string value);
void setAttribute(std::string name, std::vector<double> value);
void setAttribute(std::string name, int64 value);
void setAttribute(std::string name, int value);
void setAttribute(std::string name, bool value);
void setAttribute(std::string name, double value);
void printAttributes(int tagLength);
std::string normalize(std::string s);
std::string normalizeText(std::string s);
void checkNameValid(std::string s);
//
// Can be removed when we can properly inherit those (since names are equal to overloaded ones).
//
void openTag(std::string ns, std::string name) {
openTag(ns == defaultNameSpace ? name : ns.append(":").append(name));
}
void printTag(std::string ns, std::string name) {
printTag(ns == defaultNameSpace ? name : ns.append(":").append(name));
}
void setAttribute(std::string ns, std::string name, std::string value) {
setAttribute(ns.append(":").append(name), value);
}
void setAttribute(std::string ns, std::string name, double value) {
setAttribute(ns.append(":").append(name), value);
}
protected:
bool closed;
IndentPrintWriter* writer;
private:
std::string dtdName;
std::map<std::string, std::string> attributes;
std::stack<std::string> openTags;
};
} // cheprep
#endif
// Copyright FreeHEP, 2005.
#ifndef CHEPREP_XMLWRITER_H
#define CHEPREP_XMLWRITER_H 1
#include "cheprep/config.h"
#include <iostream>
#include <map>
#include <stack>
#include <vector>
#include <string>
#include "cheprep/AbstractXMLWriter.h"
#include "cheprep/IndentPrintWriter.h"
/**
* @author Mark Donszelmann
*/
namespace cheprep {
class XMLWriter : public AbstractXMLWriter {
public:
XMLWriter(std::ostream* out, std::string indentString = " ", std::string defaultNameSpace = "");
virtual ~XMLWriter();
void close();
void openDoc(std::string version = "1.0", std::string encoding = "", bool standalone = false);
void referToDTD(std::string name, std::string pid, std::string ref);
void referToDTD(std::string name, std::string system);
void closeDoc(bool force = false);
void printComment(std::string comment);
void printPlain(std::string text);
void print(std::string text);
void println(std::string text);
void openTag(std::string name);
void closeTag();
void printTag(std::string name);
void setAttribute(std::string name, char* value);
void setAttribute(std::string name, std::string value);
void setAttribute(std::string name, std::vector<double> value);
void setAttribute(std::string name, int64 value);
void setAttribute(std::string name, int value);
void setAttribute(std::string name, bool value);
void setAttribute(std::string name, double value);
void printAttributes(int tagLength);
std::string normalize(std::string s);
std::string normalizeText(std::string s);
void checkNameValid(std::string s);
//
// Can be removed when we can properly inherit those (since names are equal to overloaded ones).
//
void openTag(std::string ns, std::string name) {
openTag(ns == defaultNameSpace ? name : ns.append(":").append(name));
}
void printTag(std::string ns, std::string name) {
printTag(ns == defaultNameSpace ? name : ns.append(":").append(name));
}
void setAttribute(std::string ns, std::string name, std::string value) {
setAttribute(ns.append(":").append(name), value);
}
void setAttribute(std::string ns, std::string name, double value) {
setAttribute(ns.append(":").append(name), value);
}
protected:
bool closed;
IndentPrintWriter* writer;
private:
std::string dtdName;
std::map<std::string, std::string> attributes;
std::stack<std::string> openTags;
};
} // cheprep
#endif
@@ -1,37 +1,36 @@
// Copyright FreeHEP, 2005.
#ifndef CHEPREP_ZIPENTRY_H
#define CHEPREP_ZIPENTRY_H
#include <string>
#include <vector>
/**
* @author Mark Donszelmann
* @version $Id: ZipEntry.h 66373 2012-12-18 09:41:34Z gcosmo $
*/
namespace cheprep {
class ZipEntry {
public:
std::string name;
int method;
int date;
int time;
unsigned int crc;
unsigned int size;
unsigned int csize;
long offset;
long data;
ZipEntry() {
}
virtual ~ZipEntry() {
}
};
} // cheprep
#endif // CHEPREP_ZIPENTRY_H
// Copyright FreeHEP, 2005.
#ifndef CHEPREP_ZIPENTRY_H
#define CHEPREP_ZIPENTRY_H
#include <string>
#include <vector>
/**
* @author Mark Donszelmann
*/
namespace cheprep {
class ZipEntry {
public:
std::string name;
int method;
int date;
int time;
unsigned int crc;
unsigned int size;
unsigned int csize;
long offset;
long data;
ZipEntry() {
}
virtual ~ZipEntry() {
}
};
} // cheprep
#endif // CHEPREP_ZIPENTRY_H
@@ -1,40 +1,39 @@
// Copyright FreeHEP, 2005.
#ifndef CHEPREP_ZIPOUTPUTSTREAM_H
#define CHEPREP_ZIPOUTPUTSTREAM_H
#include <string>
#include <iostream>
#include <vector>
/**
* @author Mark Donszelmann
* @version $Id: ZipOutputStream.h 66373 2012-12-18 09:41:34Z gcosmo $
*/
namespace cheprep {
class ZipOutputStreamBuffer;
class ZipOutputStream : public std::ostream {
public:
ZipOutputStream(std::ostream& os);
void closeEntry();
void close();
void putNextEntry(const std::string& name, bool compress);
void setComment(const std::string& comment);
virtual ~ZipOutputStream();
private:
ZipOutputStreamBuffer* buffer;
};
} // cheprep
#endif // CHEPREP_ZIPOUTPUTSTREAM_H
// Copyright FreeHEP, 2005.
#ifndef CHEPREP_ZIPOUTPUTSTREAM_H
#define CHEPREP_ZIPOUTPUTSTREAM_H
#include <string>
#include <iostream>
#include <vector>
/**
* @author Mark Donszelmann
*/
namespace cheprep {
class ZipOutputStreamBuffer;
class ZipOutputStream : public std::ostream {
public:
ZipOutputStream(std::ostream& os);
void closeEntry();
void close();
void putNextEntry(const std::string& name, bool compress);
void setComment(const std::string& comment);
virtual ~ZipOutputStream();
private:
ZipOutputStreamBuffer* buffer;
};
} // cheprep
#endif // CHEPREP_ZIPOUTPUTSTREAM_H
@@ -1,58 +1,57 @@
// Copyright FreeHEP, 2005.
#ifndef CHEPREP_ZIPOUTPUTSTREAMBUFFER_H
#define CHEPREP_ZIPOUTPUTSTREAMBUFFER_H
#include <string>
#include <iostream>
#include <vector>
#include "cheprep/DeflateOutputStreamBuffer.h"
/**
* @author Mark Donszelmann
* @version $Id: ZipOutputStreamBuffer.h 66373 2012-12-18 09:41:34Z gcosmo $
*/
namespace cheprep {
class ZipEntry;
class ZipOutputStreamBuffer : public DeflateOutputStreamBuffer {
public:
ZipOutputStreamBuffer(std::streambuf* buffer);
int overflow(int c);
void closeEntry();
void close();
void putNextEntry(const std::string& name, bool compress);
void setMethod(int method);
void setComment(const std::string& comment);
virtual ~ZipOutputStreamBuffer();
private:
std::string comment;
bool closed;
ZipEntry* entry;
std::vector<ZipEntry*>* entries;
static const unsigned int LOCSIG = 0x04034b50;
static const unsigned int EXTSIG = 0x08074b50;
static const unsigned int CENSIG = 0x02014b50;
static const unsigned int ENDSIG = 0x06054b50;
static const unsigned int VERSIONMADE = 0x0014;
static const unsigned int VERSIONEXTRACT = 0x0014;
static const unsigned int GENFLAG = 0x0008;
};
} // cheprep
#endif // CHEPREP_ZIPOUTPUTSTREAMBUFFER_H
// Copyright FreeHEP, 2005.
#ifndef CHEPREP_ZIPOUTPUTSTREAMBUFFER_H
#define CHEPREP_ZIPOUTPUTSTREAMBUFFER_H
#include <string>
#include <iostream>
#include <vector>
#include "cheprep/DeflateOutputStreamBuffer.h"
/**
* @author Mark Donszelmann
*/
namespace cheprep {
class ZipEntry;
class ZipOutputStreamBuffer : public DeflateOutputStreamBuffer {
public:
ZipOutputStreamBuffer(std::streambuf* buffer);
int overflow(int c);
void closeEntry();
void close();
void putNextEntry(const std::string& name, bool compress);
void setMethod(int method);
void setComment(const std::string& comment);
virtual ~ZipOutputStreamBuffer();
private:
std::string comment;
bool closed;
ZipEntry* entry;
std::vector<ZipEntry*>* entries;
static const unsigned int LOCSIG = 0x04034b50;
static const unsigned int EXTSIG = 0x08074b50;
static const unsigned int CENSIG = 0x02014b50;
static const unsigned int ENDSIG = 0x06054b50;
static const unsigned int VERSIONMADE = 0x0014;
static const unsigned int VERSIONEXTRACT = 0x0014;
static const unsigned int GENFLAG = 0x0008;
};
} // cheprep
#endif // CHEPREP_ZIPOUTPUTSTREAMBUFFER_H
@@ -1,63 +1,62 @@
// Copyright FreeHEP, 2005.
#ifndef CHEPREP_CONFIG_H
#define CHEPREP_CONFIG_H 1
/**
* @author Mark Donszelmann
* @version $Id: config.h 94590 2015-11-25 11:12:46Z gcosmo $
*/
namespace cheprep {
#if defined(WIN32) && !defined(GNU_GCC)
// WIN32 and NOT GNU_GCC
typedef __int64 int64;
typedef unsigned __int64 uint64;
#define CHEPREP_INT64_FORMAT "%lld"
#define CHEPREP_UINT64_FORMAT "%llu"
#else // other than WIN32-MSVC
#if defined(_LP64)
// 64 Bit Platforms
typedef long int64;
typedef unsigned long uint64;
#define CHEPREP_INT64_FORMAT "%ld"
#define CHEPREP_UINT64_FORMAT "%uld"
#else
// 32-Bit Platforms
typedef long long int64;
typedef unsigned long long uint64;
#define CHEPREP_INT64_FORMAT "%lld"
#define CHEPREP_UINT64_FORMAT "%ulld"
#endif // 32-Bit Platforms
#endif // other than WIN32-MSVC
} // namespace cheprep
#ifdef WIN32
#ifndef GNU_GCC
// Disable warning C4786: identifier was truncated to '255' characters in the debug information
#pragma warning ( disable : 4786 )
// Disable warning C4250: inherits via dominance
#pragma warning ( disable : 4250 )
#ifdef VC6
// FIX for KB 168440 - VC6
// Stream Operator << Cannot Handle __int64 Type
#include<iostream>
inline std::ostream& operator<<(std::ostream& os, __int64 i ) {
char buf[20];
sprintf(buf,"%I64d", i );
os << buf;
return os;
}
#endif // VC6
#endif // GNU_GCC
#endif // WIN32
#endif // CHEPREP_CONFIG_H
// Copyright FreeHEP, 2005.
#ifndef CHEPREP_CONFIG_H
#define CHEPREP_CONFIG_H 1
/**
* @author Mark Donszelmann
*/
namespace cheprep {
#if defined(WIN32) && !defined(GNU_GCC)
// WIN32 and NOT GNU_GCC
typedef __int64 int64;
typedef unsigned __int64 uint64;
#define CHEPREP_INT64_FORMAT "%lld"
#define CHEPREP_UINT64_FORMAT "%llu"
#else // other than WIN32-MSVC
#if defined(_LP64)
// 64 Bit Platforms
typedef long int64;
typedef unsigned long uint64;
#define CHEPREP_INT64_FORMAT "%ld"
#define CHEPREP_UINT64_FORMAT "%uld"
#else
// 32-Bit Platforms
typedef long long int64;
typedef unsigned long long uint64;
#define CHEPREP_INT64_FORMAT "%lld"
#define CHEPREP_UINT64_FORMAT "%ulld"
#endif // 32-Bit Platforms
#endif // other than WIN32-MSVC
} // namespace cheprep
#ifdef WIN32
#ifndef GNU_GCC
// Disable warning C4786: identifier was truncated to '255' characters in the debug information
#pragma warning ( disable : 4786 )
// Disable warning C4250: inherits via dominance
#pragma warning ( disable : 4250 )
#ifdef VC6
// FIX for KB 168440 - VC6
// Stream Operator << Cannot Handle __int64 Type
#include<iostream>
inline std::ostream& operator<<(std::ostream& os, __int64 i ) {
char buf[20];
sprintf(buf,"%I64d", i );
os << buf;
return os;
}
#endif // VC6
#endif // GNU_GCC
#endif // WIN32
#endif // CHEPREP_CONFIG_H