Import Geant4 10.4.0 source tree
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
// Copyright (C) 2010, Guy Barrand. All rights reserved.
|
||||
// See the file tools.license for terms.
|
||||
|
||||
#ifndef tools_wroot_branch_object
|
||||
#define tools_wroot_branch_object
|
||||
|
||||
#include "branch"
|
||||
|
||||
namespace tools {
|
||||
namespace wroot {
|
||||
|
||||
class branch_object : public branch {
|
||||
typedef branch parent;
|
||||
#ifdef TOOLS_MEM
|
||||
static const std::string& s_class() {
|
||||
static const std::string s_v("tools::wroot::branch_object");
|
||||
return s_v;
|
||||
}
|
||||
#endif
|
||||
public: //ibo
|
||||
virtual const std::string& store_cls() const {
|
||||
static const std::string s_v("TBranchObject");
|
||||
return s_v;
|
||||
}
|
||||
virtual bool stream(buffer& a_buffer) const {
|
||||
if(fClassName.empty()) {
|
||||
m_out << "tools::wroot::branch_object::stream : fClassName is empty." << std::endl;
|
||||
return false;
|
||||
}
|
||||
unsigned int c;
|
||||
if(!a_buffer.write_version(1,c)) return false;
|
||||
if(!parent::stream(a_buffer)) return false;
|
||||
if(!a_buffer.write(fClassName)) return false;
|
||||
if(!a_buffer.set_byte_count(c)) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public:
|
||||
branch_object(std::ostream& a_out,bool a_byte_swap,uint32 a_compression,
|
||||
seek a_seek_directory,const std::string& a_name,const std::string& a_title,
|
||||
bool a_verbose)
|
||||
:parent(a_out,a_byte_swap,a_compression,a_seek_directory,a_name,a_title,a_verbose)
|
||||
,fClassName()
|
||||
{
|
||||
#ifdef TOOLS_MEM
|
||||
mem::increment(s_class().c_str());
|
||||
#endif
|
||||
}
|
||||
virtual ~branch_object(){
|
||||
#ifdef TOOLS_MEM
|
||||
mem::decrement(s_class().c_str());
|
||||
#endif
|
||||
}
|
||||
protected:
|
||||
branch_object(const branch_object& a_from):ibo(a_from),parent(a_from) {}
|
||||
branch_object& operator=(const branch_object& a_from){parent::operator=(a_from);return *this;}
|
||||
public:
|
||||
leaf_object* create_leaf(const std::string& a_name,const iobject& a_obj){
|
||||
fClassName = a_obj.store_class_name();
|
||||
leaf_object* lf = new leaf_object(m_out,a_name,a_obj);
|
||||
m_leaves.push_back(lf);
|
||||
return lf;
|
||||
}
|
||||
protected:
|
||||
std::string fClassName; //Class name of referenced object
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user