Warning, /include/Geant4/tools/rroot/tree_index is written in an unsupported language. File is not indexed.
0001 // Copyright (C) 2010, Guy Barrand. All rights reserved.
0002 // See the file tools.license for terms.
0003
0004 #ifndef tools_rroot_tree_index
0005 #define tools_rroot_tree_index
0006
0007 #include "named"
0008
0009 namespace tools {
0010 namespace rroot {
0011
0012 class tree_index : public virtual iro {
0013 static const std::string& s_store_class() {
0014 static const std::string s_v("TTreeIndex");
0015 return s_v;
0016 }
0017 public:
0018 static const std::string& s_class() {
0019 static const std::string s_v("tools::rroot::tree_index");
0020 return s_v;
0021 }
0022 public: //iro
0023 virtual void* cast(const std::string& a_class) const {
0024 if(void* p = cmp_cast<tree_index>(this,a_class)) return p;
0025 return 0;
0026 }
0027 virtual const std::string& s_cls() const {return s_class();}
0028 public:
0029 static cid id_class() {return branch_cid();}
0030 virtual void* cast(cid a_class) const {
0031 if(void* p = cmp_cast<tree_index>(this,a_class)) {return p;}
0032 else return 0;
0033 }
0034 public:
0035 virtual iro* copy() const {return new tree_index(*this);}
0036 virtual bool stream(buffer& a_buffer) {
0037 uint32 startpos = a_buffer.length();
0038
0039 unsigned int _s,_c;
0040 short v;
0041 if(!a_buffer.read_version(v,_s,_c)) return false;
0042 //::printf("debug : tree_index::stream : version %d count %d\n",v,c);
0043
0044 if(!virtual_index_stream(a_buffer)) return false;
0045
0046 std::string ds;
0047 if(!a_buffer.read(ds)) return false; //fMajorName
0048 //::printf("debug : tree_index::stream : fMajorName \"%s\"\n",ds.c_str());
0049 if(!a_buffer.read(ds)) return false; //fMinorName
0050 //::printf("debug : tree_index::stream : fMinorName \"%s\"\n",ds.c_str());
0051
0052 int64 m_n;
0053 if(!a_buffer.read(m_n)) return false; //fN
0054 //::printf("debug : tree_index::stream : fN %ld\n",m_n);
0055
0056 if(!dummy_array_stream<int64>(a_buffer,int(m_n))) return false;
0057 if(!dummy_array_stream<int64>(a_buffer,int(m_n))) return false;
0058
0059 //FIXME : still problem with this streamer.
0060
0061 a_buffer.set_offset(startpos+_c+sizeof(unsigned int));
0062
0063 if(!a_buffer.check_byte_count(_s,_c,s_store_class())) return false;
0064
0065 //::printf("debug : tree_index::stream : ok\n");
0066 return true;
0067 }
0068
0069 public:
0070 tree_index()
0071 {
0072 #ifdef TOOLS_MEM
0073 mem::increment(s_class().c_str());
0074 #endif
0075 }
0076 virtual ~tree_index(){
0077 #ifdef TOOLS_MEM
0078 mem::decrement(s_class().c_str());
0079 #endif
0080 }
0081 protected:
0082 tree_index(const tree_index& a_from):iro(a_from){}
0083 tree_index& operator=(const tree_index&){return *this;}
0084 protected:
0085 static const std::string& virtual_index_s_store_class() {
0086 static const std::string s_v("TVirtualIndex");
0087 return s_v;
0088 }
0089 bool virtual_index_stream(buffer& a_buffer){
0090 short v;
0091 unsigned int _s,_c;
0092 if(!a_buffer.read_version(v,_s,_c)) return false;
0093 //::printf("debug : virtual_index::stream : version %d count %d\n",v,c);
0094 std::string ds;
0095 if(!Named_stream(a_buffer,ds,ds)) return false;
0096 if(!a_buffer.check_byte_count(_s,_c,virtual_index_s_store_class()))
0097 return false;
0098 return true;
0099 }
0100
0101 };
0102
0103 }}
0104
0105 #endif