g4tools  5.4.0
Public Member Functions | Protected Attributes | List of all members
tools::ntuple_binding Class Reference

Public Member Functions

 ntuple_binding ()
 
virtual ~ntuple_binding ()
 
 ntuple_binding (const ntuple_binding &a_from)
 
ntuple_bindingoperator= (const ntuple_binding &a_from)
 
template<class T >
void add_column (const std::string &a_name, T &a_user_var)
 
template<class T >
void add_column (const std::string &a_name, std::vector< T > &a_user_var)
 
template<class T >
void add_column_vec (const std::string &a_name, std::vector< T > &a_user_var)
 
template<class T >
void add_column_cid (const std::string &a_name, T &a_user_var)
 
void add_column_no_var (const std::string &a_name)
 
const std::vector< column_binding > & columns () const
 
bool find_user_obj (const std::string &a_name, cid &a_cid, void *&a_obj) const
 
template<class T >
T * find_variable (const std::string &a_name) const
 
template<class T >
std::vector< T > * find_vector_variable (const std::string &a_name) const
 

Protected Attributes

std::vector< column_bindingm_columns
 

Detailed Description

Definition at line 48 of file ntuple_binding.

Constructor & Destructor Documentation

◆ ntuple_binding() [1/2]

tools::ntuple_binding::ntuple_binding ( )
inline

Definition at line 50 of file ntuple_binding.

51  {}

◆ ~ntuple_binding()

virtual tools::ntuple_binding::~ntuple_binding ( )
inlinevirtual

Definition at line 52 of file ntuple_binding.

52 {}

◆ ntuple_binding() [2/2]

tools::ntuple_binding::ntuple_binding ( const ntuple_binding a_from)
inline

Definition at line 54 of file ntuple_binding.

55  :m_columns(a_from.m_columns)
56  {}

Member Function Documentation

◆ add_column() [1/2]

template<class T >
void tools::ntuple_binding::add_column ( const std::string &  a_name,
std::vector< T > &  a_user_var 
)
inline

Definition at line 68 of file ntuple_binding.

68  {
69  m_columns.push_back(column_binding(a_name,_cid_std_vector<T>(),(void*)&a_user_var));
70  }

◆ add_column() [2/2]

template<class T >
void tools::ntuple_binding::add_column ( const std::string &  a_name,
T &  a_user_var 
)
inline

Definition at line 63 of file ntuple_binding.

63  {
64  m_columns.push_back(column_binding(a_name,_cid(T()),(void*)&a_user_var));
65  }

◆ add_column_cid()

template<class T >
void tools::ntuple_binding::add_column_cid ( const std::string &  a_name,
T &  a_user_var 
)
inline

Definition at line 79 of file ntuple_binding.

79  {
80  m_columns.push_back(column_binding(a_name,T::id_class(),(void*)&a_user_var));
81  }

◆ add_column_no_var()

void tools::ntuple_binding::add_column_no_var ( const std::string &  a_name)
inline

Definition at line 83 of file ntuple_binding.

83  { //used in rcsv_ntuple.
84  m_columns.push_back(column_binding(a_name,0,0));
85  }

◆ add_column_vec()

template<class T >
void tools::ntuple_binding::add_column_vec ( const std::string &  a_name,
std::vector< T > &  a_user_var 
)
inline

Definition at line 74 of file ntuple_binding.

74  {
75  m_columns.push_back(column_binding(a_name,_cid_std_vector<T>(),(void*)&a_user_var));
76  }

◆ columns()

const std::vector<column_binding>& tools::ntuple_binding::columns ( ) const
inline

Definition at line 91 of file ntuple_binding.

91 {return m_columns;}

◆ find_user_obj()

bool tools::ntuple_binding::find_user_obj ( const std::string &  a_name,
cid a_cid,
void *&  a_obj 
) const
inline

Definition at line 93 of file ntuple_binding.

93  {
94  tools_vforcit(column_binding,m_columns,it) {
95  if((*it).name()==a_name) {
96  a_cid = (*it).get_cid();
97  a_obj = (*it).user_obj();
98  return true;
99  }
100  }
101  a_cid = 0;
102  a_obj = 0;
103  return false;
104  }

◆ find_variable()

template<class T >
T* tools::ntuple_binding::find_variable ( const std::string &  a_name) const
inline

Definition at line 107 of file ntuple_binding.

107  {
108  tools_vforcit(column_binding,m_columns,it) {
109  if((*it).name()==a_name) {
110  // we should check cid. If so, take care of T=aida::ntuple.
111  return (T*)((*it).user_obj());
112  }
113  }
114  return 0;
115  }

◆ find_vector_variable()

template<class T >
std::vector<T>* tools::ntuple_binding::find_vector_variable ( const std::string &  a_name) const
inline

Definition at line 118 of file ntuple_binding.

118  {
119  tools_vforcit(column_binding,m_columns,it) {
120  if((*it).name()==a_name) {
121  if((*it).get_cid()!=_cid_std_vector<T>()) return 0;
122  return (std::vector<T>*)((*it).user_obj());
123  }
124  }
125  return 0;
126  }

◆ operator=()

ntuple_binding& tools::ntuple_binding::operator= ( const ntuple_binding a_from)
inline

Definition at line 57 of file ntuple_binding.

57  {
58  m_columns = a_from.m_columns;
59  return *this;
60  }

Member Data Documentation

◆ m_columns

std::vector<column_binding> tools::ntuple_binding::m_columns
protected

Definition at line 128 of file ntuple_binding.


The documentation for this class was generated from the following file:
tools::_cid
cid _cid(byte)
Definition: cids:14
tools::ntuple_binding::m_columns
std::vector< column_binding > m_columns
Definition: ntuple_binding:128
tools_vforcit
#define tools_vforcit(a__T, a__v, a__it)
Definition: forit:7