g4tools  5.4.0
Classes | Functions
tools::columns Namespace Reference

Classes

class  finder
 
class  parser
 
class  tree
 

Functions

void delete_columns (std::vector< value > &a_vars)
 
void copy_columns (const std::vector< value > &a_from, std::vector< value > &a_to)
 
void dump_columns (std::ostream &a_out, const std::vector< value > &a_vars, const std::string &a_margin="")
 

Function Documentation

◆ copy_columns()

void tools::columns::copy_columns ( const std::vector< value > &  a_from,
std::vector< value > &  a_to 
)
inline

Definition at line 136 of file columns.

136  {
137  std::vector<value>::const_iterator it;
138  for(it=a_from.begin();it!=a_from.end();++it) {
139  if((*it).type()==value::VOID_STAR) {
140  std::vector<value>* vars = new std::vector<value>();
141  value v((void*)vars);
142  v.set_label((*it).label());
143  a_to.push_back(v);
144  std::vector<value>* p =
145  (std::vector<value>*)(*it).get_void_star();
146  copy_columns(*p,*vars);
147  } else {
148  a_to.push_back(*it);
149  }
150  }
151 }

◆ delete_columns()

void tools::columns::delete_columns ( std::vector< value > &  a_vars)
inline

Definition at line 124 of file columns.

124  {
125  tools_vforit(value,a_vars,it) {
126  if((*it).type()==value::VOID_STAR) {
127  std::vector<value>* vars =
128  (std::vector<value>*)(*it).get_void_star();
129  delete_columns(*vars);
130  delete vars;
131  }
132  }
133  a_vars.clear();
134 }

◆ dump_columns()

void tools::columns::dump_columns ( std::ostream &  a_out,
const std::vector< value > &  a_vars,
const std::string &  a_margin = "" 
)
inline

Definition at line 153 of file columns.

153  {
154  std::vector<value>::const_iterator it;
155  for(it=a_vars.begin();it!=a_vars.end();++it) {
156  if((*it).type()==value::VOID_STAR) {
157  a_out << a_margin
158  << "ITuple : " << (*it).label() << " : begin "
159  << std::endl;
160  std::vector<value>* vars = (std::vector<value>*)(*it).get_void_star();
161  dump_columns(a_out,*vars,a_margin+" ");
162  //a_out << a_margin
163  // << "ITuple : " << (*it).label() << " : end "
164  // << std::endl;
165  } else {
166  std::string stype;
167  (*it).s_type(stype);
168  std::string sval;
169  (*it).tos(sval);
170 
171  a_out << a_margin
172  << stype << " : "
173  << (*it).label() << " : "
174  << sval
175  << std::endl;
176  }
177  }
178 }
tools::columns::copy_columns
void copy_columns(const std::vector< value > &a_from, std::vector< value > &a_to)
Definition: columns:136
tools_vforit
#define tools_vforit(a__T, a__v, a__it)
Definition: forit:13
tools::columns::dump_columns
void dump_columns(std::ostream &a_out, const std::vector< value > &a_vars, const std::string &a_margin="")
Definition: columns:153
tools::columns::delete_columns
void delete_columns(std::vector< value > &a_vars)
Definition: columns:124
tools::stype
const std::string & stype(const mat4f &)
Definition: mat4f:73