Import Geant4 10.7.0 source tree

This commit is contained in:
Gabriele Cosmo
2020-12-04 12:30:43 +01:00
parent 67ba86d073
commit dab42d2018
3770 changed files with 226369 additions and 286486 deletions
@@ -17,7 +17,7 @@ namespace sg {
class base_holder : public node {
TOOLS_NODE(base_holder,tools::sg::base_holder,node)
public:
public:
base_holder(const std::string& a_name):parent(),m_name(a_name) {}
virtual ~base_holder(){}
public:
@@ -27,7 +27,7 @@ public:
m_name = a_from.m_name;
return *this;
}
public:
public:
const std::string& name() const {return m_name;}
protected:
std::string m_name;
@@ -63,22 +63,24 @@ private:
void add_fields(){
add_field(&class_name);
}
public:
holder(T* a_obj = 0,const std::string& a_name = "")
public:
holder(T* a_obj = 0,const std::string& a_name = "",bool a_own=true)
:parent(a_name)
,class_name(T::s_class())
,m_obj(a_obj) //it takes a_obj ownership.
,m_own(a_own)
{
add_fields();
}
virtual ~holder(){delete m_obj;}
virtual ~holder(){if(m_own) delete m_obj;}
public:
//any copy of a holder does NOT own any object (and we empty the name).
holder(const holder& a_from)
:parent(a_from)
,class_name(std::string())
,m_obj(0)
,m_own(false)
{
parent::m_name.clear();
add_fields();
@@ -87,14 +89,16 @@ public:
parent::operator=(a_from);
class_name.value().clear();
m_obj = 0;
m_own = false;
parent::m_name.clear();
return *this;
}
public:
public:
const T* object() const {return m_obj;}
T* object() {return m_obj;}
protected:
T* m_obj;
bool m_own;
};
template <class T>
@@ -136,7 +140,7 @@ inline void remove_holders(std::vector<node*>& a_vec){
for(it=a_vec.begin();it!=a_vec.end();) {
if(h_t* h = cast_holder<T>(*(*it))){
it = a_vec.erase(it);
delete h;
delete h;
continue;
}
@@ -153,7 +157,7 @@ inline void remove_holders(std::vector<node*>& a_vec,const std::string& a_name){
if(h_t* h = cast_holder<T>(*(*it))){
if(h->name()==a_name) {
it = a_vec.erase(it);
delete h;
delete h;
continue;
}
}