Geant4 Cross Reference |
1 // Copyright (C) 2010, Guy Barrand. All rights 2 // See the file tools.license for terms. 3 4 #ifndef tools_wroot_mpi_create_basket 5 #define tools_wroot_mpi_create_basket 6 7 #include "basket" 8 #include "../impi" 9 10 namespace tools { 11 namespace wroot { 12 13 inline basket* mpi_create_basket(std::ostream& 14 std::string oname; 15 if(!a_mpi.sunpack(oname)) return 0; 16 std::string otitle; 17 if(!a_mpi.sunpack(otitle)) return 0; 18 19 uint32 last,nev_buf_size,nev; 20 if(!a_mpi.unpack(last)) return 0; 21 if(!a_mpi.unpack(nev_buf_size)) return 0; 22 if(!a_mpi.unpack(nev)) return 0; 23 24 int* entry_offset = 0; 25 {bool not_null; 26 if(!a_mpi.bunpack(not_null)) return 0; 27 if(not_null) { 28 uint32 n; 29 if(!a_mpi.unpack(n,entry_offset)) return 0 30 }} 31 32 int* displacement = 0; 33 {bool not_null; 34 if(!a_mpi.bunpack(not_null)) {delete [] entr 35 if(not_null) { 36 uint32 n; 37 if(!a_mpi.unpack(n,displacement)) {delete 38 }} 39 40 uint32 _size; 41 char* _buffer; 42 if(!a_mpi.unpack(_size,_buffer)) { 43 a_out << "unpack(buffer) failed."<< std::e 44 delete [] entry_offset; 45 delete [] displacement; 46 return 0; 47 } 48 49 // wbasket fields set at file writing : 50 //m_buf_size,m_buffer,m_nbytes,m_object_size 51 52 //::printf("debug : col = %d, %s, %s, %lu\n 53 // icol,rbasket.object_class().c_str(),rb 54 55 basket* _basket = new basket(a_out,a_byte_sw 56 oname,otitle,"T 57 false/*verbose* 58 _basket->datbuf().write_fast_array(_buffer,_ 59 _basket->set_nev(last,nev_buf_size,nev,entry 60 61 delete [] entry_offset; 62 delete [] displacement; 63 64 delete [] _buffer; 65 66 return _basket; 67 } 68 69 }} 70 71 #endif