g4tools  5.4.0
ntuple
Go to the documentation of this file.
1 // Copyright (C) 2010, Guy Barrand. All rights reserved.
2 // See the file tools.license for terms.
3 
4 #ifndef tools_hdf5_ntuple
5 #define tools_hdf5_ntuple
6 
7 #include "store"
8 
9 #include <tools/vfind>
10 #include <tools/vmanip>
11 #include <tools/ntuple_binding>
12 #include <tools/ntuple_booking>
13 #include <tools/sout>
14 #include <tools/scast>
15 #include <tools/forit>
16 #include <tools/stype>
17 #include <tools/mnmx>
18 #include <tools/vdata>
19 
20 #ifdef TOOLS_MEM
21 #include <tools/mem>
22 #include <tools/stype>
23 #endif
24 
25 namespace tools {
26 namespace hdf5 {
27 
28 class ntuple : public store {
29 public:
30  class icol {
31  public:
32  virtual ~icol(){}
33  public:
34  virtual void* cast(tools::cid) const = 0;
35  virtual tools::cid id_cls() const = 0;
36  public:
37  virtual bool set_basket_size(size_t a_size) = 0;
38  virtual bool add() = 0;
39  virtual bool fetch_entry() = 0;
40  virtual const std::string& name() const = 0;
41  virtual void reset() = 0;
42  };
43 public:
44 
45  template <class T>
46  class column_ref : public virtual icol {
47 #ifdef TOOLS_MEM
48  static const std::string& s_class() {
49  static const std::string s_v("tools::hdf5::ntuple::column_ref<"+tools::stype(T())+">");
50  return s_v;
51  }
52 #endif
53  public:
54  static tools::cid id_class() {
55  static const T s_v = T(); //do that for T = std::string.
56  return tools::_cid(s_v)+10000;
57  }
58  virtual void* cast(tools::cid a_class) const {
59  if(void* p = tools::cmp_cast<column_ref>(this,a_class)) {return p;}
60  else return 0;
61  }
62  virtual tools::cid id_cls() const {return id_class();}
63  public: //icol
64  virtual bool add() { //write.
65  if(!m_write) return false;
68  m_store.out() << "tools::hdf5::ntuple::column_ref::add : write_page() failed." << std::endl;
69  m_basket_pos = 0;
70  return false;
71  }
72  m_basket_pos = 0;
74  delete [] m_basket;
76  m_basket_pos = 0;
79  }
80  }
82  m_basket_pos++;
83  return true;
84  }
85  virtual bool fetch_entry() { //read.
86  if(m_write) return false;
87  if(m_basket_pos>=m_basket_end) { //we need more data.
88  if(m_branch.pos()>=m_branch.entries()) {
89  m_store.out() << "tools::hdf5::ntuple::column_ref:fetch_entry : no more data." << std::endl;
90  m_basket_pos = 0;
91  m_basket_end = 0;
92  return false;
93  }
95  delete [] m_basket;
97  m_basket_pos = 0;
100  }
102  size_t n = tools::mn<size_t>((size_t)remain,m_basket_size);
103  if(!m_branch.read_page<T>(n,m_basket)) {
104  m_store.out() << "tools::hdf5::ntuple::column_ref:fetch_entry : read_page() failed." << std::endl;
105  m_basket_pos = 0;
106  m_basket_end = 0;
107  return false;
108  }
109  m_basket_pos = 0;
110  m_basket_end = n;
111  }
113  m_basket_pos++;
114  return true;
115  }
116  virtual void reset() {m_branch.reset_pos();}
117  virtual const std::string& name() const {return m_name;}
118  virtual bool set_basket_size(size_t a_size) {
119  if(!a_size) return false;
120  m_want_new_basket_size = a_size;
121  return true;
122  }
123  public:
124  column_ref(store& a_store,pages& a_pages,bool a_write,const std::string& a_name,size_t a_basket_size,T& a_ref)
125  :m_store(a_store)
126  ,m_branch(a_pages)
127  ,m_write(a_write)
128  ,m_name(a_name)
129  ,m_ref(a_ref)
130  ,m_basket_size(a_basket_size?a_basket_size:32000)
131  ,m_basket_pos(0)
132  ,m_basket_end(0) //read.
133  ,m_basket(0)
135  {
136 #ifdef TOOLS_MEM
137  tools::mem::increment(s_class().c_str());
138 #endif
139  m_basket = new T[m_basket_size];
140  if(m_write) {
141  } else { //read.
142  tools::uint64 _entries = m_branch.entries();
143  size_t n = tools::mn<size_t>((size_t)_entries,m_basket_size);
144  if(_entries) {
145  if(!m_branch.read_page<T>(n,m_basket)) {
146  m_store.out() << "tools::hdf5::ntuple::column_ref:column_ref : read_page() failed." << std::endl;
147  m_basket_pos = 0;
148  m_basket_end = 0;
149  return;
150  }
151  }
152  m_basket_pos = 0;
153  m_basket_end = n;
154  }
155  }
156  virtual ~column_ref(){
157  if(m_write && m_basket_pos) {
159  m_store.out() << "tools::hdf5::ntuple::column_ref::~column_ref : write_page() failed." << std::endl;
160  }
161  }
162  delete [] m_basket;
163 #ifdef TOOLS_MEM
164  tools::mem::decrement(s_class().c_str());
165 #endif
166  }
167  protected:
168  column_ref(const column_ref& a_from)
169  :icol(a_from)
170  ,m_store(a_from.m_store)
171  ,m_branch(a_from.m_branch)
172  ,m_write(a_from.m_write)
173  ,m_name(a_from.m_name)
174  ,m_ref(a_from.m_ref)
176  ,m_basket_pos(0)
177  ,m_basket_end(0)
178  ,m_basket(0)
180  {}
181  column_ref& operator=(const column_ref& a_from){
182  if(&a_from==this) return *this;
183  m_name = a_from.m_name;
184  m_basket_size = a_from.m_basket_size;
185  m_basket_pos = 0;
186  m_basket_end = 0;
188  return *this;
189  }
190  protected:
193  bool m_write;
194  std::string m_name;
195  T& m_ref;
197  size_t m_basket_pos;
198  size_t m_basket_end;
201  };
202 
203  template <class T>
204  class column : public column_ref<T> {
205  typedef column_ref<T> parent;
206 #ifdef TOOLS_MEM
207  static const std::string& s_class() {
208  static const std::string s_v("tools::hdf5::ntuple::column<"+tools::stype(T())+">");
209  return s_v;
210  }
211 #endif
212  public:
213  static tools::cid id_class() {
214  static const T s_v = T(); //do that for T = std::string.
215  return tools::_cid(s_v);
216  }
217  virtual void* cast(tools::cid a_class) const {
218  if(void* p = tools::cmp_cast<column>(this,a_class)) {return p;}
219  else return 0;
220  }
221  virtual tools::cid id_cls() const {return id_class();}
222  public:
223  column(store& a_store,pages& a_pages,bool a_write,const std::string& a_name,size_t a_basket_size)
224  :parent(a_store,a_pages,a_write,a_name,a_basket_size,m_tmp)
225  ,m_tmp(T())
226  {
227 #ifdef TOOLS_MEM
228  tools::mem::increment(s_class().c_str());
229 #endif
230  }
231  virtual ~column(){
232 #ifdef TOOLS_MEM
233  tools::mem::decrement(s_class().c_str());
234 #endif
235  }
236  protected:
237  column(const column& a_from)
238  :icol(a_from)
239  ,parent(a_from)
240  ,m_tmp(a_from.m_tmp)
241  {}
242  column& operator=(const column& a_from){
243  if(&a_from==this) return *this;
244  parent::operator=(a_from);
245  m_tmp = a_from.m_tmp;
246  return *this;
247  }
248  public:
249  bool fill(const T& a_value) {m_tmp = a_value;return true;} //write.
250  bool get_entry(T& a_v) const {a_v = m_tmp;return true;} //read.
251  protected:
252  T m_tmp;
253  };
254 
255  TOOLS_CLASS_STRING_VALUE(vector_char,vector<char>)
256  TOOLS_CLASS_STRING_VALUE(vector_short,vector<short>)
257  TOOLS_CLASS_STRING_VALUE(vector_int,vector<int>)
258  TOOLS_CLASS_STRING_VALUE(vector_float,vector<float>)
259  TOOLS_CLASS_STRING_VALUE(vector_double,vector<double>)
260 
261  TOOLS_CLASS_STRING_VALUE(string,string)
262 
263  TOOLS_CLASS_STRING_VALUE(vector_int64,vector<tools::int64>)
264  TOOLS_CLASS_STRING_VALUE(vector_uchar,vector<tools::uchar>)
265  TOOLS_CLASS_STRING_VALUE(vector_ushort,vector<tools::ushort>)
266  TOOLS_CLASS_STRING_VALUE(vector_uint32,vector<tools::uint32>)
267  TOOLS_CLASS_STRING_VALUE(vector_uint64,vector<tools::uint64>)
268 
269 //
270 #define TOOLS_HDF5_NTUPLE_VLEN
271 //
272 #define TOOLS_HDF5_NTUPLE_STRING
273 
274 #ifdef TOOLS_HDF5_NTUPLE_VLEN
275  template <class T>
276  class std_vector_column_ref : public virtual icol {
277 #ifdef TOOLS_MEM
278  static const std::string& s_class() {
279  static const std::string s_v("tools::hdf5::ntuple::std_vector_column_ref<"+tools::stype(T())+">");
280  return s_v;
281  }
282 #endif
283  public:
284  static tools::cid id_class() {return tools::_cid_std_vector<T>()+10000;}
285  virtual void* cast(tools::cid a_class) const {
286  if(void* p = tools::cmp_cast<std_vector_column_ref>(this,a_class)) {return p;}
287  else return 0;
288  }
289  virtual tools::cid id_cls() const {return id_class();}
290  public: //icol
291  virtual bool add() { //write.
292  if(!m_write) return false;
293  const T* _data = tools::vec_data(m_ref);
294  return m_branch.write_vlen<T>(m_ref.size(),_data);
295  }
296  virtual bool fetch_entry() { //read.
297  if(m_write) return false;
298  size_t n;
299  T* _data;
300  if(!m_branch.read_vlen<T>(n,_data)) {
301  m_store.out() << "tools::hdf5::ntuple::std_vector_column_ref:fetch_entry : read_page() failed." << std::endl;
302  return false;
303  }
304  m_ref.resize(n);
305  T* dpos = _data;
306  T* pos = tools::vec_data(m_ref);
307  for(size_t index=0;index<n;index++,pos++,dpos++) *pos = *dpos;
308  delete [] _data;
309  return true;
310  }
311  virtual void reset() {m_branch.reset_pos();}
312  virtual const std::string& name() const {return m_name;}
313  virtual bool set_basket_size(size_t) {return true;}
314  public:
315  std_vector_column_ref(store& a_store,pages& a_pages,bool a_write,const std::string& a_name,
316  size_t /*a_basket_size*/,
317  std::vector<T>& a_ref)
318  :m_store(a_store)
319  ,m_branch(a_pages)
320  ,m_write(a_write)
321  ,m_name(a_name)
322  ,m_ref(a_ref)
323  {
324 #ifdef TOOLS_MEM
325  tools::mem::increment(s_class().c_str());
326 #endif
327  }
329 #ifdef TOOLS_MEM
330  tools::mem::decrement(s_class().c_str());
331 #endif
332  }
333  protected:
335  :icol(a_from)
336  ,m_store(a_from.m_store)
337  ,m_branch(a_from.m_branch)
338  ,m_write(a_from.m_write)
339  ,m_name(a_from.m_name)
340  ,m_ref(a_from.m_ref)
341  {}
343  if(&a_from==this) return *this;
344  m_name = a_from.m_name;
345  return *this;
346  }
347  protected:
350  bool m_write;
351  std::string m_name;
352  std::vector<T>& m_ref;
353  };
354 #else
355  template <class T>
356  class std_vector_column_ref : public column<unsigned int> {
357  typedef column<unsigned int> parent;
358 #ifdef TOOLS_MEM
359  static const std::string& s_class() {
360  static const std::string s_v("tools::hdf5::ntuple::std_vector_column_ref<"+tools::stype(T())+">");
361  return s_v;
362  }
363 #endif
364  public:
365  static tools::cid id_class() {return tools::_cid_std_vector<T>()+10000;}
366  virtual void* cast(tools::cid a_class) const {
367  if(void* p = tools::cmp_cast<std_vector_column_ref>(this,a_class)) {return p;}
368  else return 0;
369  }
370  virtual tools::cid id_cls() const {return id_class();}
371  public: //icol
372  virtual void reset() {
374  m_data_pages.reset_pos();
375  }
376  virtual bool add() { //write.
377  if(!m_write) return false;
378  if(m_ref.size()) {
379  const T* _data = tools::vec_data(m_ref);
380  if(!m_data_pages.write_page<T>(m_ref.size(),_data)) return false;
381  }
382  if(!parent::fill((unsigned int)m_ref.size())) return false;
383  if(!parent::add()) return false;
384  return true;
385  }
386  virtual bool fetch_entry() { //read.
387  if(m_write) return false;
388  if(!parent::fetch_entry()) return false;
389  unsigned int sz;
390  if(!parent::get_entry(sz)) return false;
391  m_ref.resize(sz,T());
392  if(sz) {
393  T* _data = tools::vec_data(m_ref);
394  if(!m_data_pages.read_page<T>(sz,_data)) {m_ref.clear();return false;}
395  }
396  return true;
397  }
398  virtual const std::string& name() const {return m_name;}
399  virtual bool set_basket_size(size_t /*a_size*/) {
400  //m_branch->set_basket_size(a_size);
401  return true;
402  }
403  public:
404  std_vector_column_ref(store& a_store,pages& a_pages,bool a_write,
405  const std::string& a_name,size_t a_basket_size,
406  std::vector<T>& a_ref)
407  :parent(a_store,a_pages,a_write,a_name,a_basket_size)
408  ,m_ref(a_ref)
409  ,m_data_pages(a_store.out(),a_store.group(),a_name+"_data",tools::stype(T()),a_write,a_store.compress_level())
410  {
411 #ifdef TOOLS_MEM
412  tools::mem::increment(s_class().c_str());
413 #endif
414  if(!m_data_pages.is_valid()) {
415  m_store.out() << "tools::hdf5::std_vector_column_ref::std_vector_column_ref :"
416  << " can't create data pages." << std::endl;
417  }
418  }
419  virtual ~std_vector_column_ref(){
420 #ifdef TOOLS_MEM
421  tools::mem::decrement(s_class().c_str());
422 #endif
423  }
424  protected:
426  :icol(a_from)
427  ,parent(a_from)
428  ,m_ref(a_from.m_ref)
429  ,m_data_pages(a_from.m_store.out(),a_from.m_store.group(),a_from.m_name+"_data",
430  tools::stype(T()),a_from.m_write,a_from.m_store.compress_level())
431  {}
433  if(&a_from==this) return *this;
434  m_name = a_from.m_name;
435  return *this;
436  }
437  public:
438  //const std::vector<T>& ref() const {return m_ref;}
439  protected:
440  std::vector<T>& m_ref;
441  pages m_data_pages;
442  };
443 #endif //TOOLS_HDF5_NTUPLE_VLEN
444 
445  template <class T>
448 #ifdef TOOLS_MEM
449  static const std::string& s_class() {
450  static const std::string s_v("tools::hdf5::ntuple::std_vector_column<"+tools::stype(T())+">");
451  return s_v;
452  }
453 #endif
454  public:
455  static tools::cid id_class() {return tools::_cid_std_vector<T>();}
456  virtual void* cast(tools::cid a_class) const {
457  if(void* p = tools::cmp_cast<std_vector_column>(this,a_class)) {return p;}
458  else return 0;
459  }
460  virtual tools::cid id_cls() const {return id_class();}
461  public:
462  std_vector_column(store& a_store,pages& a_pages,bool a_write,const std::string& a_name,size_t a_basket_size)
463  :parent(a_store,a_pages,a_write,a_name,a_basket_size,m_tmp)
464  {}
465  virtual ~std_vector_column(){}
466  protected:
468  :icol(a_from)
469  ,parent(a_from)
470  {}
472  parent::operator=(a_from);
473  return *this;
474  }
475  public:
476  //bool get_entry(std::vector<T>& a_v) const {
477  // a_v = m_tmp;
478  // return true;
479  //}
480  const std::vector<T>& data() const {return m_tmp;}
481  protected:
482  std::vector<T> m_tmp;
483  };
484 
485 #ifdef TOOLS_HDF5_NTUPLE_STRING
486  class column_string_ref : public virtual icol {
487 #ifdef TOOLS_MEM
489 #endif
490  public:
491  static tools::cid id_class() {
492  static const std::string s_v;
493  return tools::_cid(s_v)+10000;
494  }
495  virtual void* cast(tools::cid a_class) const {
496  if(void* p = tools::cmp_cast<column_string_ref>(this,a_class)) {return p;}
497  else return 0;
498  }
499  virtual tools::cid id_cls() const {return id_class();}
500  public: //icol
501  virtual bool add() { //write.
502  if(!m_write) return false;
503  return m_branch.write_string(m_ref);
504  }
505  virtual bool fetch_entry() { //read.
506  if(m_write) return false;
507  if(!m_branch.read_string(m_ref)) {
508  m_store.out() << "tools::hdf5::ntuple::column_string_ref:fetch_entry : read_page() failed." << std::endl;
509  return false;
510  }
511  return true;
512  }
513  virtual void reset() {m_branch.reset_pos();}
514  virtual const std::string& name() const {return m_name;}
515  virtual bool set_basket_size(size_t) {return true;}
516  public:
517  column_string_ref(store& a_store,pages& a_pages,bool a_write,const std::string& a_name,
518  size_t /*a_basket_size*/,
519  std::string& a_ref)
520  :m_store(a_store)
521  ,m_branch(a_pages)
522  ,m_write(a_write)
523  ,m_name(a_name)
524  ,m_ref(a_ref)
525  {
526 #ifdef TOOLS_MEM
527  tools::mem::increment(s_class().c_str());
528 #endif
529  }
531 #ifdef TOOLS_MEM
532  tools::mem::decrement(s_class().c_str());
533 #endif
534  }
535  protected:
537  :icol(a_from)
538  ,m_store(a_from.m_store)
539  ,m_branch(a_from.m_branch)
540  ,m_write(a_from.m_write)
541  ,m_name(a_from.m_name)
542  ,m_ref(a_from.m_ref)
543  {}
545  if(&a_from==this) return *this;
546  m_name = a_from.m_name;
547  return *this;
548  }
549  protected:
552  bool m_write;
553  std::string m_name;
554  std::string& m_ref;
555  };
556 #else
557  class column_string_ref : public column<unsigned int> {
558  typedef column<unsigned int> parent;
559 #ifdef TOOLS_MEM
561 #endif
562  public:
563  static tools::cid id_class() {
564  static const std::string s_v;
565  return tools::_cid(s_v)+10000;
566  }
567  virtual void* cast(tools::cid a_class) const {
568  if(void* p = tools::cmp_cast<column_string_ref>(this,a_class)) {return p;}
569  else return 0;
570  }
571  virtual tools::cid id_cls() const {return id_class();}
572  public: //icol
573  virtual void reset() {
574  m_branch.reset_pos();
575  m_data_pages.reset_pos();
576  }
577  virtual bool add() { //write.
578  if(!m_write) return false;
579  if(m_ref.size()) {
580  const char* _data = m_ref.c_str();
581  if(!m_data_pages.write_page<char>(m_ref.size(),_data)) return false;
582  }
583  if(!parent::fill((unsigned int)m_ref.size())) return false;
584  if(!parent::add()) return false;
585  return true;
586  }
587  virtual bool fetch_entry() { //read.
588  if(m_write) return false;
589  if(!parent::fetch_entry()) return false;
590  unsigned int sz;
591  if(!parent::get_entry(sz)) return false;
592  m_ref.resize(sz);
593  if(sz) {
594  char* _data = (char*)m_ref.c_str();
595  if(!m_data_pages.read_page<char>(sz,_data)) {m_ref.clear();return false;}
596  }
597  return true;
598  }
599  virtual const std::string& name() const {return m_name;}
600  virtual bool set_basket_size(size_t /*a_size*/) {
601  //m_branch->set_basket_size(a_size);
602  return true;
603  }
604  public:
605  column_string_ref(store& a_store,pages& a_pages,bool a_write,
606  const std::string& a_name,size_t a_basket_size,
607  std::string& a_ref)
608  :parent(a_store,a_pages,a_write,a_name,a_basket_size)
609  ,m_ref(a_ref)
610  ,m_data_pages(a_store.out(),a_store.group(),a_name+"_data",tools::stype(char()),a_write,a_store.compress_level())
611  {
612 #ifdef TOOLS_MEM
613  tools::mem::increment(s_class().c_str());
614 #endif
615  if(!m_data_pages.is_valid()) {
616  m_store.out() << "tools::hdf5::column_string_ref::column_string_ref :"
617  << " can't create data pages." << std::endl;
618  }
619  }
620  virtual ~column_string_ref(){
621 #ifdef TOOLS_MEM
622  tools::mem::decrement(s_class().c_str());
623 #endif
624  }
625  protected:
626  column_string_ref(const column_string_ref& a_from)
627  :icol(a_from)
628  ,parent(a_from)
629  ,m_ref(a_from.m_ref)
630  ,m_data_pages(a_from.m_store.out(),a_from.m_store.group(),a_from.m_name+"_data",
631  tools::stype(char()),a_from.m_write,a_from.m_store.compress_level())
632  {}
633  column_string_ref& operator=(const column_string_ref& a_from){
634  if(&a_from==this) return *this;
635  m_name = a_from.m_name;
636  return *this;
637  }
638  public:
639  //const std::string& ref() const {return m_ref;}
640  protected:
641  std::string& m_ref;
642  pages m_data_pages;
643  };
644 #endif //TOOLS_HDF5_NTUPLE_STRING
645 
647  typedef column_string_ref parent;
648 #ifdef TOOLS_MEM
650 #endif
651  public:
652  static tools::cid id_class() {
653  static const std::string s_v;
654  return tools::_cid(s_v);
655  }
656  virtual void* cast(tools::cid a_class) const {
657  if(void* p = tools::cmp_cast<column_string>(this,a_class)) {return p;}
658  else return 0;
659  }
660  virtual tools::cid id_cls() const {return id_class();}
661  public:
662  column_string(store& a_store,pages& a_pages,bool a_write,const std::string& a_name,tools::uint32 a_basket_size)
663  :parent(a_store,a_pages,a_write,a_name,a_basket_size,m_tmp)
664  {
665 #ifdef TOOLS_MEM
666  tools::mem::increment(s_class().c_str());
667 #endif
668  }
669  virtual ~column_string(){
670 #ifdef TOOLS_MEM
671  tools::mem::decrement(s_class().c_str());
672 #endif
673  }
674  protected:
676  :icol(a_from)
677  ,parent(a_from)
678  {}
680  if(&a_from==this) return *this;
681  parent::operator=(a_from);
682  return *this;
683  }
684  public:
685  bool fill(const std::string& a_value) {m_tmp = a_value;return true;}
686  bool get_entry(std::string& a_value) const {a_value = m_tmp;return true;}
687  protected:
688  std::string m_tmp;
689  };
690 
691 public:
692  ntuple(std::ostream& a_out,hid_t a_group,const std::string& a_name,
693  unsigned int a_compress,size_t /*a_basket_size*//* = 32000*/)
694  :store(a_out,a_group,a_name,true,a_compress) //true=write
695  {}
696 
697  ntuple(std::ostream& a_out,hid_t a_group,const std::string& a_name)
698  :store(a_out,a_group,a_name,false,0) //false=read
699  {
700  tools_vforcit(pages*,m_pagess,it){
701 
702 #define TOOLS_HDF5_NTUPLE_READ_CREATE_COL(a__type) \
703  if((*it)->form()==tools::stype(a__type())) {\
704  column<a__type>* col = new column<a__type>(*this,*(*it),false,(*it)->name(),0);\
705  if(!col) {tools::safe_clear<icol>(m_cols);return;}\
706  m_cols.push_back(col);\
707  }
708 
709 #define TOOLS_HDF5_NTUPLE_READ_CREATE_VEC_COL(a__vec_type,a__type) \
710  if((*it)->form()==s_vector_##a__vec_type()) {\
711  std_vector_column<a__type>* col = new std_vector_column<a__type>(*this,*(*it),false,(*it)->name(),0);\
712  if(!col) {tools::safe_clear<icol>(m_cols);return;}\
713  m_cols.push_back(col);\
714  }
715 
720 
723 
728 
729  //else TOOLS_HDF5_NTUPLE_READ_CREATE_COL(bool) //use byte=uchar.
730 
731  else
732  if((*it)->form()==s_string()) {
733  column_string* col = new column_string(*this,*(*it),false,(*it)->name(),0);
734  if(!col) {tools::safe_clear<icol>(m_cols);return;}
735  m_cols.push_back(col);
736  }
737 
739  else TOOLS_HDF5_NTUPLE_READ_CREATE_VEC_COL(short,short)
742 
743  else TOOLS_HDF5_NTUPLE_READ_CREATE_VEC_COL(float,float)
744  else TOOLS_HDF5_NTUPLE_READ_CREATE_VEC_COL(double,double)
745 
750 
751 // else TOOLS_HDF5_NTUPLE_READ_CREATE_VEC_COL(std::string)
752 // else TOOLS_HDF5_NTUPLE_READ_CREATE_VEC_COL(bool) //use byte=uchar.
753 
754  else {
755  m_out << "tools::hdf5::ntuple::ntuple(read) :"
756  << " for column " << tools::sout((*it)->name())
757  << ", type " << tools::sout((*it)->form()) << " not yet handled."
758  << std::endl;
759  //throw
760  tools::safe_clear<icol>(m_cols);
761  return;
762  }
763  }
764 #undef TOOLS_HDF5_NTUPLE_READ_CREATE_VEC_COL
765 #undef TOOLS_HDF5_NTUPLE_READ_CREATE_COL
766  }
767 
768  ntuple(std::ostream& a_out,hid_t a_group,const std::string& a_name,const tools::ntuple_binding& a_bd)
769  :store(a_out,a_group,a_name,false,0) //false=read
770  {
771  if(!initialize(a_out,a_bd)) {}
772  }
773 
774  ntuple(std::ostream& a_out,hid_t a_group,const tools::ntuple_booking& a_bkg,
775  unsigned int a_compress,size_t a_basket_size/* = 32000*/)
776  :store(a_out,a_group,a_bkg.name(),true,a_compress) //true=write
777  ,m_title(a_bkg.title())
778  {
779  const std::vector<tools::column_booking>& cols = a_bkg.columns();
781 
782 #define TOOLS_HDF5_NTUPLE_CREATE_COL(a__type) \
783  if((*it).cls_id()==tools::_cid(a__type())) {\
784  a__type* user = (a__type*)(*it).user_obj();\
785  if(user) {\
786  if(!create_column_ref<a__type>((*it).name(),a_basket_size,*user)) {\
787  m_out << "tools::hdf5::ntuple :"\
788  << " can't create column_ref " << tools::sout((*it).name()) << "."\
789  << std::endl;\
790  tools::safe_clear<icol>(m_cols);\
791  return;\
792  }\
793  } else {\
794  if(!create_column<a__type>((*it).name(),a_basket_size)) {\
795  m_out << "tools::hdf5::ntuple :"\
796  << " can't create column " << tools::sout((*it).name()) << "."\
797  << std::endl;\
798  tools::safe_clear<icol>(m_cols);\
799  return;\
800  }\
801  }\
802  }
803 
804 #define TOOLS_HDF5_NTUPLE_CREATE_VEC_COL(a__type) \
805  if((*it).cls_id()==tools::_cid_std_vector<a__type>()) {\
806  std::vector<a__type>* vec = (std::vector<a__type>*)(*it).user_obj();\
807  if(!vec) {\
808  m_out << "tools::hdf5::ntuple :"\
809  << " for std::vector column " << tools::sout((*it).name())\
810  << ", the user vector pointer is null."\
811  << std::endl;\
812  tools::safe_clear<icol>(m_cols);\
813  return;\
814  }\
815  if(!create_std_column_ref<a__type>((*it).name(),a_basket_size,*vec)) {\
816  m_out << "tools::hdf5::ntuple :"\
817  << " can't create std::vector column " << tools::sout((*it).name()) << "."\
818  << std::endl;\
819  tools::safe_clear<icol>(m_cols);\
820  return;\
821  }\
822  }
823 
825  else TOOLS_HDF5_NTUPLE_CREATE_COL(short)
828 
829  else TOOLS_HDF5_NTUPLE_CREATE_COL(float)
830  else TOOLS_HDF5_NTUPLE_CREATE_COL(double)
831 
836 
837  //else TOOLS_HDF5_NTUPLE_CREATE_COL(bool) //use byte=uchar.
838 
839  else if((*it).cls_id()==tools::_cid(std::string())) {
840  if(!create_column_string((*it).name(),a_basket_size)) {
841  m_out << "tools::hdf5::ntuple :"
842  << " can't create string column " << tools::sout((*it).name()) << "."
843  << std::endl;
844  tools::safe_clear<icol>(m_cols);
845  return;
846  }
847 
852 
855 
860 
861 // else TOOLS_HDF5_NTUPLE_CREATE_VEC_COL(std::string)
862 // else TOOLS_HDF5_NTUPLE_CREATE_VEC_COL(bool) //use byte=uchar.
863 
864  else {
865  m_out << "tools::hdf5::ntuple :"
866  << " for column " << tools::sout((*it).name())
867  << ", type with cid " << (*it).cls_id() << " not yet handled."
868  << std::endl;
869  tools::safe_clear<icol>(m_cols);
870  return;
871  }
872  }
873 #undef TOOLS_HDF5_NTUPLE_CREATE_COL
874 #undef TOOLS_HDF5_NTUPLE_CREATE_VEC_COL
875 
876  }
877 
878  virtual ~ntuple() {
879  tools::safe_clear<icol>(m_cols);
880  }
881 protected:
882  ntuple(const ntuple& a_from):store(a_from),m_title(a_from.m_title){}
883  ntuple& operator=(const ntuple&){return *this;}
884 public:
885  bool initialize(std::ostream& a_out,const tools::ntuple_binding& a_bd = tools::ntuple_binding()) {
886  tools::safe_clear<icol>(m_cols);
887  {tools_vforcit(pages*,m_pagess,it) (*it)->reset_pos();}
888 
889  tools_vforcit(pages*,m_pagess,it) {
890 
891 #define TOOLS_HDF5_NTUPLE_READ_BINDING_CREATE_COL(a__type) \
892  if((*it)->form()==tools::stype(a__type())) {\
893  a__type* user_var = a_bd.find_variable<a__type>((*it)->name());\
894  if(user_var) {\
895  column_ref<a__type>* col = new column_ref<a__type>(*this,*(*it),false,(*it)->name(),0,*user_var);\
896  if(!col) {tools::safe_clear<icol>(m_cols);return false;}\
897  m_cols.push_back(col);\
898  } else {\
899  column<a__type>* col = new column<a__type>(*this,*(*it),false,(*it)->name(),0);\
900  if(!col) {tools::safe_clear<icol>(m_cols);return false;}\
901  m_cols.push_back(col);\
902  }\
903  }
904 
905 #define TOOLS_HDF5_NTUPLE_READ_BINDING_CREATE_VEC_COL(a__vec_type,a__type) \
906  if((*it)->form()==s_vector_##a__vec_type()) {\
907  std::vector<a__type>* user_var = a_bd.find_variable< std::vector<a__type> >((*it)->name());\
908  if(user_var) {\
909  std_vector_column_ref<a__type>* col = \
910  new std_vector_column_ref<a__type>(*this,*(*it),false,(*it)->name(),0,*user_var);\
911  if(!col) {tools::safe_clear<icol>(m_cols);return false;}\
912  m_cols.push_back(col);\
913  } else {\
914  std_vector_column<a__type>* col = new std_vector_column<a__type>(*this,*(*it),false,(*it)->name(),0);\
915  if(!col) {tools::safe_clear<icol>(m_cols);return false;}\
916  m_cols.push_back(col);\
917  }\
918  }
919 
924 
927 
932 
933  //else TOOLS_HDF5_NTUPLE_READ_BINDING_CREATE_COL(bool) //use byte=uchar.
934 
935  else
936  if((*it)->form()==s_string()) {
937  std::string* user_var = a_bd.find_variable<std::string>((*it)->name());
938  if(user_var) {
939  column_string_ref* col = new column_string_ref(*this,*(*it),false,(*it)->name(),0,*user_var);
940  if(!col) {tools::safe_clear<icol>(m_cols);return false;}
941  m_cols.push_back(col);
942  } else {
943  column_string* col = new column_string(*this,*(*it),false,(*it)->name(),0);
944  if(!col) {tools::safe_clear<icol>(m_cols);return false;}
945  m_cols.push_back(col);
946  }
947  }
948 
953 
956 
961 
962 // else TOOLS_HDF5_NTUPLE_READ_BINDING_CREATE_VEC_COL(std::string)
963 // else TOOLS_HDF5_NTUPLE_READ_BINDING_CREATE_VEC_COL(bool) //use byte=uchar.
964 
965  else {
966  a_out << "tools::hdf5::ntuple::ntuple(read with binding) :"
967  << " for column " << tools::sout((*it)->name())
968  << ", type " << tools::sout((*it)->form()) << " not yet handled."
969  << std::endl;
970  tools::safe_clear<icol>(m_cols);
971  return false;
972  }
973  }
974 #undef TOOLS_HDF5_NTUPLE_READ_BINDING_CREATE_COL
975 #undef TOOLS_HDF5_NTUPLE_READ_BINDING_CREATE_VEC_COL
976  return true;
977  }
978 
979  const std::string& title() const {return m_title;}
980 
981  const std::vector<icol*>& columns() const {return m_cols;}
982  std::vector<icol*>& columns() {return m_cols;}
983 
984  template <class T>
985  column_ref<T>* create_column_ref(const std::string& a_name,size_t a_basket_size,T& a_ref) {
986  if(tools::find_named<icol>(m_cols,a_name)) return 0;
987  pages* _pages = create_pages(a_name,tools::stype(T()));
988  if(!_pages) return 0;
989  column_ref<T>* col = new column_ref<T>(*this,*_pages,true,a_name,a_basket_size,a_ref);
990  if(!col) return 0;
991  m_cols.push_back(col);
992  return col;
993  }
994 
995  template <class T>
996  column<T>* create_column(const std::string& a_name,size_t a_basket_size) {
997  if(tools::find_named<icol>(m_cols,a_name)) return 0;
998  pages* _pages = create_pages(a_name,tools::stype(T()));
999  if(!_pages) return 0;
1000  column<T>* col = new column<T>(*this,*_pages,true,a_name,a_basket_size);
1001  if(!col) return 0;
1002  m_cols.push_back(col);
1003  return col;
1004  }
1005 
1006  column_string* create_column_string(const std::string& a_name,size_t a_basket_size) {
1007  if(tools::find_named<icol>(m_cols,a_name)) return 0;
1008  pages* _pages = create_pages(a_name,s_string());
1009  if(!_pages) return 0;
1010  column_string* col = new column_string(*this,*_pages,true,a_name,a_basket_size);
1011  if(!col) return 0;
1012  m_cols.push_back(col);
1013  return col;
1014  }
1015 
1016  template <class T>
1017  std_vector_column_ref<T>* create_std_column_ref(const std::string& a_name,size_t a_basket_size,std::vector<T>& a_ref) {
1018  //NOTE : to optimize, we do not handle a default std::vector value logic.
1019  if(tools::find_named<icol>(m_cols,a_name)) return 0;
1020  pages* _pages = create_pages(a_name,"vector<"+tools::stype(T())+">");
1021  if(!_pages) return 0;
1022  std_vector_column_ref<T>* col = new std_vector_column_ref<T>(*this,*_pages,true,a_name,a_basket_size,a_ref);
1023  if(!col) return 0;
1024  m_cols.push_back(col);
1025  return col;
1026  }
1027 
1028  template <class T>
1029  column_ref<T>* find_column_ref(const std::string& a_name) {
1030  icol* col = tools::find_named<icol>(m_cols,a_name);
1031  if(!col) return 0;
1032  return tools::id_cast<icol, column_ref<T> >(*col);
1033  }
1034  template <class T>
1035  column<T>* find_column(const std::string& a_name) {
1036  icol* col = tools::find_named<icol>(m_cols,a_name);
1037  if(!col) return 0;
1038  return tools::id_cast<icol, column<T> >(*col);
1039  }
1040 
1041  template <class T>
1043  icol* col = tools::find_named<icol>(m_cols,a_name);
1044  if(!col) return 0;
1045  return tools::id_cast<icol, std_vector_column_ref<T> >(*col);
1046  }
1047  template <class T>
1048  std_vector_column<T>* find_std_vector_column(const std::string& a_name) {
1049  icol* col = tools::find_named<icol>(m_cols,a_name);
1050  if(!col) return 0;
1051  return tools::id_cast<icol, std_vector_column<T> >(*col);
1052  }
1053 
1054  column_string* find_column_string(const std::string& a_name) {
1055  icol* col = tools::find_named<icol>(m_cols,a_name);
1056  if(!col) return 0;
1057  return tools::id_cast<icol, column_string >(*col);
1058  }
1059 
1060  bool add_row() { //write.
1061  if(m_cols.empty()) return false;
1062  bool status = true;
1063  tools_vforit(icol*,m_cols,it) {if(!(*it)->add()) status = false;}
1064  //tools::uint32 n;
1065  //bool status = store::fill(n);
1066  //tools_vforit(icol*,m_cols,it) (*it)->set_def();
1067  return status;
1068  }
1069 
1070  bool get_row() { //read.
1071  bool status = true;
1072  tools_vforcit(icol*,m_cols,it) {
1073  if(!(*it)->fetch_entry()) status = false;
1074  }
1075  return status;
1076  }
1077 
1078  bool set_basket_size(size_t a_size) {
1079  tools_vforit(icol*,m_cols,it) {if(!(*it)->set_basket_size(a_size)) return false;}
1080  return true;
1081  }
1082 
1083  void reset() { //read.
1084  tools_vforit(icol*,m_cols,it) (*it)->reset();
1085  }
1086 
1087 protected:
1088  std::string m_title;
1089  std::vector<icol*> m_cols;
1090 };
1091 
1092 }}
1093 
1094 #endif
tools::hdf5::pages::write_vlen
bool write_vlen(size_t a_size, const TYPE *a_array)
Definition: pages:155
tools::hdf5::pages::read_page
bool read_page(size_t a_size, TYPE *a_array)
Definition: pages:128
tools::hdf5::ntuple::std_vector_column::data
const std::vector< T > & data() const
Definition: ntuple:480
tools::uint64
unsigned long long uint64
Definition: typedefs:72
tools::hdf5::ntuple::std_vector_column_ref::m_store
store & m_store
Definition: ntuple:348
tools::byte
unsigned char byte
Definition: typedefs:96
tools::hdf5::ntuple::ntuple
ntuple(std::ostream &a_out, hid_t a_group, const tools::ntuple_booking &a_bkg, unsigned int a_compress, size_t a_basket_size)
Definition: ntuple:774
tools::hdf5::ntuple::std_vector_column_ref::m_write
bool m_write
Definition: ntuple:350
tools::int64
long long int64
Definition: typedefs:67
tools::hdf5::pages::read_string
bool read_string(std::string &a_string)
Definition: pages:215
TOOLS_HDF5_NTUPLE_READ_BINDING_CREATE_VEC_COL
#define TOOLS_HDF5_NTUPLE_READ_BINDING_CREATE_VEC_COL(a__vec_type, a__type)
tools::hdf5::ntuple::column_ref::fetch_entry
virtual bool fetch_entry()
Definition: ntuple:85
tools::hdf5::ntuple::column_string_ref::~column_string_ref
virtual ~column_string_ref()
Definition: ntuple:530
tools::hdf5::ntuple::columns
std::vector< icol * > & columns()
Definition: ntuple:982
tools::hdf5::ntuple::column_ref::id_class
static tools::cid id_class()
Definition: ntuple:54
tools::hdf5::ntuple::column_ref::id_cls
virtual tools::cid id_cls() const
Definition: ntuple:62
tools::_cid
cid _cid(byte)
Definition: cids:14
tools::hdf5::store::compress_level
unsigned int compress_level() const
Definition: store:193
tools::hdf5::ntuple::column_string::column_string
column_string(const column_string &a_from)
Definition: ntuple:675
tools::hdf5::ntuple::column_ref::column_ref
column_ref(store &a_store, pages &a_pages, bool a_write, const std::string &a_name, size_t a_basket_size, T &a_ref)
Definition: ntuple:124
mnmx
tools::hdf5::ntuple::icol::id_cls
virtual tools::cid id_cls() const =0
tools::hdf5::ntuple::column_ref::m_basket_end
size_t m_basket_end
Definition: ntuple:198
tools::hdf5::ntuple::std_vector_column_ref::set_basket_size
virtual bool set_basket_size(size_t)
Definition: ntuple:313
tools::hdf5::ntuple::get_row
bool get_row()
Definition: ntuple:1070
tools::hdf5::ntuple::std_vector_column::std_vector_column
std_vector_column(store &a_store, pages &a_pages, bool a_write, const std::string &a_name, size_t a_basket_size)
Definition: ntuple:462
tools::hdf5::ntuple::find_column_ref
column_ref< T > * find_column_ref(const std::string &a_name)
Definition: ntuple:1029
tools::column_booking
Definition: ntuple_booking:17
tools::hdf5::ntuple::m_title
std::string m_title
Definition: ntuple:1088
tools::hdf5::pages
Definition: pages:27
tools::hdf5::ntuple::initialize
bool initialize(std::ostream &a_out, const tools::ntuple_binding &a_bd=tools::ntuple_binding())
Definition: ntuple:885
tools::hdf5::ntuple::find_std_vector_column
std_vector_column< T > * find_std_vector_column(const std::string &a_name)
Definition: ntuple:1048
tools::ntuple_binding
Definition: ntuple_binding:48
tools::hdf5::ntuple::column::operator=
column & operator=(const column &a_from)
Definition: ntuple:242
tools::hdf5::ntuple::find_column
column< T > * find_column(const std::string &a_name)
Definition: ntuple:1035
tools::add
bool add(std::vector< T > &a_vec, const std::vector< T > &a_v)
Definition: vmanip:250
tools::hdf5::ntuple::~ntuple
virtual ~ntuple()
Definition: ntuple:878
tools::hdf5::ntuple::std_vector_column::std_vector_column
std_vector_column(const std_vector_column &a_from)
Definition: ntuple:467
tools::hdf5::ntuple::std_vector_column::m_tmp
std::vector< T > m_tmp
Definition: ntuple:482
tools::hdf5::ntuple::column::cast
virtual void * cast(tools::cid a_class) const
Definition: ntuple:217
tools::hdf5::ntuple::std_vector_column_ref::fetch_entry
virtual bool fetch_entry()
Definition: ntuple:296
tools::hdf5::pages::pos
tools::uint64 pos() const
Definition: pages:101
tools::hdf5::ntuple::column_string::column_string
column_string(store &a_store, pages &a_pages, bool a_write, const std::string &a_name, tools::uint32 a_basket_size)
Definition: ntuple:662
tools::hdf5::ntuple::ntuple
ntuple(const ntuple &a_from)
Definition: ntuple:882
tools::hdf5::ntuple::column_string::fill
bool fill(const std::string &a_value)
Definition: ntuple:685
ntuple_booking
tools::hdf5::ntuple::icol::add
virtual bool add()=0
tools::hdf5::ntuple::icol::set_basket_size
virtual bool set_basket_size(size_t a_size)=0
tools::hdf5::ntuple::column_ref::~column_ref
virtual ~column_ref()
Definition: ntuple:156
tools::hdf5::ntuple::column_string::id_cls
virtual tools::cid id_cls() const
Definition: ntuple:660
tools::vec_data
const T * vec_data(const std::vector< T > &a_vec)
Definition: vdata:18
tools::hdf5::ntuple::column_ref::m_store
store & m_store
Definition: ntuple:191
tools::hdf5::ntuple::std_vector_column
Definition: ntuple:446
tools::hdf5::ntuple::column::get_entry
bool get_entry(T &a_v) const
Definition: ntuple:250
tools::hdf5::ntuple::std_vector_column_ref::m_branch
pages & m_branch
Definition: ntuple:349
tools::hdf5::ntuple::icol::cast
virtual void * cast(tools::cid) const =0
tools::hdf5::ntuple::column_string_ref::m_name
std::string m_name
Definition: ntuple:553
tools::hdf5::ntuple::std_vector_column_ref::id_cls
virtual tools::cid id_cls() const
Definition: ntuple:289
tools::hdf5::ntuple::column::fill
bool fill(const T &a_value)
Definition: ntuple:249
tools::hdf5::ntuple::column_ref::m_branch
pages & m_branch
Definition: ntuple:192
tools::hdf5::store
Definition: store:15
tools::hdf5::ntuple::column_string_ref::column_string_ref
column_string_ref(const column_string_ref &a_from)
Definition: ntuple:536
tools::hdf5::ntuple::columns
const std::vector< icol * > & columns() const
Definition: ntuple:981
tools::hdf5::ntuple::column::id_cls
virtual tools::cid id_cls() const
Definition: ntuple:221
tools::hdf5::ntuple::create_column
column< T > * create_column(const std::string &a_name, size_t a_basket_size)
Definition: ntuple:996
tools::hdf5::ntuple::column_ref::operator=
column_ref & operator=(const column_ref &a_from)
Definition: ntuple:181
tools::hdf5::pages::reset_pos
void reset_pos()
Definition: pages:102
vfind
tools::hdf5::ntuple::column_string_ref::cast
virtual void * cast(tools::cid a_class) const
Definition: ntuple:495
tools::hdf5::ntuple::std_vector_column::cast
virtual void * cast(tools::cid a_class) const
Definition: ntuple:456
tools::hdf5::ntuple::icol::fetch_entry
virtual bool fetch_entry()=0
tools::hdf5::ntuple::column_ref::m_want_new_basket_size
size_t m_want_new_basket_size
Definition: ntuple:200
tools::hdf5::ntuple::std_vector_column_ref::std_vector_column_ref
std_vector_column_ref(const std_vector_column_ref &a_from)
Definition: ntuple:334
tools::hdf5::ntuple::std_vector_column::~std_vector_column
virtual ~std_vector_column()
Definition: ntuple:465
tools::hdf5::ntuple::column_string_ref::m_ref
std::string & m_ref
Definition: ntuple:554
tools::hdf5::ntuple::std_vector_column::operator=
std_vector_column & operator=(const std_vector_column &a_from)
Definition: ntuple:471
tools::hdf5::ntuple::column_string_ref::set_basket_size
virtual bool set_basket_size(size_t)
Definition: ntuple:515
tools::hdf5::ntuple::column_string_ref::m_store
store & m_store
Definition: ntuple:550
tools::hdf5::ntuple::find_column_string
column_string * find_column_string(const std::string &a_name)
Definition: ntuple:1054
ntuple_binding
tools::hdf5::ntuple::std_vector_column_ref::cast
virtual void * cast(tools::cid a_class) const
Definition: ntuple:285
tools::hdf5::ntuple::std_vector_column::id_cls
virtual tools::cid id_cls() const
Definition: ntuple:460
tools::hdf5::ntuple::column_string_ref::operator=
column_string_ref & operator=(const column_string_ref &a_from)
Definition: ntuple:544
TOOLS_SCLASS
#define TOOLS_SCLASS(a_name)
Definition: S_STRING:41
tools::hdf5::ntuple::column_ref::m_basket_pos
size_t m_basket_pos
Definition: ntuple:197
tools::hdf5::ntuple::column::column
column(store &a_store, pages &a_pages, bool a_write, const std::string &a_name, size_t a_basket_size)
Definition: ntuple:223
tools::hdf5::store::out
std::ostream & out() const
Definition: store:154
mem
tools::hdf5::ntuple::create_column_ref
column_ref< T > * create_column_ref(const std::string &a_name, size_t a_basket_size, T &a_ref)
Definition: ntuple:985
tools::hdf5::ntuple::column_ref::add
virtual bool add()
Definition: ntuple:64
tools::hdf5::ntuple::icol::name
virtual const std::string & name() const =0
tools::uchar
unsigned char uchar
Definition: typedefs:99
tools::sout
Definition: sout:17
tools::hdf5::store::m_write
bool m_write
Definition: store:197
tools::hdf5::ntuple::std_vector_column_ref::add
virtual bool add()
Definition: ntuple:291
tools::hdf5::ntuple::column_ref::set_basket_size
virtual bool set_basket_size(size_t a_size)
Definition: ntuple:118
tools::hdf5::ntuple::icol::~icol
virtual ~icol()
Definition: ntuple:32
tools::hdf5::ntuple::column_string_ref::id_cls
virtual tools::cid id_cls() const
Definition: ntuple:499
tools::hdf5::ntuple::ntuple
ntuple(std::ostream &a_out, hid_t a_group, const std::string &a_name, const tools::ntuple_binding &a_bd)
Definition: ntuple:768
tools::hdf5::ntuple
Definition: ntuple:28
tools::hdf5::ntuple::column_ref::column_ref
column_ref(const column_ref &a_from)
Definition: ntuple:168
tools::hdf5::ntuple::operator=
ntuple & operator=(const ntuple &)
Definition: ntuple:883
tools::hdf5::ntuple::column::~column
virtual ~column()
Definition: ntuple:231
tools::hdf5::ntuple::column_string::operator=
column_string & operator=(const column_string &a_from)
Definition: ntuple:679
tools::hdf5::store::m_name
std::string m_name
Definition: store:196
tools::hdf5::ntuple::column_string
Definition: ntuple:646
tools_vforit
#define tools_vforit(a__T, a__v, a__it)
Definition: forit:13
tools::hdf5::ntuple::std_vector_column_ref::m_name
std::string m_name
Definition: ntuple:351
tools::hdf5::ntuple::column_string_ref::reset
virtual void reset()
Definition: ntuple:513
TOOLS_HDF5_NTUPLE_READ_CREATE_COL
#define TOOLS_HDF5_NTUPLE_READ_CREATE_COL(a__type)
tools::hdf5::ntuple::column_string::get_entry
bool get_entry(std::string &a_value) const
Definition: ntuple:686
tools::hdf5::ntuple::icol
Definition: ntuple:30
tools::hdf5::ntuple::m_cols
std::vector< icol * > m_cols
Definition: ntuple:1089
TOOLS_CLASS_STRING_VALUE
#define TOOLS_CLASS_STRING_VALUE(a_name, a_value)
Definition: S_STRING:17
tools::hdf5::ntuple::column_ref::m_name
std::string m_name
Definition: ntuple:194
tools::hdf5::ntuple::column_string_ref::m_write
bool m_write
Definition: ntuple:552
tools::ntuple_booking::columns
const std::vector< column_booking > & columns() const
Definition: ntuple_booking:93
tools::hdf5::store::store
store(std::ostream &a_out, hid_t a_group, const std::string &a_name, bool a_write, unsigned int a_compress)
Definition: store:19
tools::hdf5::ntuple::column_string::~column_string
virtual ~column_string()
Definition: ntuple:669
tools::hdf5::store::group
hid_t group() const
Definition: store:192
tools::hdf5::ntuple::column_string::cast
virtual void * cast(tools::cid a_class) const
Definition: ntuple:656
tools
inlined C code : ///////////////////////////////////
Definition: aida_ntuple:26
vmanip
tools::hdf5::ntuple::column::id_class
static tools::cid id_class()
Definition: ntuple:213
tools::hdf5::ntuple::column_string_ref::fetch_entry
virtual bool fetch_entry()
Definition: ntuple:505
tools::hdf5::ntuple::column
Definition: ntuple:204
vdata
tools::hdf5::ntuple::std_vector_column_ref::~std_vector_column_ref
virtual ~std_vector_column_ref()
Definition: ntuple:328
tools::hdf5::ntuple::column_ref::m_basket
T * m_basket
Definition: ntuple:199
tools::hdf5::ntuple::column_string_ref::name
virtual const std::string & name() const
Definition: ntuple:514
tools::hdf5::ntuple::column_ref::name
virtual const std::string & name() const
Definition: ntuple:117
TOOLS_HDF5_NTUPLE_CREATE_VEC_COL
#define TOOLS_HDF5_NTUPLE_CREATE_VEC_COL(a__type)
scast
tools::hdf5::ntuple::std_vector_column_ref
Definition: ntuple:276
tools::hdf5::ntuple::column_string::m_tmp
std::string m_tmp
Definition: ntuple:688
TOOLS_HDF5_NTUPLE_READ_CREATE_VEC_COL
#define TOOLS_HDF5_NTUPLE_READ_CREATE_VEC_COL(a__vec_type, a__type)
tools::hdf5::ntuple::std_vector_column_ref::operator=
std_vector_column_ref & operator=(const std_vector_column_ref &a_from)
Definition: ntuple:342
tools::hdf5::ntuple::ntuple
ntuple(std::ostream &a_out, hid_t a_group, const std::string &a_name)
Definition: ntuple:697
tools::hdf5::ntuple::title
const std::string & title() const
Definition: ntuple:979
tools::hdf5::ntuple::column_string_ref
Definition: ntuple:486
tools::hdf5::ntuple::set_basket_size
bool set_basket_size(size_t a_size)
Definition: ntuple:1078
tools::hdf5::ntuple::column::m_tmp
T m_tmp
Definition: ntuple:252
tools::hdf5::ntuple::column_ref
Definition: ntuple:46
tools::hdf5::ntuple::std_vector_column_ref::id_class
static tools::cid id_class()
Definition: ntuple:284
tools::hdf5::ntuple::column_ref::m_ref
T & m_ref
Definition: ntuple:195
forit
tools::hdf5::ntuple::column_ref::m_basket_size
size_t m_basket_size
Definition: ntuple:196
store
tools::hdf5::ntuple::std_vector_column_ref::name
virtual const std::string & name() const
Definition: ntuple:312
tools::hdf5::ntuple::column_string::id_class
static tools::cid id_class()
Definition: ntuple:652
tools::hdf5::ntuple::column_ref::reset
virtual void reset()
Definition: ntuple:116
stype
TOOLS_HDF5_NTUPLE_READ_BINDING_CREATE_COL
#define TOOLS_HDF5_NTUPLE_READ_BINDING_CREATE_COL(a__type)
tools::hdf5::ntuple::std_vector_column_ref::m_ref
std::vector< T > & m_ref
Definition: ntuple:352
tools_vforcit
#define tools_vforcit(a__T, a__v, a__it)
Definition: forit:7
tools::hdf5::ntuple::ntuple
ntuple(std::ostream &a_out, hid_t a_group, const std::string &a_name, unsigned int a_compress, size_t)
Definition: ntuple:692
tools::stype
const std::string & stype(const mat4f &)
Definition: mat4f:73
tools::hdf5::ntuple::std_vector_column_ref::std_vector_column_ref
std_vector_column_ref(store &a_store, pages &a_pages, bool a_write, const std::string &a_name, size_t, std::vector< T > &a_ref)
Definition: ntuple:315
tools::hdf5::ntuple::reset
void reset()
Definition: ntuple:1083
tools::hdf5::ntuple::std_vector_column::id_class
static tools::cid id_class()
Definition: ntuple:455
tools::ushort
unsigned short ushort
Definition: typedefs:101
tools::hdf5::ntuple::column_ref::m_write
bool m_write
Definition: ntuple:193
tools::uint32
unsigned int uint32
Definition: typedefs:71
tools::hdf5::pages::read_vlen
bool read_vlen(size_t &a_size, TYPE *&a_array)
Definition: pages:178
tools::hdf5::ntuple::column_ref::cast
virtual void * cast(tools::cid a_class) const
Definition: ntuple:58
tools::ntuple_booking
Definition: ntuple_booking:49
tools::hdf5::ntuple::create_std_column_ref
std_vector_column_ref< T > * create_std_column_ref(const std::string &a_name, size_t a_basket_size, std::vector< T > &a_ref)
Definition: ntuple:1017
tools::hdf5::pages::write_string
bool write_string(const std::string &a_string)
Definition: pages:193
tools::hdf5::pages::write_page
bool write_page(size_t a_size, const TYPE *a_array)
Definition: pages:105
tools::hdf5::pages::entries
tools::uint64 entries() const
Definition: pages:100
tools::hdf5::ntuple::create_column_string
column_string * create_column_string(const std::string &a_name, size_t a_basket_size)
Definition: ntuple:1006
TOOLS_HDF5_NTUPLE_CREATE_COL
#define TOOLS_HDF5_NTUPLE_CREATE_COL(a__type)
tools::hdf5::ntuple::icol::reset
virtual void reset()=0
tools::hdf5::ntuple::column_string_ref::add
virtual bool add()
Definition: ntuple:501
tools::hdf5::ntuple::column_string_ref::m_branch
pages & m_branch
Definition: ntuple:551
tools::hdf5::ntuple::add_row
bool add_row()
Definition: ntuple:1060
sout
tools::hdf5::ntuple::column_string_ref::column_string_ref
column_string_ref(store &a_store, pages &a_pages, bool a_write, const std::string &a_name, size_t, std::string &a_ref)
Definition: ntuple:517
tools::hdf5::ntuple::column::column
column(const column &a_from)
Definition: ntuple:237
tools::cid
unsigned short cid
Definition: cid:9
tools::hdf5::ntuple::std_vector_column_ref::reset
virtual void reset()
Definition: ntuple:311
tools::hdf5::ntuple::find_std_vector_column_ref
std_vector_column_ref< T > * find_std_vector_column_ref(const std::string &a_name)
Definition: ntuple:1042
tools::hdf5::ntuple::column_string_ref::id_class
static tools::cid id_class()
Definition: ntuple:491