24             singlePrecision(true) {        
    27         union { 
long l; 
char c[
sizeof (long)]; } u;
    33         if (
tags.size() <= 0) { 
    35             tags[
"heprep"]              = 0x05;
    36             tags[
"attdef"]              = 0x06;
    37             tags[
"attvalue"]            = 0x07;
    38             tags[
"instance"]            = 0x08;
    39             tags[
"treeid"]              = 0x09;
    40             tags[
"action"]              = 0x0a;
    41             tags[
"instancetree"]        = 0x0b;
    43             tags[
"typetree"]            = 0x0d;
    84             values[
"drawasoptions"]              = 0x86;
    85             values[
"visibility"]                 = 0x87;
    90             values[
"fontstyle"]                  = 0x8a;
    92             values[
"fontcolor"]                  = 0x8c;
    93             values[
"fonthasframe"]               = 0x8d;
    94             values[
"fontframecolor"]             = 0x8e;
    95             values[
"fontframewidth"]             = 0x8f;
    96             values[
"fonthasbanner"]              = 0x90;
    97             values[
"fontbannercolor"]            = 0x91;
   100             values[
"framecolor"]                 = 0x93;
   102             values[
"markname"]                   = 0x95;
   103             values[
"marksize"]                   = 0x96;
   104             values[
"marksizemultiplier"]         = 0x97;
   105             values[
"marktype"]                   = 0x98;
   106             values[
"hasframe"]                   = 0x99;
   107             values[
"framecolor"]                 = 0x9a;
   108             values[
"framewidth"]                 = 0x9b;
   110             values[
"linestyle"]                  = 0x9c;
   111             values[
"linewidth"]                  = 0x9d;
   112             values[
"linewidthmultiplier"]        = 0x9e;
   113             values[
"linehasarrow"]               = 0x9f;
   115             values[
"fillcolor"]                  = 0xa0;
   116             values[
"filltype"]                   = 0xa1;
   126             values[
"curvature"]                  = 0xaa;
   127             values[
"flylength"]                  = 0xab;
   136             values[
"ispickable"]                 = 0xb2;
   137             values[
"showparentvalues"]           = 0xb3;
   138             values[
"pickparent"]                 = 0xb4;
   151             values[
"ellipsoid"]     = 0xd9;
   153             values[
"cylinder"]      = 0xdb;
   154             values[
"ellipseprism"]  = 0xdc;
   162             values[
"uptriangle"]    = 0xe2;
   163             values[
"dntriangle"]    = 0xe3;
   182             values[
"sansserif"]     = 0xf3;
   183             values[
"monotype"]      = 0xf4;
   191             values[
"baseline"]      = 0xfa;
   216         version = 
"BinaryHepRep/1.0"; 
   246         std::string 
s = tagName;
   247         std::transform(s.begin(), s.end(), s.begin(), (int(*)(int)) tolower);
   250         if (
tags.count(s) <= 0) {
   251             std::cerr << 
"Cannot find tag '" << s << 
"' in tags table." << std::endl;
   256         bool isPoint = (s == 
"point");
   259         if (!hasAttributes && isPoint) {
   275                 std::string value = i->second;
   279                 std::string 
v = value;
   280                 std::transform(v.begin(), v.end(), v.begin(), (int(*)(int)) tolower);
   281                 if (
values.count(v) > 0) {
   302                 std::vector<double> value = i->second;
   308                 writeByte((
int)(value[0] * 0xff) & 0xff);
   309                 writeByte((
int)(value[1] * 0xff) & 0xff);
   310                 writeByte((
int)(value[2] * 0xff) & 0xff);
   311                 if (value.size() > 3) 
writeByte((
int)(value[3] * 0xff) & 0xff);
   318                 int64 value = i->second;
   331                 int value = i->second;
   344                 bool value = i->second;
   355                 double value = i->second;
   356                 if (!isPoint && (name != 
"x") && (name != 
"y") && (name != 
"z")) {
   379         if (isPoint && !hasContent) {
   386         if (
points.size() <= 0) 
return;
   391         for (std::vector<double>::iterator i = 
points.begin(); i != 
points.end(); ) {
   406         if (name == 
"value") name = name.append(
"String");
   410             std::cerr << 
"Cannot find attribute name '" << name << 
"' in attributes table, skipped." << std::endl;
   418         if (name == 
"value") name = name.append(
"Color");
   422             std::cerr << 
"Cannot find attribute name '" << name << 
"' in attributes table, skipped." << std::endl;
   430         if (name == 
"value") name = name.append(
"Long");
   434             std::cerr << 
"Cannot find attribute name '" << name << 
"' in attributes table, skipped." << std::endl;
   442         if (name == 
"value") name = name.append(
"Int");
   446             std::cerr << 
"Cannot find attribute name '" << name << 
"' in attributes table, skipped." << std::endl;
   454         if (name == 
"value") name = name.append(
"Boolean");
   458             std::cerr << 
"Cannot find attribute name '" << name << 
"' in attributes table, skipped." << std::endl;
   466         if (name == 
"value") name = name.append(
"Double");
   470             std::cerr << 
"Cannot find attribute name '" << name << 
"' in attributes table, skipped." << std::endl;
   483         unsigned char buf[5];
   487             buf[idx++] = (
unsigned char) (ui & 0x7f);
   519         os.put((i >> 56) & 0xff);
   520         os.put((i >> 48) & 0xff);
   521         os.put((i >> 40) & 0xff);
   522         os.put((i >> 32) & 0xff);
   523         os.put((i >> 24) & 0xff);
   524         os.put((i >> 16) & 0xff);
   525         os.put((i >>  8) & 0xff);
   531         os.put((i >> 24) & 0xff);
   532         os.put((i >> 16) & 0xff);
   533         os.put((i >>  8) & 0xff);
 void printTag(std::string name)
 
void writeReal(double ui)
 
void writeString(std::string s)
 
static const unsigned char OPAQUE
 
void openDoc(std::string version="BinaryHepRep/1.0", std::string encoding="UTF-8", bool standalone=false)
 
void openTag(std::string name)
 
static const unsigned char STR_R
 
std::vector< double > points
 
static std::map< std::string, unsigned char > tags
 
BHepRepWriter(std::ostream &os)
 
static std::map< std::string, unsigned char > values
 
std::map< std::string, std::string > stringAttributes
 
std::map< std::string, unsigned int > stringValues
 
static const unsigned char UTF8
 
void writeStringDefine(std::string s)
 
void setAttribute(std::string name, char *value)
 
void writeByte(unsigned char b)
 
std::map< std::string, std::vector< double > > colorAttributes
 
void closeDoc(bool force=false)
 
std::map< std::string, bool > booleanAttributes
 
static const unsigned char STR_D
 
void writeTag(std::string name, bool content=false)
 
void writeMultiByteInt(unsigned int ui)
 
static const unsigned char UNKNOWN_PID
 
std::map< std::string, double > doubleAttributes
 
std::map< std::string, int64 > longAttributes
 
static const unsigned char CONTENT
 
static std::map< std::string, unsigned char > attributes
 
static const unsigned char PI
 
static const unsigned char WBXML_VERSION
 
std::map< std::string, int > intAttributes
 
static const unsigned char END