Geant4 Cross Reference |
1 // Copyright (C) 2010, Guy Barrand. All rights 2 // See the file tools.license for terms. 3 4 #ifndef tools_wroot_info 5 #define tools_wroot_info 6 7 #include "buffer" 8 #include "element" 9 #include "named" 10 11 namespace tools { 12 namespace wroot { 13 14 // sizeof(vtbl) = 4 15 // sizeof(unsigned int) = 4 16 // sizeof(TObject) = 12 = 2 * (unsigned int 17 // sizeof(TString) = 8 = char* + vtbl. 18 // sizeof(TNamed) = 28 = TObject + 2 * TSt 19 // sizeof(TObjArray) = 40 20 21 class streamer_info : public virtual ibo { 22 static const std::string& s_class() { 23 static const std::string s_v("tools::wroot 24 return s_v; 25 } 26 public: //ibo 27 virtual const std::string& store_cls() const 28 static const std::string s_v("TStreamerInf 29 return s_v; 30 } 31 virtual bool stream(buffer& a_buffer) const 32 unsigned int c; 33 if(!a_buffer.write_version(2,c)) return fa 34 35 if(!Named_stream(a_buffer,fName,fTitle)) r 36 if(!a_buffer.write(fCheckSum)) return fals 37 if(!a_buffer.write(fStreamedClassVersion)) 38 39 //ObjArray 40 if(!a_buffer.write_object(fElements)) retu 41 42 if(!a_buffer.set_byte_count(c)) return fal 43 44 return true; 45 } 46 public: 47 virtual void out(std::ostream& a_out) const 48 a_out << "streamer_info for class :" 49 << " " << fName << ", version=" << f 50 << std::endl; 51 tools_vforcit(streamer_element*,fElements, 52 } 53 public: 54 streamer_info(const std::string& a_cls_store 55 :fName(a_cls_store_name) 56 ,fTitle("") 57 ,fCheckSum(a_cls_check_sum) 58 ,fStreamedClassVersion(a_cls_vers) 59 { 60 #ifdef TOOLS_MEM 61 mem::increment(s_class().c_str()); 62 #endif 63 } 64 virtual ~streamer_info(){ 65 #ifdef TOOLS_MEM 66 mem::decrement(s_class().c_str()); 67 #endif 68 } 69 protected: 70 streamer_info(const streamer_info& a_from) 71 :ibo(a_from) 72 ,fName(a_from.fName) 73 ,fTitle(a_from.fName) 74 ,fCheckSum(a_from.fCheckSum) 75 ,fStreamedClassVersion(a_from.fStreamedClass 76 ,fElements(a_from.fElements) 77 { 78 #ifdef TOOLS_MEM 79 mem::increment(s_class().c_str()); 80 #endif 81 } 82 streamer_info& operator=(const streamer_info 83 fName = a_from.fName; 84 fTitle = a_from.fName; 85 fCheckSum = a_from.fCheckSum; 86 fStreamedClassVersion = a_from.fStreamedCl 87 fElements = a_from.fElements; 88 return *this; 89 } 90 public: 91 void add(streamer_element* a_elem){fElements 92 protected: //Named 93 std::string fName; 94 std::string fTitle; 95 protected: 96 unsigned int fCheckSum; //checksum of ori 97 int fStreamedClassVersion; //Class version i 98 //int fNumber; //!Unique ident 99 obj_array<streamer_element> fElements; //Arr 100 }; 101 102 }} 103 104 #endif