Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/Geant4/tools/wroot/mpi_create_basket 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_mpi_create_basket
0005 #define tools_wroot_mpi_create_basket
0006 
0007 #include "basket"
0008 #include "../impi"
0009 
0010 namespace tools {
0011 namespace wroot {
0012 
0013 inline basket* mpi_create_basket(std::ostream& a_out,impi& a_mpi,bool a_byte_swap,seek a_seek_directory,uint32 a_basket_size) {
0014   std::string oname;
0015   if(!a_mpi.sunpack(oname)) return 0;
0016   std::string otitle;
0017   if(!a_mpi.sunpack(otitle)) return 0;
0018 
0019   uint32 last,nev_buf_size,nev;
0020   if(!a_mpi.unpack(last)) return 0;
0021   if(!a_mpi.unpack(nev_buf_size)) return 0;
0022   if(!a_mpi.unpack(nev)) return 0;
0023 
0024   int* entry_offset = 0;
0025  {bool not_null;
0026   if(!a_mpi.bunpack(not_null)) return 0;
0027   if(not_null) {
0028     uint32 n;
0029     if(!a_mpi.unpack(n,entry_offset)) return 0;
0030   }}
0031 
0032   int* displacement = 0;
0033  {bool not_null;
0034   if(!a_mpi.bunpack(not_null)) {delete [] entry_offset;return 0;}
0035   if(not_null) {
0036     uint32 n;
0037     if(!a_mpi.unpack(n,displacement)) {delete [] entry_offset;return 0;}
0038   }}
0039 
0040   uint32 _size;
0041   char* _buffer;
0042   if(!a_mpi.unpack(_size,_buffer)) {
0043     a_out << "unpack(buffer) failed."<< std::endl;
0044     delete [] entry_offset;
0045     delete [] displacement;
0046     return 0;
0047   }
0048 
0049   // wbasket fields set at file writing :
0050   //m_buf_size,m_buffer,m_nbytes,m_object_size,m_date,m_cycle,m_seek_key
0051 
0052   //::printf("debug :  col = %d, %s, %s, %lu\n",
0053   //    icol,rbasket.object_class().c_str(),rbasket.object_name().c_str(),rbasket.seek_key());
0054 
0055   basket* _basket = new basket(a_out,a_byte_swap,a_seek_directory,
0056                                oname,otitle,"TBasket",a_basket_size,
0057                                false/*verbose*/);
0058   _basket->datbuf().write_fast_array(_buffer,_size);
0059   _basket->set_nev(last,nev_buf_size,nev,entry_offset,displacement);
0060 
0061   delete [] entry_offset;
0062   delete [] displacement;
0063 
0064   delete [] _buffer;
0065 
0066   return _basket;
0067 }
0068 
0069 }}
0070 
0071 #endif