g4tools  5.4.0
mt_basket_add
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_wroot_mt_basket_add
5 #define tools_wroot_mt_basket_add
6 
7 // used in pntuple.
8 
9 #include "branch"
10 
11 namespace tools {
12 namespace wroot {
13 
14 class mt_basket_add : public virtual branch::iadd_basket {
16 public:
17  virtual bool add_basket(basket* a_basket) { //we take ownership of a_basket.
18  m_mutex.lock();
19  uint32 add_bytes,nout;
20  if(!m_main_branch.add_basket(m_main_file,*a_basket,add_bytes,nout)) {
21  m_mutex.unlock();
22  delete a_basket;
23  return false;
24  }
27  m_mutex.unlock();
28  delete a_basket;
29  return true;
30  }
31 public:
32  mt_basket_add(imutex& a_mutex,ifile& a_main_file,branch& a_main_branch)
33  :m_mutex(a_mutex),m_main_file(a_main_file),m_main_branch(a_main_branch)
34  {}
35 protected:
38  {}
39  mt_basket_add& operator=(const mt_basket_add&){return *this;}
40 protected:
44 };
45 
46 }}
47 
48 #endif
tools::wroot::branch::tot_bytes
uint64 tot_bytes() const
Definition: branch:187
tools::wroot::branch::zip_bytes
uint64 zip_bytes() const
Definition: branch:190
tools::wroot::ifile
Definition: ifile:18
tools::wroot::mt_basket_add::add_basket
virtual bool add_basket(basket *a_basket)
Definition: mt_basket_add:17
tools::wroot::imutex
Definition: imutex:10
tools::wroot::branch
Definition: branch:16
tools::wroot::mt_basket_add
Definition: mt_basket_add:14
tools::wroot::mt_basket_add::m_main_file
ifile & m_main_file
Definition: mt_basket_add:42
tools::wroot::mt_basket_add::m_main_branch
branch & m_main_branch
Definition: mt_basket_add:43
tools::wroot::mt_basket_add::mt_basket_add
mt_basket_add(imutex &a_mutex, ifile &a_main_file, branch &a_main_branch)
Definition: mt_basket_add:32
tools::wroot::mt_basket_add::mt_basket_add
mt_basket_add(const mt_basket_add &a_from)
Definition: mt_basket_add:36
tools::wroot::mt_basket_add::m_mutex
imutex & m_mutex
Definition: mt_basket_add:41
branch
tools::wroot::branch::iadd_basket
Definition: branch:409
tools
inlined C code : ///////////////////////////////////
Definition: aida_ntuple:26
tools::wroot::imutex::unlock
virtual bool unlock()=0
tools::wroot::basket
Definition: basket:14
tools::wroot::branch::add_basket
bool add_basket(ifile &a_file, basket &a_basket, uint32 &a_add_bytes, uint32 &a_nout)
for parallelization : /////////////////////////////////////////////////
Definition: branch:364
tools::wroot::mt_basket_add::operator=
mt_basket_add & operator=(const mt_basket_add &)
Definition: mt_basket_add:39
tools::wroot::branch::set_zip_bytes
void set_zip_bytes(uint64 a_value)
Definition: branch:191
tools::wroot::branch::set_tot_bytes
void set_tot_bytes(uint64 a_value)
Definition: branch:188
tools::uint32
unsigned int uint32
Definition: typedefs:71
tools::wroot::imutex::lock
virtual bool lock()=0