Import Geant4 6.0.0 source tree
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
#ifndef DEFAULTHEPREP_H
|
||||
#define DEFAULTHEPREP_H 1
|
||||
|
||||
#include "FreeHepTypes.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#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 M.Donszelmann
|
||||
*/
|
||||
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();
|
||||
bool addLayer(std::string layer);
|
||||
bool addTypeTree(HEPREP::HepRepTypeTree* typeTree);
|
||||
void removeTypeTree(HEPREP::HepRepTypeTree* typeTree);
|
||||
HEPREP::HepRepTypeTree* getTypeTree(std::string name, std::string version);
|
||||
std::vector<HEPREP::HepRepTypeTree*>* getTypeTrees();
|
||||
HEPREP::HepRepType* getType(std::string name);
|
||||
bool 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*>* getInstanceTrees();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,29 @@
|
||||
#ifndef DEFAULTHEPREPACTION_H
|
||||
#define DEFAULTHEPREPACTION_H 1
|
||||
|
||||
#include "FreeHepTypes.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "HEPREP/HepRepAction.h"
|
||||
|
||||
/**
|
||||
*
|
||||
* @author M.Donszelmann
|
||||
*/
|
||||
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();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,32 @@
|
||||
#ifndef DEFAULTHEPREPATTDEF_H
|
||||
#define DEFAULTHEPREPATTDEF_H 1
|
||||
|
||||
#include "FreeHepTypes.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "HEPREP/HepRepAttDef.h"
|
||||
|
||||
/**
|
||||
*
|
||||
* @author M.Donszelmann
|
||||
*/
|
||||
|
||||
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();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,64 @@
|
||||
#ifndef DEFAULTHEPREPATTVALUE_H
|
||||
#define DEFAULTHEPREPATTVALUE_H 1
|
||||
|
||||
#include "FreeHepTypes.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "HEPREP/HepRepAttValue.h"
|
||||
|
||||
/**
|
||||
*
|
||||
* @author M.Donszelmann
|
||||
*/
|
||||
|
||||
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;
|
||||
long longValue;
|
||||
double doubleValue;
|
||||
bool booleanValue;
|
||||
std::vector<double> colorValue;
|
||||
|
||||
int showLabelValue;
|
||||
std::string labelStrings[LABELSTRINGS_LEN];
|
||||
|
||||
void init();
|
||||
|
||||
public:
|
||||
DefaultHepRepAttValue(std::string name, std::string value, int showLabel);
|
||||
DefaultHepRepAttValue(std::string name, long 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();
|
||||
long getLong();
|
||||
int getInteger();
|
||||
double getDouble();
|
||||
bool getBoolean();
|
||||
std::vector<double> getColor();
|
||||
std::string getAsString();
|
||||
|
||||
std::string toShowLabel();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
#ifndef DEFAULTHEPREPATTRIBUTE_H
|
||||
#define DEFAULTHEPREPATTRIBUTE_H 1
|
||||
|
||||
#include "FreeHepTypes.h"
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
#include "HEPREP/HepRepAttribute.h"
|
||||
#include "HEPREP/HepRepAttValue.h"
|
||||
#include "HEPREP/HepRepConstants.h"
|
||||
#include "HEPREP/HepRepWriter.h"
|
||||
|
||||
/**
|
||||
*
|
||||
* @author M.Donszelmann
|
||||
*/
|
||||
class DefaultHepRepAttribute : public virtual HEPREP::HepRepAttribute {
|
||||
|
||||
private:
|
||||
std::map<std::string, HEPREP::HepRepAttValue*> attValues;
|
||||
std::vector<HEPREP::HepRepAttValue*> attList;
|
||||
|
||||
public:
|
||||
DefaultHepRepAttribute();
|
||||
~DefaultHepRepAttribute();
|
||||
|
||||
std::vector<HEPREP::HepRepAttValue*>* getAttValuesFromNode();
|
||||
bool addAttValue(HEPREP::HepRepAttValue* hepRepAttValue);
|
||||
bool addAttValue(std::string key, char *value, int showLabel);
|
||||
bool addAttValue(std::string key, std::string value, int showLabel);
|
||||
bool addAttValue(std::string key, int value, int showLabel);
|
||||
bool addAttValue(std::string key, double value, int showLabel);
|
||||
bool addAttValue(std::string key, bool value, int showLabel);
|
||||
bool addAttValue(std::string key, std::vector<double> value, int showLabel);
|
||||
bool 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;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,37 @@
|
||||
#ifndef DEFAULTHEPREPDEFINITION_H
|
||||
#define DEFAULTHEPREPDEFINITION_H 1
|
||||
|
||||
#include "FreeHepTypes.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "HEPREP/HepRepDefinition.h"
|
||||
#include "HEPREP/HepRepWriter.h"
|
||||
|
||||
#include "DefaultHepRepAttribute.h"
|
||||
|
||||
/**
|
||||
*
|
||||
* @author M.Donszelmann
|
||||
*/
|
||||
class DefaultHepRepDefinition : public DefaultHepRepAttribute, public virtual HEPREP::HepRepDefinition {
|
||||
|
||||
private:
|
||||
std::map<std::string, HEPREP::HepRepAttDef*> attDefs;
|
||||
std::vector<HEPREP::HepRepAttDef*> attList;
|
||||
|
||||
public:
|
||||
DefaultHepRepDefinition();
|
||||
~DefaultHepRepDefinition();
|
||||
|
||||
bool addAttDef(HEPREP::HepRepAttDef* hepRepAttDef);
|
||||
bool addAttDef(std::string name, std::string desc, std::string type, std::string extra);
|
||||
std::vector<HEPREP::HepRepAttDef *>* getAttDefsFromNode();
|
||||
HEPREP::HepRepAttDef* getAttDefFromNode(std::string lowerCaseName);
|
||||
|
||||
HEPREP::HepRepAttDef* getAttDef(std::string name) = 0;
|
||||
HEPREP::HepRepAttValue* getAttValue(std::string name) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,48 @@
|
||||
#ifndef DEFAULTHEPREPFACTORY_H
|
||||
#define DEFAULTHEPREPFACTORY_H 1
|
||||
|
||||
#include "FreeHepTypes.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 M.Donszelmann
|
||||
*/
|
||||
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::HepRepTypeTree* createHepRepTypeTree (HEPREP::HepRepTreeID* treeID);
|
||||
HEPREP::HepRep* createHepRep ();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,52 @@
|
||||
#ifndef DEFAULTHEPREPINSTANCE_H
|
||||
#define DEFAULTHEPREPINSTANCE_H 1
|
||||
|
||||
#include "FreeHepTypes.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 M.Donszelmann
|
||||
*/
|
||||
class DefaultHepRepInstance : public DefaultHepRepAttribute, public virtual HEPREP::HepRepInstance {
|
||||
|
||||
private:
|
||||
void* 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::HepRep* heprep, HEPREP::HepRepInstance* parent, HEPREP::HepRepSelectFilter* filter);
|
||||
HEPREP::HepRepInstance* copy(HEPREP::HepRep* heprep, HEPREP::HepRepInstanceTree* parent, HEPREP::HepRepSelectFilter* filter);
|
||||
HEPREP::HepRepType* getType();
|
||||
bool addPoint(HEPREP::HepRepPoint* point);
|
||||
std::vector<HEPREP::HepRepPoint *>* getPoints();
|
||||
bool addInstance(HEPREP::HepRepInstance* instance);
|
||||
void removeInstance(HEPREP::HepRepInstance* instance);
|
||||
std::vector<HEPREP::HepRepInstance *>* getInstances();
|
||||
|
||||
HEPREP::HepRepAttValue* getAttValue(std::string name);
|
||||
|
||||
void *getParent() { return parent; }
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,44 @@
|
||||
#ifndef DEFAULTHEPREPINSTANCETREE_H
|
||||
#define DEFAULTHEPREPINSTANCETREE_H 1
|
||||
|
||||
#include "FreeHepTypes.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/HepRepTreeID.h"
|
||||
|
||||
#include "DefaultHepRepTreeID.h"
|
||||
|
||||
/**
|
||||
*
|
||||
* @author M.Donszelmann
|
||||
*/
|
||||
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::HepRep* heprep, HEPREP::HepRepSelectFilter* filter);
|
||||
HEPREP::HepRepTreeID* copy();
|
||||
bool addInstance(HEPREP::HepRepInstance* instance);
|
||||
void removeInstance(HEPREP::HepRepInstance* instance);
|
||||
std::vector<HEPREP::HepRepInstance*>* getInstances();
|
||||
bool addInstanceTree(HEPREP::HepRepTreeID* treeID);
|
||||
HEPREP::HepRepTreeID* getTypeTree();
|
||||
std::vector<HEPREP::HepRepTreeID*>* getInstanceTrees();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,56 @@
|
||||
#ifndef DEFAULTHEPREPPOINT_H
|
||||
#define DEFAULTHEPREPPOINT_H 1
|
||||
|
||||
#include "FreeHepTypes.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 M.Donszelmann
|
||||
*/
|
||||
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);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,33 @@
|
||||
#ifndef DEFAULTHEPREPTREEID_H
|
||||
#define DEFAULTHEPREPTREEID_H 1
|
||||
|
||||
#include "FreeHepTypes.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "HEPREP/HepRepTreeID.h"
|
||||
|
||||
/**
|
||||
*
|
||||
* @author M.Donszelmann
|
||||
*/
|
||||
|
||||
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();
|
||||
HEPREP::HepRepTreeID* copy();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,48 @@
|
||||
#ifndef DEFAULTHEPREPTYPE_H
|
||||
#define DEFAULTHEPREPTYPE_H 1
|
||||
|
||||
#include "FreeHepTypes.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "HEPREP/HepRep.h"
|
||||
#include "HEPREP/HepRepType.h"
|
||||
#include "HEPREP/HepRepAttDef.h"
|
||||
#include "HEPREP/HepRepAttValue.h"
|
||||
#include "HEPREP/HepRepWriter.h"
|
||||
|
||||
#include "DefaultHepRepDefinition.h"
|
||||
|
||||
/**
|
||||
*
|
||||
* @author M.Donszelmann
|
||||
*/
|
||||
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::HepRepType* getSuperType();
|
||||
HEPREP::HepRepAttDef* getAttDef(std::string name);
|
||||
HEPREP::HepRepAttValue* getAttValue(std::string name);
|
||||
HEPREP::HepRepType* copy(HEPREP::HepRep* heprep, 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);
|
||||
bool addType(HEPREP::HepRepType* type);
|
||||
std::vector<HEPREP::HepRepType*>* getTypes();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,36 @@
|
||||
#ifndef DEFAULTHEPREPTYPETREE_H
|
||||
#define DEFAULTHEPREPTYPETREE_H 1
|
||||
|
||||
#include "FreeHepTypes.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "HEPREP/HepRep.h"
|
||||
#include "HEPREP/HepRepTypeTree.h"
|
||||
#include "HEPREP/HepRepType.h"
|
||||
#include "HEPREP/HepRepWriter.h"
|
||||
#include "HEPREP/HepRepTreeID.h"
|
||||
|
||||
#include "DefaultHepRepTreeID.h"
|
||||
|
||||
/**
|
||||
*
|
||||
* @author M.Donszelmann
|
||||
*/
|
||||
class DefaultHepRepTypeTree : public DefaultHepRepTreeID, public virtual HEPREP::HepRepTypeTree {
|
||||
|
||||
private:
|
||||
std::vector<HEPREP::HepRepType*> types;
|
||||
|
||||
public:
|
||||
DefaultHepRepTypeTree(HEPREP::HepRepTreeID* typeTree);
|
||||
~DefaultHepRepTypeTree();
|
||||
|
||||
HEPREP::HepRepTypeTree* copy(HEPREP::HepRep* heprep);
|
||||
HEPREP::HepRepTreeID* copy();
|
||||
bool addType(HEPREP::HepRepType* type);
|
||||
std::vector<HEPREP::HepRepType* >* getTypes();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,14 @@
|
||||
#ifndef FREEHEPTYPES_H
|
||||
#define FREEHEPTYPES_H
|
||||
|
||||
#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 )
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
#ifndef INDENTPRINTWRITER_H
|
||||
#define INDENTPRINTWRITER_H 1
|
||||
|
||||
#include "FreeHepTypes.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
|
||||
*/
|
||||
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;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
#ifndef XMLHEPREPFACTORY_H
|
||||
#define XMLHEPREPFACTORY_H 1
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
#include "HEPREP/HepRepReader.h"
|
||||
#include "HEPREP/HepRepWriter.h"
|
||||
|
||||
#include "DefaultHepRepFactory.h"
|
||||
|
||||
/**
|
||||
*
|
||||
* @author M.Donszelmann
|
||||
*/
|
||||
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);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,62 @@
|
||||
#ifndef XMLHEPREPWRITER_H
|
||||
#define XMLHEPREPWRITER_H 1
|
||||
|
||||
#include "FreeHepTypes.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <stack>
|
||||
#include <vector>
|
||||
|
||||
#include "zipios++/zipoutputstream.h"
|
||||
#include "zipios++/gzipoutputstream.h"
|
||||
|
||||
#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 "XMLWriter.h"
|
||||
|
||||
/**
|
||||
*
|
||||
* @author M.Donszelmann
|
||||
*/
|
||||
class XMLHepRepWriter : public virtual HEPREP::HepRepWriter {
|
||||
|
||||
private:
|
||||
std::string nameSpace;
|
||||
XMLWriter *xml;
|
||||
zipios::ZipOutputStream *zip;
|
||||
zipios::GZIPOutputStream *gz;
|
||||
|
||||
public:
|
||||
XMLHepRepWriter(std::ostream* out, bool randomAccess, bool compress);
|
||||
~XMLHepRepWriter();
|
||||
|
||||
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);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,59 @@
|
||||
#ifndef XMLWRITER_H
|
||||
#define XMLWRITER_H 1
|
||||
|
||||
#include "FreeHepTypes.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
#include <stack>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include "IndentPrintWriter.h"
|
||||
|
||||
/**
|
||||
* A class that makes it easy to write XML documents.
|
||||
*
|
||||
* @author Tony Johnson
|
||||
* @author Mark Donszelmann
|
||||
*/
|
||||
class XMLWriter {
|
||||
|
||||
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 ns, std::string name);
|
||||
void openTag(std::string name);
|
||||
void closeTag();
|
||||
void printTag(std::string ns, std::string name);
|
||||
void printTag(std::string name);
|
||||
void setAttribute(std::string name, std::string value);
|
||||
void setAttribute(std::string ns, std::string name, std::string value);
|
||||
void setAttribute(std::string name, double value);
|
||||
void setAttribute(std::string ns, 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);
|
||||
|
||||
protected:
|
||||
bool closed;
|
||||
IndentPrintWriter* writer;
|
||||
std::string defaultNameSpace;
|
||||
|
||||
private:
|
||||
std::string dtdName;
|
||||
std::map<std::string, std::string> attributes;
|
||||
std::stack<std::string> openTags;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user