10 #define NAMESPACE "heprep"
13 using namespace HEPREP;
21 XMLHepRepWriter::XMLHepRepWriter(ostream* os,
bool randomAccess,
bool useCompression)
35 #ifndef CHEPREP_NO_ZLIB
39 cerr <<
"WARNING: the .gz output stream you are creating will be a plain file," << endl;
40 cerr <<
"since compression support (ZLIB) was not compiled into the library." << endl;
41 cerr <<
"To add ZLIB support, you need to undefine CHEPREP_NO_ZLIB." << endl;
56 properties[key] =
value;
64 map<string, string>::iterator i = properties.begin();
65 while (i != properties.end()) {
66 *zip << (*i).first <<
"=" << (*i).second << endl;
84 if (name.rfind(
".bheprep") == name.length()-8) {
92 xml->
setAttribute(
"xmlns", (
string)
"http://java.freehep.org/schemas/heprep/2.0");
93 xml->
setAttribute(
"xmlns",
"xsi",
"http://www.w3.org/2001/XMLSchema-instance");
94 xml->
setAttribute(
"xsi",
"schemaLocation",
"http://java.freehep.org/schemas/heprep/2.0 http://java.freehep.org/schemas/heprep/2.0/HepRep.xsd");
95 xml->
openTag(nameSpace,
"heprep");
98 for (vector<HepRepTypeTree*>::iterator i1=typeTreeSet.begin(); i1 != typeTreeSet.end(); i1++) {
102 for (vector<HepRepInstanceTree*>::iterator i2=instanceTreeSet.begin(); i2 != instanceTreeSet.end(); i2++) {
118 string layerOrder =
"";
120 for (vector<string>::iterator i=layers.begin(); i != layers.end(); i++) {
122 layerOrder.append(
", ");
124 layerOrder.append(*i);
135 xml->
openTag(nameSpace,
"typetree");
137 vector<HepRepType*> types = typeTree->
getTypeList();
138 for (vector<HepRepType*>::iterator i=types.begin(); i != types.end(); i++) {
148 xml->
openTag(nameSpace,
"type");
153 for (vector<HepRepType*>::iterator i=types.begin(); i != types.end(); i++) {
180 xml->
openTag(nameSpace,
"instancetree");
183 for (vector<HepRepTreeID*>::iterator i1=instanceTreeSet.begin(); i1 != instanceTreeSet.end(); i1++) {
188 vector<HepRepInstance*> instanceList = instanceTree->
getInstances();
189 for (vector<HepRepInstance*>::iterator i2=instanceList.begin(); i2 != instanceList.end(); i2++) {
199 xml->
openTag(nameSpace,
"instance");
202 vector<HepRepPoint*> pointList = instance->
getPoints();
203 for (vector<HepRepPoint*>::iterator i1=pointList.begin(); i1 != pointList.end(); i1++) {
207 vector<HepRepInstance*> instanceList = instance->
getInstances();
208 for (vector<HepRepInstance*>::iterator i2=instanceList.begin(); i2 != instanceList.end(); i2++) {
220 xml->
openTag(nameSpace,
"point");
233 if (layerAtt != NULL)
write(layerAtt);
236 for (set<HepRepAttValue*>::iterator i=attSet.begin(); i != attSet.end(); i++) {
244 for (set<HepRepAttDef*>::iterator i=list.begin(); i != list.end(); i++) {
271 if (attValue->
showLabel() != HepRepConstants::SHOW_NONE) {
275 xml->
printTag(nameSpace,
"attvalue");
virtual std::string getExpression()=0
virtual void openTag(std::string ns, std::string name)=0
virtual std::string getName()=0
virtual HepRepTreeID * getTypeTree()=0
virtual std::string getName()=0
virtual std::string getAsString()=0
bool addProperty(std::string key, std::string value)
virtual std::vector< HepRepInstance * > getInstances()=0
virtual std::string getName()=0
virtual std::string getString()=0
virtual std::string getExtra()=0
virtual void printTag(std::string ns, std::string name)=0
virtual std::vector< HepRepPoint * > getPoints()=0
virtual std::vector< HepRepTypeTree * > getTypeTreeList()=0
virtual std::vector< double > getColor()=0
virtual int showLabel()=0
void putNextEntry(const std::string &name, bool compress)
virtual void closeTag()=0
virtual double getDouble()=0
virtual HepRepAttValue * getAttValueFromNode(std::string lowerCaseName)=0
virtual std::string getCategory()=0
virtual int getInteger()=0
virtual std::vector< HepRepType * > getTypeList()=0
virtual void setAttribute(std::string ns, std::string name, std::string value)=0
virtual HepRepType * getType()=0
virtual void closeDoc(bool force=false)=0
const XML_Char int const XML_Char * value
virtual int64 getLong()=0
virtual std::string getName()=0
virtual std::vector< HepRepInstance * > getInstances()=0
virtual std::string getDescription()=0
virtual void openDoc(std::string version="1.0", std::string encoding="", bool standalone=false)=0
virtual bool getBoolean()=0
virtual std::string getName()=0
virtual std::string getQualifier()=0
bool write(HEPREP::HepRep *heprep, std::string name)
virtual std::vector< std::string > getLayerOrder()=0
int ZEXPORT compress(Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)
virtual std::string getFullName()=0
static MCTruthManager * instance
virtual std::string getVersion()=0
virtual std::vector< HepRepType * > getTypeList()=0
virtual std::vector< HepRepTreeID * > getInstanceTreeList()=0
virtual std::set< HepRepAttDef * > getAttDefsFromNode()=0
virtual std::set< HepRepAttValue * > getAttValuesFromNode()=0
virtual std::vector< HepRepInstanceTree * > getInstanceTreeList()=0