Warning, /include/Geant4/tools/wroot/info 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_wroot_info
0005 #define tools_wroot_info
0006
0007 #include "buffer"
0008 #include "element"
0009 #include "named"
0010
0011 namespace tools {
0012 namespace wroot {
0013
0014 // sizeof(vtbl) = 4
0015 // sizeof(unsigned int) = 4
0016 // sizeof(TObject) = 12 = 2 * (unsigned int) + vtbl.
0017 // sizeof(TString) = 8 = char* + vtbl.
0018 // sizeof(TNamed) = 28 = TObject + 2 * TString.
0019 // sizeof(TObjArray) = 40
0020
0021 class streamer_info : public virtual ibo {
0022 static const std::string& s_class() {
0023 static const std::string s_v("tools::wroot::streamer_info");
0024 return s_v;
0025 }
0026 public: //ibo
0027 virtual const std::string& store_cls() const {
0028 static const std::string s_v("TStreamerInfo");
0029 return s_v;
0030 }
0031 virtual bool stream(buffer& a_buffer) const {
0032 unsigned int c;
0033 if(!a_buffer.write_version(2,c)) return false;
0034
0035 if(!Named_stream(a_buffer,fName,fTitle)) return false;
0036 if(!a_buffer.write(fCheckSum)) return false;
0037 if(!a_buffer.write(fStreamedClassVersion)) return false;
0038
0039 //ObjArray
0040 if(!a_buffer.write_object(fElements)) return false;
0041
0042 if(!a_buffer.set_byte_count(c)) return false;
0043
0044 return true;
0045 }
0046 public:
0047 virtual void out(std::ostream& a_out) const {
0048 a_out << "streamer_info for class :"
0049 << " " << fName << ", version=" << fStreamedClassVersion
0050 << std::endl;
0051 tools_vforcit(streamer_element*,fElements,it) (*it)->out(a_out);
0052 }
0053 public:
0054 streamer_info(const std::string& a_cls_store_name,int a_cls_vers,unsigned int a_cls_check_sum)
0055 :fName(a_cls_store_name)
0056 ,fTitle("")
0057 ,fCheckSum(a_cls_check_sum)
0058 ,fStreamedClassVersion(a_cls_vers)
0059 {
0060 #ifdef TOOLS_MEM
0061 mem::increment(s_class().c_str());
0062 #endif
0063 }
0064 virtual ~streamer_info(){
0065 #ifdef TOOLS_MEM
0066 mem::decrement(s_class().c_str());
0067 #endif
0068 }
0069 protected:
0070 streamer_info(const streamer_info& a_from)
0071 :ibo(a_from)
0072 ,fName(a_from.fName)
0073 ,fTitle(a_from.fName)
0074 ,fCheckSum(a_from.fCheckSum)
0075 ,fStreamedClassVersion(a_from.fStreamedClassVersion)
0076 ,fElements(a_from.fElements)
0077 {
0078 #ifdef TOOLS_MEM
0079 mem::increment(s_class().c_str());
0080 #endif
0081 }
0082 streamer_info& operator=(const streamer_info& a_from){
0083 fName = a_from.fName;
0084 fTitle = a_from.fName;
0085 fCheckSum = a_from.fCheckSum;
0086 fStreamedClassVersion = a_from.fStreamedClassVersion;
0087 fElements = a_from.fElements;
0088 return *this;
0089 }
0090 public:
0091 void add(streamer_element* a_elem){fElements.push_back(a_elem);}
0092 protected: //Named
0093 std::string fName;
0094 std::string fTitle;
0095 protected:
0096 unsigned int fCheckSum; //checksum of original class
0097 int fStreamedClassVersion; //Class version identifier
0098 //int fNumber; //!Unique identifier
0099 obj_array<streamer_element> fElements; //Array of TStreamerElements
0100 };
0101
0102 }}
0103
0104 #endif