Back to home page

EIC code displayed by LXR

 
 

    


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   }
0061   virtual ~streamer_info(){
0062   }
0063 protected:
0064   streamer_info(const streamer_info& a_from)
0065   :ibo(a_from)
0066   ,fName(a_from.fName)
0067   ,fTitle(a_from.fName)
0068   ,fCheckSum(a_from.fCheckSum)
0069   ,fStreamedClassVersion(a_from.fStreamedClassVersion)
0070   ,fElements(a_from.fElements)
0071   {
0072   }
0073   streamer_info& operator=(const streamer_info& a_from){
0074     fName = a_from.fName;
0075     fTitle = a_from.fName;
0076     fCheckSum = a_from.fCheckSum;
0077     fStreamedClassVersion = a_from.fStreamedClassVersion;
0078     fElements = a_from.fElements;
0079     return *this;
0080   }
0081 public:
0082   void add(streamer_element* a_elem){fElements.push_back(a_elem);}
0083 protected: //Named
0084   std::string fName;
0085   std::string fTitle;
0086 protected:
0087   unsigned int fCheckSum;    //checksum of original class
0088   int fStreamedClassVersion; //Class version identifier
0089   obj_array<streamer_element> fElements; //Array of TStreamerElements
0090 };
0091 
0092 }}
0093 
0094 #endif