Import Geant4 10.4.0 source tree

This commit is contained in:
Gabriele Cosmo
2017-12-08 12:52:30 +01:00
parent 98e455a940
commit fc6af9e721
2166 changed files with 276760 additions and 100873 deletions
@@ -9,6 +9,11 @@
namespace tools {
namespace wroot {
inline const std::string& branch_element_store_class() {
static const std::string s_v("TBranchElement");
return s_v;
}
class branch_element : public branch {
typedef branch parent;
#ifdef TOOLS_MEM
@@ -18,10 +23,7 @@ class branch_element : public branch {
}
#endif
public: //ibo
virtual const std::string& store_cls() const {
static const std::string s_v("TBranchElement");
return s_v;
}
virtual const std::string& store_cls() const {return branch_element_store_class();}
virtual bool stream(buffer& a_buffer) const {
unsigned int c;
if(!a_buffer.write_version(1,c)) return false;
@@ -59,8 +61,8 @@ protected:
branch_element(const branch_element& a_from):ibo(a_from),parent(a_from) {}
branch_element& operator=(const branch_element& a_from){parent::operator=(a_from);return *this;}
public:
leaf_element* create_leaf_element(const std::string& a_name,const std::string& a_title){
leaf_element* lf = new leaf_element(m_out,a_name,a_title,fID,fType);
leaf_element* create_leaf_element(const std::string& a_name){
leaf_element* lf = new leaf_element(m_out,a_name,fID,fType);
m_leaves.push_back(lf);
return lf;
}
@@ -75,20 +77,20 @@ protected:
};
template <class T>
class std_vector_be : public branch_element {
class std_vector_be_ref : public branch_element {
typedef branch_element parent;
#ifdef TOOLS_MEM
static const std::string& s_class() {
static const std::string s_v("tools::wroot::std_vector_be");
static const std::string s_v("tools::wroot::std_vector_be_ref");
return s_v;
}
#endif
public:
std_vector_be(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,std::vector<T>& a_vec,bool a_verbose)
std_vector_be_ref(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,const std::vector<T>& a_ref,bool a_verbose)
:parent(a_out,a_byte_swap,a_compression,a_seek_directory,a_name,a_title,a_verbose)
,m_vec(a_vec)
,m_ref(a_ref)
{
#ifdef TOOLS_MEM
mem::increment(s_class().c_str());
@@ -99,6 +101,61 @@ public:
fType = 0;
fStreamerType = -1; // TStreamerInfo::kSTLp;
}
virtual ~std_vector_be_ref(){
#ifdef TOOLS_MEM
mem::decrement(s_class().c_str());
#endif
}
protected:
std_vector_be_ref(const std_vector_be_ref& a_from)
:ibo(a_from)
,parent(a_from)
,m_ref(a_from.m_ref)
{}
std_vector_be_ref& operator=(const std_vector_be_ref& a_from){
parent::operator=(a_from);
return *this;
}
protected:
virtual bool fill_leaves(buffer& a_buffer) {
unsigned int c;
if(!a_buffer.write_version(4,c)) return false;
if(!a_buffer.write((int)m_ref.size())) return false;
if(m_ref.size()) {
// The awfull below is to pass T=bool :
const T& vr = m_ref[0];
if(!a_buffer.write_fast_array(&vr,(int)m_ref.size())) return false;
}
if(!a_buffer.set_byte_count(c)) return false;
return true;
}
public:
const std::vector<T>& variable() const {return m_ref;}
std::vector<T>& variable() {return const_cast< std::vector<T>& >(m_ref);}
protected:
const std::vector<T>& m_ref;
};
template <class T>
class std_vector_be : public std_vector_be_ref<T> {
typedef std_vector_be_ref<T> parent;
#ifdef TOOLS_MEM
static const std::string& s_class() {
static const std::string s_v("tools::wroot::std_vector_be");
return s_v;
}
#endif
public:
std_vector_be(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,const std::vector<T>& a_def,bool a_verbose)
:parent(a_out,a_byte_swap,a_compression,a_seek_directory,a_name,a_title,m_value,a_verbose)
,m_def(a_def),m_value(a_def)
{
#ifdef TOOLS_MEM
mem::increment(s_class().c_str());
#endif
}
virtual ~std_vector_be(){
#ifdef TOOLS_MEM
mem::decrement(s_class().c_str());
@@ -108,27 +165,80 @@ protected:
std_vector_be(const std_vector_be& a_from)
:ibo(a_from)
,parent(a_from)
,m_vec(a_from.m_vec)
,m_def(a_from.m_def)
,m_value(a_from.m_value)
{}
std_vector_be& operator=(const std_vector_be& a_from){
parent::operator=(a_from);
m_def = a_from.m_def;
m_value = a_from.m_value;
return *this;
}
protected:
std::vector<T> m_def;
std::vector<T> m_value;
};
template <class T>
class std_vector_be_pointer : public branch_element {
typedef branch_element parent;
#ifdef TOOLS_MEM
static const std::string& s_class() {
static const std::string s_v("tools::wroot::std_vector_be_pointer");
return s_v;
}
#endif
public:
std_vector_be_pointer(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,std::vector<T>* a_pointer,bool a_verbose)
:parent(a_out,a_byte_swap,a_compression,a_seek_directory,a_name,a_title,a_verbose)
,m_pointer(a_pointer)
{
#ifdef TOOLS_MEM
mem::increment(s_class().c_str());
#endif
fClassName = "vector<"+stype(T())+">";
fClassVersion = 0;
fID = -1;
fType = 0;
fStreamerType = -1; // TStreamerInfo::kSTLp;
}
virtual ~std_vector_be_pointer(){
#ifdef TOOLS_MEM
mem::decrement(s_class().c_str());
#endif
}
protected:
std_vector_be_pointer(const std_vector_be_pointer& a_from)
:ibo(a_from)
,parent(a_from)
,m_pointer(a_from.m_pointer)
{}
std_vector_be_pointer& operator=(const std_vector_be_pointer& a_from){
parent::operator=(a_from);
return *this;
}
protected:
virtual bool fill_leaves(buffer& a_buffer) {
if(!m_pointer) return false;
unsigned int c;
if(!a_buffer.write_version(4,c)) return false;
if(!a_buffer.write((int)m_vec.size())) return false;
if(m_vec.size()) {
if(!a_buffer.write((int)m_pointer->size())) return false;
if(m_pointer->size()) {
// The awfull below is to pass T=bool :
const T& vr = m_vec[0];
if(!a_buffer.write_fast_array(&vr,(int)m_vec.size())) return false;
T& vr = (*m_pointer)[0];
if(!a_buffer.write_fast_array(&vr,(int)m_pointer->size())) return false;
}
if(!a_buffer.set_byte_count(c)) return false;
return true;
}
public:
void set_pointer(std::vector<T>* a_pointer) {m_pointer = a_pointer;}
const std::vector<T>* get_pointer() const {return m_pointer;}
std::vector<T>* get_pointer() {return m_pointer;}
protected:
std::vector<T>& m_vec;
std::vector<T>* m_pointer;
};
}}