Import Geant4 10.6.0 source tree

This commit is contained in:
Gabriele Cosmo
2019-12-06 15:12:28 +01:00
parent b2a62ae692
commit 5baee230e9
2997 changed files with 141580 additions and 98673 deletions
+29 -55
View File
@@ -4,8 +4,7 @@
#ifndef tools_columns
#define tools_columns
#include <vector>
#include <ostream>
#include "vmanip"
#include "forit"
#include "sout"
@@ -24,48 +23,36 @@ class tree {
TOOLS_SCLASS(tools::columns::tree)
#endif
public:
tree(tree* a_parent):m_parent(a_parent){
tree(tree* a_parent,const std::string& a_dcl):m_parent(a_parent),m_dcl(a_dcl){
#ifdef TOOLS_MEM
mem::increment(s_class().c_str());
#endif
if(a_parent) a_parent->m_sub.push_back(this);
}
virtual ~tree(){
clear();
#ifdef TOOLS_MEM
mem::decrement(s_class().c_str());
#endif
}
protected:
tree(const tree&) {}
tree& operator=(const tree&) {return *this;}
public:
tree(const tree& a_from)
:m_dcl(a_from.m_dcl)
,m_sub(a_from.m_sub)
,m_parent(a_from.m_parent)
{
#ifdef TOOLS_MEM
mem::increment(s_class().c_str());
#endif
}
tree& operator=(const tree& a_from) {
if(&a_from==this) return *this;
m_dcl = a_from.m_dcl;
m_sub = a_from.m_sub;
m_parent = a_from.m_parent;
return *this;
}
public:
void clear(){
void clear() {
m_dcl.clear();
tools_vforit(tree,m_sub,it) (*it).clear();
safe_reverse_clear(m_sub);
}
void dump_tree(std::ostream& a_out,const std::string& a_margin) {
if(m_dcl.size()) a_out << a_margin << m_dcl << std::endl;
{tools_vforit(tree,m_sub,it) {
(*it).dump_tree(a_out,a_margin+" ");
{tools_vforit(tree*,m_sub,it) {
(*it)->dump_tree(a_out,a_margin+" ");
}}
}
public:
std::string m_dcl;
std::vector<tree> m_sub;
tree* m_parent;
std::string m_dcl;
std::vector<tree*> m_sub;
};
}}
@@ -77,54 +64,40 @@ namespace columns {
class parser {
public:
parser():m_top(0){}
parser():m_top(0,""){}
virtual ~parser(){m_top.clear();}
protected:
parser(const parser& a_from):m_top(a_from.m_top){}
parser(const parser&):m_top(0,"") {}
parser& operator=(const parser&){return *this;}
public:
bool parse(const std::string& a_s){
m_top.clear();
tree* prev = &m_top;
{tree tmp(0);
std::string s;
{std::string s;
for(std::string::const_iterator it=a_s.begin();;++it) {
if(it==a_s.end()) {
if(s.size()) {
tmp.m_dcl = s;
tmp.m_parent = prev;
prev->m_sub.push_back(tmp);
new tree(prev,s);
s.clear();
}
tmp.clear();
break;
} else {
const char& c = *it;
if(c==',') {
if(s.size()) {
tmp.m_dcl = s;
tmp.m_parent = prev;
prev->m_sub.push_back(tmp);
new tree(prev,s);
s.clear();
}
tmp.clear();
} else if(c=='{') {
tmp.clear();
if(s.size()) {
tmp.m_dcl = s;
s.clear();
}
tmp.m_parent = prev;
prev->m_sub.push_back(tmp);
prev = &(prev->m_sub.back());
tree* _tree = new tree(prev,s);
s.clear();
prev = _tree;
} else if(c=='}') {
if(s.size()) {
tmp.m_dcl = s;
tmp.m_parent = prev;
prev->m_sub.push_back(tmp);
new tree(prev,s);
s.clear();
}
tmp.clear();
prev = prev->m_parent;
if(!prev) return false; //should not happen.
} else {
@@ -205,6 +178,7 @@ inline void dump_columns(std::ostream& a_out,const std::vector<value>& a_vars,co
}
class finder : public columns::parser {
typedef columns::parser parent;
public:
finder(std::ostream& a_out,const std::string& a_script)
:m_out(a_out)
@@ -214,7 +188,7 @@ public:
{}
virtual ~finder() {clear();}
protected:
finder(const finder& a_from):parser(a_from),m_out(a_from.m_out){}
finder(const finder& a_from):parent(a_from),m_out(a_from.m_out){}
finder& operator=(const finder&){return *this;}
public:
//void setScript(const std::string& a_string) { m_script = a_string;}
@@ -247,8 +221,8 @@ protected:
bool analyse(columns::tree& a_tree,std::vector<value>& a_stack) {
if(a_tree.m_dcl.empty()) { //top
//std::cout << "debug : dcl empty" << std::endl;
tools_vforit(columns::tree,a_tree.m_sub,it) {
if(!analyse(*it,a_stack)) return false;
tools_vforit(columns::tree*,a_tree.m_sub,it) {
if(!analyse(*(*it),a_stack)) return false;
}
} else {
//std::cout << "debug : dcl not empty" << std::endl;
@@ -266,8 +240,8 @@ protected:
}
m_cur_type = value::NONE;
std::vector<value>* stk = new std::vector<value>();
tools_vforit(columns::tree,a_tree.m_sub,it) {
if(!analyse(*it,*stk)) {
tools_vforit(columns::tree*,a_tree.m_sub,it) {
if(!analyse(*(*it),*stk)) {
delete v;
return false;
}