Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/externals/g4tools/include/tools/wroot/columns.icc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /externals/g4tools/include/tools/wroot/columns.icc (Version 11.3.0) and /externals/g4tools/include/tools/wroot/columns.icc (Version 11.1.2)


  1 // Copyright (C) 2010, Guy Barrand. All rights      1 // Copyright (C) 2010, Guy Barrand. All rights reserved.
  2 // See the file tools.license for terms.            2 // See the file tools.license for terms.
  3                                                     3 
  4 // common columns code for ntuple and base_pnt      4 // common columns code for ntuple and base_pntuple.
  5                                                     5 
  6   template <class T>                                6   template <class T>
  7   class column_ref : public virtual icol {          7   class column_ref : public virtual icol {
  8 #ifdef TOOLS_MEM                                    8 #ifdef TOOLS_MEM
  9     static const std::string& s_class() {           9     static const std::string& s_class() {
 10       static const std::string s_v("tools::wro     10       static const std::string s_v("tools::wroot::ntuple::column_ref<"+stype(T())+">");
 11       return s_v;                                  11       return s_v;
 12     }                                              12     }
 13 #endif                                             13 #endif
 14   public:                                          14   public:
 15     static cid id_class() {                        15     static cid id_class() {
 16       static const T s_v = T(); //do that for      16       static const T s_v = T(); //do that for T = std::string.
 17       return _cid(s_v)+10000;                      17       return _cid(s_v)+10000;
 18     }                                              18     }
 19     virtual void* cast(cid a_class) const {        19     virtual void* cast(cid a_class) const {
 20       if(void* p = cmp_cast<column_ref>(this,a     20       if(void* p = cmp_cast<column_ref>(this,a_class)) {return p;}
 21       else return 0;                               21       else return 0;
 22     }                                              22     }
 23     virtual cid id_cls() const {return id_clas     23     virtual cid id_cls() const {return id_class();}
 24   public: //icol                                   24   public: //icol
 25     virtual void add() {}                          25     virtual void add() {}
 26     virtual void set_def() {}                      26     virtual void set_def() {}
 27     virtual const std::string& name() const {r     27     virtual const std::string& name() const {return m_leaf->name();}
 28     virtual void set_basket_size(uint32 a_size     28     virtual void set_basket_size(uint32 a_size) {m_branch.set_basket_size(a_size);}
 29     virtual branch& get_branch() const {return     29     virtual branch& get_branch() const {return m_branch;}
 30     virtual base_leaf* get_leaf() const {retur     30     virtual base_leaf* get_leaf() const {return m_leaf;}
 31   public:                                          31   public:
 32     column_ref(branch& a_branch,const std::str     32     column_ref(branch& a_branch,const std::string& a_name,const T& a_ref)
 33     :m_branch(a_branch),m_leaf(0)                  33     :m_branch(a_branch),m_leaf(0)
 34     {                                              34     {
 35 #ifdef TOOLS_MEM                                   35 #ifdef TOOLS_MEM
 36       mem::increment(s_class().c_str());           36       mem::increment(s_class().c_str());
 37 #endif                                             37 #endif
 38       m_leaf = m_branch.create_leaf_ref<T>(a_n     38       m_leaf = m_branch.create_leaf_ref<T>(a_name,a_ref);
 39     }                                              39     }
 40     virtual ~column_ref(){                         40     virtual ~column_ref(){
 41 #ifdef TOOLS_MEM                                   41 #ifdef TOOLS_MEM
 42       mem::decrement(s_class().c_str());           42       mem::decrement(s_class().c_str());
 43 #endif                                             43 #endif
 44     }                                              44     }
 45   protected:                                       45   protected:
 46     column_ref(const column_ref& a_from)           46     column_ref(const column_ref& a_from)
 47     :icol(a_from)                                  47     :icol(a_from)
 48     ,m_branch(a_from.m_branch)                     48     ,m_branch(a_from.m_branch)
 49     ,m_leaf(0)                                     49     ,m_leaf(0)
 50     {}                                             50     {}
 51     column_ref& operator=(const column_ref& a_     51     column_ref& operator=(const column_ref& a_from){
 52       if(&a_from==this) return *this;              52       if(&a_from==this) return *this;
 53       m_leaf = 0;                                  53       m_leaf = 0;
 54       return *this;                                54       return *this;
 55     }                                              55     }
 56   public:                                          56   public:
 57     const T& variable() const {return m_leaf->     57     const T& variable() const {return m_leaf->variable();}
 58     T& variable() {return m_leaf->variable();}     58     T& variable() {return m_leaf->variable();}
 59   protected:                                       59   protected:
 60     branch& m_branch;                              60     branch& m_branch;
 61     leaf_ref<T>* m_leaf;                           61     leaf_ref<T>* m_leaf;
 62   };                                               62   };
 63                                                    63 
 64   template <class T>                               64   template <class T>
 65   class column : public column_ref<T> {            65   class column : public column_ref<T> {
 66     typedef column_ref<T> parent;                  66     typedef column_ref<T> parent;
 67 #ifdef TOOLS_MEM                                   67 #ifdef TOOLS_MEM
 68     static const std::string& s_class() {          68     static const std::string& s_class() {
 69       static const std::string s_v("tools::wro     69       static const std::string s_v("tools::wroot::ntuple::column<"+stype(T())+">");
 70       return s_v;                                  70       return s_v;
 71     }                                              71     }
 72 #endif                                             72 #endif
 73   public:                                          73   public:
 74     static cid id_class() {                        74     static cid id_class() {
 75       static const T s_v = T(); //do that for      75       static const T s_v = T(); //do that for T = std::string.
 76       return _cid(s_v);                            76       return _cid(s_v);
 77     }                                              77     }
 78     virtual void* cast(cid a_class) const {        78     virtual void* cast(cid a_class) const {
 79       if(void* p = cmp_cast<column>(this,a_cla     79       if(void* p = cmp_cast<column>(this,a_class)) {return p;}
 80       else return 0;                               80       else return 0;
 81     }                                              81     }
 82     virtual cid id_cls() const {return id_clas     82     virtual cid id_cls() const {return id_class();}
 83   public: //icol                                   83   public: //icol
 84     virtual void set_def() {m_value = m_def;}      84     virtual void set_def() {m_value = m_def;}
 85   public:                                          85   public:
 86     column(branch& a_branch,const std::string&     86     column(branch& a_branch,const std::string& a_name,const T& a_def)
 87     :parent(a_branch,a_name,m_value)               87     :parent(a_branch,a_name,m_value)
 88     ,m_def(a_def),m_value(a_def)                   88     ,m_def(a_def),m_value(a_def)
 89     {                                              89     {
 90 #ifdef TOOLS_MEM                                   90 #ifdef TOOLS_MEM
 91       mem::increment(s_class().c_str());           91       mem::increment(s_class().c_str());
 92 #endif                                             92 #endif
 93     }                                              93     }
 94     virtual ~column(){                             94     virtual ~column(){
 95 #ifdef TOOLS_MEM                                   95 #ifdef TOOLS_MEM
 96       mem::decrement(s_class().c_str());           96       mem::decrement(s_class().c_str());
 97 #endif                                             97 #endif
 98     }                                              98     }
 99   protected:                                       99   protected:
100     column(const column& a_from)                  100     column(const column& a_from)
101     :icol(a_from)                                 101     :icol(a_from)
102     ,parent(a_from)                               102     ,parent(a_from)
103     ,m_def(a_from.m_def)                          103     ,m_def(a_from.m_def)
104     ,m_value(a_from.m_value)                      104     ,m_value(a_from.m_value)
105     {}                                            105     {}
106     column& operator=(const column& a_from){      106     column& operator=(const column& a_from){
107       if(&a_from==this) return *this;             107       if(&a_from==this) return *this;
108       parent::operator=(a_from);                  108       parent::operator=(a_from);
109       m_def = a_from.m_def;                       109       m_def = a_from.m_def;
110       m_value = a_from.m_value;                   110       m_value = a_from.m_value;
111       return *this;                               111       return *this;
112     }                                             112     }
113   public:                                         113   public:
114     column& operator=(const T& a_value){m_valu    114     column& operator=(const T& a_value){m_value = a_value;return *this;}
115     bool fill(const T& a_value) {m_value = a_v    115     bool fill(const T& a_value) {m_value = a_value;return true;}
116   protected:                                      116   protected:
117     T m_def;                                      117     T m_def;
118     T m_value;                                    118     T m_value;
119   };                                              119   };
120                                                   120 
121   class column_string_ref : public virtual ico    121   class column_string_ref : public virtual icol {
122 #ifdef TOOLS_MEM                                  122 #ifdef TOOLS_MEM
123     static const std::string& s_class() {         123     static const std::string& s_class() {
124       static const std::string s_v("tools::wro    124       static const std::string s_v("tools::wroot::ntuple::column_string_ref");
125       return s_v;                                 125       return s_v;
126     }                                             126     }
127 #endif                                            127 #endif
128   public:                                         128   public:
129     static cid id_class() {                       129     static cid id_class() {
130       static const std::string s_v;               130       static const std::string s_v;
131       return _cid(s_v)+10000;                     131       return _cid(s_v)+10000;
132     }                                             132     }
133     virtual void* cast(cid a_class) const {       133     virtual void* cast(cid a_class) const {
134       if(void* p = cmp_cast<column_string_ref>    134       if(void* p = cmp_cast<column_string_ref>(this,a_class)) {return p;}
135       else return 0;                              135       else return 0;
136     }                                             136     }
137     virtual cid id_cls() const {return id_clas    137     virtual cid id_cls() const {return id_class();}
138   public: //icol                                  138   public: //icol
139     virtual void add() {}                         139     virtual void add() {}
140     virtual void set_def() {}                     140     virtual void set_def() {}
141     virtual const std::string& name() const {r    141     virtual const std::string& name() const {return m_leaf->name();}
142     virtual void set_basket_size(uint32 a_size    142     virtual void set_basket_size(uint32 a_size) {m_branch.set_basket_size(a_size);}
143     virtual branch& get_branch() const {return    143     virtual branch& get_branch() const {return m_branch;}
144     virtual base_leaf* get_leaf() const {retur    144     virtual base_leaf* get_leaf() const {return m_leaf;}
145   public:                                         145   public:
146     column_string_ref(branch& a_branch,const s    146     column_string_ref(branch& a_branch,const std::string& a_name,const std::string& a_ref)
147     :m_branch(a_branch),m_leaf(0)                 147     :m_branch(a_branch),m_leaf(0)
148     {                                             148     {
149 #ifdef TOOLS_MEM                                  149 #ifdef TOOLS_MEM
150       mem::increment(s_class().c_str());          150       mem::increment(s_class().c_str());
151 #endif                                            151 #endif
152       m_leaf = m_branch.create_leaf_string_ref    152       m_leaf = m_branch.create_leaf_string_ref(a_name,a_ref);
153     }                                             153     }
154     virtual ~column_string_ref(){                 154     virtual ~column_string_ref(){
155 #ifdef TOOLS_MEM                                  155 #ifdef TOOLS_MEM
156       mem::decrement(s_class().c_str());          156       mem::decrement(s_class().c_str());
157 #endif                                            157 #endif
158     }                                             158     }
159   protected:                                      159   protected:
160     column_string_ref(const column_string_ref&    160     column_string_ref(const column_string_ref& a_from)
161     :icol(a_from)                                 161     :icol(a_from)
162     ,m_branch(a_from.m_branch)                    162     ,m_branch(a_from.m_branch)
163     ,m_leaf(0)                                    163     ,m_leaf(0)
164     {}                                            164     {}
165     column_string_ref& operator=(const column_    165     column_string_ref& operator=(const column_string_ref& a_from){
166       if(&a_from==this) return *this;             166       if(&a_from==this) return *this;
167       m_leaf = 0;                                 167       m_leaf = 0;
168       return *this;                               168       return *this;
169     }                                             169     }
170   public:                                         170   public:
171     const std::string& variable() const {retur    171     const std::string& variable() const {return m_leaf->variable();}
172     std::string& variable() {return m_leaf->va    172     std::string& variable() {return m_leaf->variable();}
173   protected:                                      173   protected:
174     branch& m_branch;                             174     branch& m_branch;
175     leaf_string_ref* m_leaf;                      175     leaf_string_ref* m_leaf;
176   };                                              176   };
177                                                   177 
178   class column_string : public column_string_r    178   class column_string : public column_string_ref {
179     typedef column_string_ref parent;             179     typedef column_string_ref parent;
180 #ifdef TOOLS_MEM                                  180 #ifdef TOOLS_MEM
181     static const std::string& s_class() {         181     static const std::string& s_class() {
182       static const std::string s_v("tools::wro    182       static const std::string s_v("tools::wroot::ntuple::column_string");
183       return s_v;                                 183       return s_v;
184     }                                             184     }
185 #endif                                            185 #endif
186   public:                                         186   public:
187     static cid id_class() {                       187     static cid id_class() {
188       static const std::string s_v;               188       static const std::string s_v;
189       return _cid(s_v);                           189       return _cid(s_v);
190     }                                             190     }
191     virtual void* cast(cid a_class) const {       191     virtual void* cast(cid a_class) const {
192       if(void* p = cmp_cast<column_string>(thi    192       if(void* p = cmp_cast<column_string>(this,a_class)) {return p;}
193       else return 0;                              193       else return 0;
194     }                                             194     }
195     virtual cid id_cls() const {return id_clas    195     virtual cid id_cls() const {return id_class();}
196   public: //icol                                  196   public: //icol
197     virtual void set_def() {m_value = m_def;}     197     virtual void set_def() {m_value = m_def;}
198   public:                                         198   public:
199     column_string(branch& a_branch,const std::    199     column_string(branch& a_branch,const std::string& a_name,const std::string& a_def)
200     :parent(a_branch,a_name,m_value)              200     :parent(a_branch,a_name,m_value)
201     ,m_def(a_def),m_value(a_def)                  201     ,m_def(a_def),m_value(a_def)
202     {                                             202     {
203 #ifdef TOOLS_MEM                                  203 #ifdef TOOLS_MEM
204       mem::increment(s_class().c_str());          204       mem::increment(s_class().c_str());
205 #endif                                            205 #endif
206     }                                             206     }
207     virtual ~column_string(){                     207     virtual ~column_string(){
208 #ifdef TOOLS_MEM                                  208 #ifdef TOOLS_MEM
209       mem::decrement(s_class().c_str());          209       mem::decrement(s_class().c_str());
210 #endif                                            210 #endif
211     }                                             211     }
212   protected:                                      212   protected:
213     column_string(const column_string& a_from)    213     column_string(const column_string& a_from)
214     :icol(a_from)                                 214     :icol(a_from)
215     ,parent(a_from)                               215     ,parent(a_from)
216     ,m_def(a_from.m_def)                          216     ,m_def(a_from.m_def)
217     ,m_value(a_from.m_value)                      217     ,m_value(a_from.m_value)
218     {}                                            218     {}
219     column_string& operator=(const column_stri    219     column_string& operator=(const column_string& a_from){
220       if(&a_from==this) return *this;             220       if(&a_from==this) return *this;
221       parent::operator=(a_from);                  221       parent::operator=(a_from);
222       m_def = a_from.m_def;                       222       m_def = a_from.m_def;
223       m_value = a_from.m_value;                   223       m_value = a_from.m_value;
224       return *this;                               224       return *this;
225     }                                             225     }
226   public:                                         226   public:
227     column_string& operator=(const std::string    227     column_string& operator=(const std::string& a_value){m_value = a_value;return *this;}
228     bool fill(const std::string& a_value) {m_v    228     bool fill(const std::string& a_value) {m_value = a_value;return true;}
229   protected:                                      229   protected:
230     std::string m_def;                            230     std::string m_def;
231     std::string m_value;                          231     std::string m_value;
232   };                                              232   };
233                                                   233 
234   class column_vector_string_ref : public colu    234   class column_vector_string_ref : public column_string_ref {
235     typedef column_string_ref parent;             235     typedef column_string_ref parent;
236 #ifdef TOOLS_MEM                                  236 #ifdef TOOLS_MEM
237     static const std::string& s_class() {         237     static const std::string& s_class() {
238       static const std::string s_v("tools::wro    238       static const std::string s_v("tools::wroot::ntuple::column_vector_string_ref");
239       return s_v;                                 239       return s_v;
240     }                                             240     }
241 #endif                                            241 #endif
242   public:                                         242   public:
243     static cid id_class() {return _cid_std_vec    243     static cid id_class() {return _cid_std_vector<std::string>()+10000;}
244     virtual void* cast(cid a_class) const {       244     virtual void* cast(cid a_class) const {
245       if(void* p = cmp_cast<column_vector_stri    245       if(void* p = cmp_cast<column_vector_string_ref>(this,a_class)) {return p;}
246       else return 0;                              246       else return 0;
247     }                                             247     }
248     virtual cid id_cls() const {return id_clas    248     virtual cid id_cls() const {return id_class();}
249   public: //icol                                  249   public: //icol
250     virtual void add() {                          250     virtual void add() {
251       m_string.clear();                           251       m_string.clear();
252       tools_vforcit(std::string,m_ref,it) {       252       tools_vforcit(std::string,m_ref,it) {
253         if(it!=m_ref.begin()) m_string += m_se    253         if(it!=m_ref.begin()) m_string += m_sep;
254         m_string += *it;                          254         m_string += *it;
255       }                                           255       }
256       parent::add();                              256       parent::add();
257     }                                             257     }
258   public:                                         258   public:
259     column_vector_string_ref(branch& a_branch,    259     column_vector_string_ref(branch& a_branch,const std::string& a_name,const std::vector<std::string>& a_ref,char a_sep)
260     :parent(a_branch,a_name,m_string)             260     :parent(a_branch,a_name,m_string)
261     ,m_ref(a_ref)                                 261     ,m_ref(a_ref)
262     ,m_sep(a_sep)                                 262     ,m_sep(a_sep)
263     {                                             263     {
264 #ifdef TOOLS_MEM                                  264 #ifdef TOOLS_MEM
265       mem::increment(s_class().c_str());          265       mem::increment(s_class().c_str());
266 #endif                                            266 #endif
267     }                                             267     }
268     virtual ~column_vector_string_ref(){          268     virtual ~column_vector_string_ref(){
269 #ifdef TOOLS_MEM                                  269 #ifdef TOOLS_MEM
270       mem::decrement(s_class().c_str());          270       mem::decrement(s_class().c_str());
271 #endif                                            271 #endif
272     }                                             272     }
273   protected:                                      273   protected:
274     column_vector_string_ref(const column_vect    274     column_vector_string_ref(const column_vector_string_ref& a_from)
275     :icol(a_from)                                 275     :icol(a_from)
276     ,parent(a_from)                               276     ,parent(a_from)
277     ,m_ref(a_from.m_ref)                          277     ,m_ref(a_from.m_ref)
278     ,m_sep(a_from.m_sep)                          278     ,m_sep(a_from.m_sep)
279     {}                                            279     {}
280     column_vector_string_ref& operator=(const     280     column_vector_string_ref& operator=(const column_vector_string_ref& a_from){
281       if(&a_from==this) return *this;             281       if(&a_from==this) return *this;
282       m_sep = a_from.m_sep;                       282       m_sep = a_from.m_sep;
283       return *this;                               283       return *this;
284     }                                             284     }
285   public:                                         285   public:
286     const std::vector<std::string>& variable()    286     const std::vector<std::string>& variable() const {return m_ref;}
287     std::vector<std::string>& variable() {retu    287     std::vector<std::string>& variable() {return const_cast< std::vector<std::string>& >(m_ref);}
288   protected:                                      288   protected:
289     const std::vector<std::string>& m_ref;        289     const std::vector<std::string>& m_ref;
290     char m_sep;                                   290     char m_sep;
291     std::string m_string;                         291     std::string m_string;
292   };                                              292   };
293                                                   293 
294   class column_vector_string : public column_v    294   class column_vector_string : public column_vector_string_ref {
295     typedef column_vector_string_ref parent;      295     typedef column_vector_string_ref parent;
296 #ifdef TOOLS_MEM                                  296 #ifdef TOOLS_MEM
297     static const std::string& s_class() {         297     static const std::string& s_class() {
298       static const std::string s_v("tools::wro    298       static const std::string s_v("tools::wroot::ntuple::column_vector_string");
299       return s_v;                                 299       return s_v;
300     }                                             300     }
301 #endif                                            301 #endif
302   public:                                         302   public:
303     static cid id_class() {return _cid_std_vec    303     static cid id_class() {return _cid_std_vector<std::string>();}
304     virtual void* cast(cid a_class) const {       304     virtual void* cast(cid a_class) const {
305       if(void* p = cmp_cast<column_vector_stri    305       if(void* p = cmp_cast<column_vector_string>(this,a_class)) {return p;}
306       else return 0;                              306       else return 0;
307     }                                             307     }
308     virtual cid id_cls() const {return id_clas    308     virtual cid id_cls() const {return id_class();}
309   public: //icol                                  309   public: //icol
310     virtual void set_def() {m_value = m_def;}     310     virtual void set_def() {m_value = m_def;}
311   public:                                         311   public:
312     column_vector_string(branch& a_branch,cons    312     column_vector_string(branch& a_branch,const std::string& a_name,const std::vector<std::string>& a_def,char a_sep)
313     :parent(a_branch,a_name,m_value,a_sep)        313     :parent(a_branch,a_name,m_value,a_sep)
314     ,m_def(a_def),m_value(a_def)                  314     ,m_def(a_def),m_value(a_def)
315     {                                             315     {
316 #ifdef TOOLS_MEM                                  316 #ifdef TOOLS_MEM
317       mem::increment(s_class().c_str());          317       mem::increment(s_class().c_str());
318 #endif                                            318 #endif
319     }                                             319     }
320     virtual ~column_vector_string(){              320     virtual ~column_vector_string(){
321 #ifdef TOOLS_MEM                                  321 #ifdef TOOLS_MEM
322       mem::decrement(s_class().c_str());          322       mem::decrement(s_class().c_str());
323 #endif                                            323 #endif
324     }                                             324     }
325   protected:                                      325   protected:
326     column_vector_string(const column_vector_s    326     column_vector_string(const column_vector_string& a_from)
327     :icol(a_from)                                 327     :icol(a_from)
328     ,parent(a_from)                               328     ,parent(a_from)
329     ,m_def(a_from.m_def)                          329     ,m_def(a_from.m_def)
330     ,m_value(a_from.m_value)                      330     ,m_value(a_from.m_value)
331     {}                                            331     {}
332     column_vector_string& operator=(const colu    332     column_vector_string& operator=(const column_vector_string& a_from){
333       if(&a_from==this) return *this;             333       if(&a_from==this) return *this;
334       parent::operator=(a_from);                  334       parent::operator=(a_from);
335       m_def = a_from.m_def;                       335       m_def = a_from.m_def;
336       m_value = a_from.m_value;                   336       m_value = a_from.m_value;
337       return *this;                               337       return *this;
338     }                                             338     }
339   public:                                         339   public:
340     column_vector_string& operator=(const std:    340     column_vector_string& operator=(const std::vector<std::string>& a_value){m_value = a_value;return *this;}
341     bool fill(const std::vector<std::string>&     341     bool fill(const std::vector<std::string>& a_value) {m_value = a_value;return true;}
342   protected:                                      342   protected:
343     std::vector<std::string> m_def;               343     std::vector<std::string> m_def;
344     std::vector<std::string> m_value;             344     std::vector<std::string> m_value;
345   };                                              345   };
346                                                   346 
347   template <class T>                              347   template <class T>
348   class std_vector_column_ref : public virtual    348   class std_vector_column_ref : public virtual icol {
349 #ifdef TOOLS_MEM                                  349 #ifdef TOOLS_MEM
350     static const std::string& s_class() {         350     static const std::string& s_class() {
351       static const std::string s_v("tools::wro    351       static const std::string s_v("tools::wroot::ntuple::std_vector_column_ref<"+stype(T())+">");
352       return s_v;                                 352       return s_v;
353     }                                             353     }
354 #endif                                            354 #endif
355   public:                                         355   public:
356     static cid id_class() {return _cid_std_vec    356     static cid id_class() {return _cid_std_vector<T>()+10000;}
357     virtual void* cast(cid a_class) const {       357     virtual void* cast(cid a_class) const {
358       if(void* p = cmp_cast<std_vector_column_    358       if(void* p = cmp_cast<std_vector_column_ref>(this,a_class)) {return p;}
359       else return 0;                              359       else return 0;
360     }                                             360     }
361     virtual cid id_cls() const {return id_clas    361     virtual cid id_cls() const {return id_class();}
362   public: //icol                                  362   public: //icol
363     virtual void add() {                          363     virtual void add() {
364       if(m_leaf_count) m_leaf_count->fill((int    364       if(m_leaf_count) m_leaf_count->fill((int)m_ref.size()); //row_wise
365     }                                             365     }
366     virtual void set_def() {}                     366     virtual void set_def() {}
367     virtual const std::string& name() const {r    367     virtual const std::string& name() const {return m_leaf->name();}
368     virtual void set_basket_size(uint32 a_size    368     virtual void set_basket_size(uint32 a_size) {m_branch.set_basket_size(a_size);}
369     virtual branch& get_branch() const {return    369     virtual branch& get_branch() const {return m_branch;}
370     virtual base_leaf* get_leaf() const {retur    370     virtual base_leaf* get_leaf() const {return m_leaf;}
371   public:                                         371   public:
372     std_vector_column_ref(branch& a_branch,con    372     std_vector_column_ref(branch& a_branch,const std::string& a_name,const std::vector<T>& a_ref)
373     :m_branch(a_branch)                           373     :m_branch(a_branch)
374     ,m_ref(a_ref)                                 374     ,m_ref(a_ref)
375     ,m_leaf(0)                                    375     ,m_leaf(0)
376     ,m_leaf_count(0) //row_wise                   376     ,m_leaf_count(0) //row_wise
377     {                                             377     {
378 #ifdef TOOLS_MEM                                  378 #ifdef TOOLS_MEM
379       mem::increment(s_class().c_str());          379       mem::increment(s_class().c_str());
380 #endif                                            380 #endif
381       if(a_branch.store_cls()==branch_element_    381       if(a_branch.store_cls()==branch_element_store_class()) {
382         //::printf("debug : std_vector_column_    382         //::printf("debug : std_vector_column_ref : column_wise\n");
383         int id = -1;  //same as in std_vector_    383         int id = -1;  //same as in std_vector_be.
384         int type = 0;                             384         int type = 0;
385         m_leaf = m_branch.create_leaf_element(    385         m_leaf = m_branch.create_leaf_element(a_name,id,type);
386       } else { //row_wise.                        386       } else { //row_wise.
387         //::printf("debug : std_vector_column_    387         //::printf("debug : std_vector_column_ref : row_wise\n");
388         std::string leaf_count_name = a_name+"    388         std::string leaf_count_name = a_name+"_count";
389         m_leaf_count = m_branch.create_leaf<in    389         m_leaf_count = m_branch.create_leaf<int>(leaf_count_name);
390         m_leaf = m_branch.create_leaf_std_vect    390         m_leaf = m_branch.create_leaf_std_vector_ref<T>(a_name,*m_leaf_count,a_ref);
391         m_leaf->set_title(a_name+"["+leaf_coun    391         m_leaf->set_title(a_name+"["+leaf_count_name+"]"); //for TTreeFormula::RegisterDimensions.
392       }                                           392       }
393     }                                             393     }
394     virtual ~std_vector_column_ref(){             394     virtual ~std_vector_column_ref(){
395 #ifdef TOOLS_MEM                                  395 #ifdef TOOLS_MEM
396       mem::decrement(s_class().c_str());          396       mem::decrement(s_class().c_str());
397 #endif                                            397 #endif
398     }                                             398     }
399   protected:                                      399   protected:
400     std_vector_column_ref(const std_vector_col    400     std_vector_column_ref(const std_vector_column_ref& a_from)
401     :icol(a_from)                                 401     :icol(a_from)
402     ,m_branch(a_from.m_branch)                 << 402     ,m_branch(a_from.m_barnch)
403     ,m_ref(a_from.m_ref)                          403     ,m_ref(a_from.m_ref)
404     ,m_leaf(0)                                    404     ,m_leaf(0)
405     ,m_leaf_count(0)                              405     ,m_leaf_count(0)
406     {}                                            406     {}
407     std_vector_column_ref& operator=(const std    407     std_vector_column_ref& operator=(const std_vector_column_ref& a_from){
408       if(&a_from==this) return *this;             408       if(&a_from==this) return *this;
409       m_leaf = 0;                                 409       m_leaf = 0;
410       m_leaf_count = 0;                           410       m_leaf_count = 0;
411       return *this;                               411       return *this;
412     }                                             412     }
413   public:                                         413   public:
414     const std::vector<T>& variable() const {re    414     const std::vector<T>& variable() const {return m_ref;}
415     std::vector<T>& variable() {return const_c    415     std::vector<T>& variable() {return const_cast< std::vector<T>& >(m_ref);}
416   protected:                                      416   protected:
417     branch& m_branch;                             417     branch& m_branch;
418     const std::vector<T>& m_ref;                  418     const std::vector<T>& m_ref;
419     base_leaf* m_leaf;                            419     base_leaf* m_leaf;
420     leaf<int>* m_leaf_count; //row_wise.          420     leaf<int>* m_leaf_count; //row_wise.
421   };                                              421   };
422                                                   422 
423   template <class T>                              423   template <class T>
424   class std_vector_column : public std_vector_    424   class std_vector_column : public std_vector_column_ref<T> {
425     typedef std_vector_column_ref<T> parent;      425     typedef std_vector_column_ref<T> parent;
426 #ifdef TOOLS_MEM                                  426 #ifdef TOOLS_MEM
427     static const std::string& s_class() {         427     static const std::string& s_class() {
428       static const std::string s_v("tools::wro    428       static const std::string s_v("tools::wroot::ntuple::std_vector_column<"+stype(T())+">");
429       return s_v;                                 429       return s_v;
430     }                                             430     }
431 #endif                                            431 #endif
432   public:                                         432   public:
433     static cid id_class() {return _cid_std_vec    433     static cid id_class() {return _cid_std_vector<T>();}
434     virtual void* cast(cid a_class) const {       434     virtual void* cast(cid a_class) const {
435       if(void* p = cmp_cast<std_vector_column>    435       if(void* p = cmp_cast<std_vector_column>(this,a_class)) {return p;}
436       else return 0;                              436       else return 0;
437     }                                             437     }
438     virtual cid id_cls() const {return id_clas    438     virtual cid id_cls() const {return id_class();}
439   public: //icol                                  439   public: //icol
440     virtual void set_def() {m_value = m_def;}     440     virtual void set_def() {m_value = m_def;}
441   public:                                         441   public:
442     std_vector_column(branch& a_branch,const s    442     std_vector_column(branch& a_branch,const std::string& a_name,const std::vector<T>& a_def)
443     :parent(a_branch,a_name,m_value)              443     :parent(a_branch,a_name,m_value)
444     ,m_def(a_def),m_value(a_def)                  444     ,m_def(a_def),m_value(a_def)
445     {                                             445     {
446 #ifdef TOOLS_MEM                                  446 #ifdef TOOLS_MEM
447       mem::increment(s_class().c_str());          447       mem::increment(s_class().c_str());
448 #endif                                            448 #endif
449     }                                             449     }
450     virtual ~std_vector_column(){                 450     virtual ~std_vector_column(){
451 #ifdef TOOLS_MEM                                  451 #ifdef TOOLS_MEM
452       mem::decrement(s_class().c_str());          452       mem::decrement(s_class().c_str());
453 #endif                                            453 #endif
454     }                                             454     }
455   protected:                                      455   protected:
456     std_vector_column(const std_vector_column&    456     std_vector_column(const std_vector_column& a_from)
457     :icol(a_from)                                 457     :icol(a_from)
458     ,parent(a_from)                               458     ,parent(a_from)
459     ,m_def(a_from.m_def)                          459     ,m_def(a_from.m_def)
460     ,m_value(a_from.m_value)                      460     ,m_value(a_from.m_value)
461     {}                                            461     {}
462     std_vector_column& operator=(const std_vec    462     std_vector_column& operator=(const std_vector_column& a_from){
463       if(&a_from==this) return *this;             463       if(&a_from==this) return *this;
464       parent::operator=(a_from);                  464       parent::operator=(a_from);
465       m_def = a_from.m_def;                       465       m_def = a_from.m_def;
466       m_value = a_from.m_value;                   466       m_value = a_from.m_value;
467       return *this;                               467       return *this;
468     }                                             468     }
469   public:                                         469   public:
470     std_vector_column& operator=(const std::ve    470     std_vector_column& operator=(const std::vector<T>& a_value){m_value = a_value;return *this;}
471     bool fill(const std::vector<T>& a_value) {    471     bool fill(const std::vector<T>& a_value) {m_value = a_value;return true;}
472   protected:                                      472   protected:
473     std::vector<T> m_def;                         473     std::vector<T> m_def;
474     std::vector<T> m_value;                       474     std::vector<T> m_value;
475   };                                              475   };
476                                                   476