Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/Geant4/tools/wroot/branch_object 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_branch_object
0005 #define tools_wroot_branch_object
0006 
0007 #include "branch"
0008 
0009 namespace tools {
0010 namespace wroot {
0011 
0012 class branch_object : public branch {
0013   typedef branch parent;
0014 #ifdef TOOLS_MEM
0015   static const std::string& s_class() {
0016     static const std::string s_v("tools::wroot::branch_object");
0017     return s_v;
0018   }
0019 #endif
0020 public: //ibo
0021   virtual const std::string& store_cls() const {
0022     static const std::string s_v("TBranchObject");
0023     return s_v;
0024   }
0025   virtual bool stream(buffer& a_buffer) const {
0026     if(fClassName.empty()) {
0027       m_out << "tools::wroot::branch_object::stream : fClassName is empty." << std::endl;
0028       return false;
0029     }
0030     unsigned int c;
0031     if(!a_buffer.write_version(1,c)) return false;
0032     if(!parent::stream(a_buffer)) return false;
0033     if(!a_buffer.write(fClassName)) return false;
0034     if(!a_buffer.set_byte_count(c)) return false;
0035     return true;
0036   }
0037 
0038 public:
0039   branch_object(std::ostream& a_out,bool a_byte_swap,uint32 a_compression,
0040                 seek a_seek_directory,const std::string& a_name,const std::string& a_title,
0041                 bool a_verbose)
0042   :parent(a_out,a_byte_swap,a_compression,a_seek_directory,a_name,a_title,a_verbose)
0043   ,fClassName()
0044   {
0045 #ifdef TOOLS_MEM
0046     mem::increment(s_class().c_str());
0047 #endif
0048   }
0049   virtual ~branch_object(){
0050 #ifdef TOOLS_MEM
0051     mem::decrement(s_class().c_str());
0052 #endif
0053   }
0054 protected:
0055   branch_object(const branch_object& a_from):ibo(a_from),parent(a_from) {}
0056   branch_object& operator=(const branch_object& a_from){parent::operator=(a_from);return *this;}
0057 public:
0058   leaf_object* create_leaf(const std::string& a_name,const iobject& a_obj){
0059     fClassName = a_obj.store_class_name();
0060     leaf_object* lf = new leaf_object(m_out,a_name,a_obj);
0061     m_leaves.push_back(lf);
0062     return lf;
0063   }
0064 protected:
0065   std::string fClassName; //Class name of referenced object
0066 };
0067 
0068 }}
0069 
0070 #endif