Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/Geant4/tools/wroot/mt_basket_add is written in an unsupported language. File is not indexed.

0001 // Copyright (C) 2010, Guy Barrand. All rights reserved.
0002 // See the file tools.license for terms.
0003 
0004 #ifndef tools_wroot_mt_basket_add
0005 #define tools_wroot_mt_basket_add
0006 
0007 // used in pntuple.
0008 
0009 #include "branch"
0010 
0011 namespace tools {
0012 namespace wroot {
0013 
0014 class mt_basket_add : public virtual branch::iadd_basket {
0015   typedef branch::iadd_basket parent;
0016 public:
0017   virtual bool add_basket(basket* a_basket) { //we take ownership of a_basket.
0018     m_mutex.lock();
0019     uint32 add_bytes,nout;
0020     if(!m_main_branch.add_basket(m_main_file,*a_basket,add_bytes,nout)) {
0021       m_mutex.unlock();
0022       delete a_basket;
0023       return false;
0024     }
0025     m_main_branch.set_tot_bytes(m_main_branch.tot_bytes()+add_bytes);
0026     m_main_branch.set_zip_bytes(m_main_branch.zip_bytes()+nout);
0027     m_mutex.unlock();
0028     delete a_basket;
0029     return true;
0030   }
0031 public:
0032   mt_basket_add(imutex& a_mutex,ifile& a_main_file,branch& a_main_branch)
0033   :m_mutex(a_mutex),m_main_file(a_main_file),m_main_branch(a_main_branch)
0034   {}
0035 protected:
0036   mt_basket_add(const mt_basket_add& a_from):parent()
0037   ,m_mutex(a_from.m_mutex),m_main_file(a_from.m_main_file),m_main_branch(a_from.m_main_branch)
0038   {}
0039   mt_basket_add& operator=(const mt_basket_add&){return *this;}
0040 protected:
0041   imutex& m_mutex;
0042   ifile& m_main_file;
0043   branch& m_main_branch;
0044 };
0045 
0046 }}
0047 
0048 #endif