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 public: //ibo
0015   virtual const std::string& store_cls() const {
0016     static const std::string s_v("TBranchObject");
0017     return s_v;
0018   }
0019   virtual bool stream(buffer& a_buffer) const {
0020     if(fClassName.empty()) {
0021       m_out << "tools::wroot::branch_object::stream : fClassName is empty." << std::endl;
0022       return false;
0023     }
0024     unsigned int c;
0025     if(!a_buffer.write_version(1,c)) return false;
0026     if(!parent::stream(a_buffer)) return false;
0027     if(!a_buffer.write(fClassName)) return false;
0028     if(!a_buffer.set_byte_count(c)) return false;
0029     return true;
0030   }
0031 
0032 public:
0033   branch_object(std::ostream& a_out,bool a_byte_swap,uint32 a_compression,
0034                 seek a_seek_directory,const std::string& a_name,const std::string& a_title,
0035                 bool a_verbose)
0036   :parent(a_out,a_byte_swap,a_compression,a_seek_directory,a_name,a_title,a_verbose)
0037   ,fClassName()
0038   {
0039   }
0040   virtual ~branch_object(){
0041   }
0042 protected:
0043   branch_object(const branch_object& a_from):ibo(a_from),parent(a_from) {}
0044   branch_object& operator=(const branch_object& a_from){parent::operator=(a_from);return *this;}
0045 public:
0046   leaf_object* create_leaf(const std::string& a_name,const iobject& a_obj){
0047     fClassName = a_obj.store_class_name();
0048     leaf_object* lf = new leaf_object(m_out,a_name,a_obj);
0049     m_leaves.push_back(lf);
0050     return lf;
0051   }
0052 protected:
0053   std::string fClassName; //Class name of referenced object
0054 };
0055 
0056 }}
0057 
0058 #endif