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.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

  1 // Copyright (C) 2010, Guy Barrand. All rights reserved.
  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& a_out,impi& a_mpi,bool a_byte_swap,seek a_seek_directory,uint32 a_basket_size) {
 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 [] entry_offset;return 0;}
 35   if(not_null) {
 36     uint32 n;
 37     if(!a_mpi.unpack(n,displacement)) {delete [] entry_offset;return 0;}
 38   }}
 39 
 40   uint32 _size;
 41   char* _buffer;
 42   if(!a_mpi.unpack(_size,_buffer)) {
 43     a_out << "unpack(buffer) failed."<< std::endl;
 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,m_date,m_cycle,m_seek_key
 51 
 52   //::printf("debug :  col = %d, %s, %s, %lu\n",
 53   //    icol,rbasket.object_class().c_str(),rbasket.object_name().c_str(),rbasket.seek_key());
 54 
 55   basket* _basket = new basket(a_out,a_byte_swap,a_seek_directory,
 56                                oname,otitle,"TBasket",a_basket_size,
 57                                false/*verbose*/);
 58   _basket->datbuf().write_fast_array(_buffer,_size);
 59   _basket->set_nev(last,nev_buf_size,nev,entry_offset,displacement);
 60 
 61   delete [] entry_offset;
 62   delete [] displacement;
 63 
 64   delete [] _buffer;
 65 
 66   return _basket;
 67 }
 68 
 69 }}
 70 
 71 #endif