src/cdi_ipcress/IpcressMultigroupOpacity.cc
std::vector<char> IpcressMultigroupOpacity::pack() const {
  using std::string;
  using std::vector;

  // pack up the energy policy descriptor
  vector<char> packed_descriptor;
  rtt_dsxx::pack_data(energyPolicyDescriptor, packed_descriptor);

  // pack up the ipcress file name
  vector<char> packed_filename;
  rtt_dsxx::pack_data(ipcressFilename, packed_filename);

  // determine the total size: 3 ints (reaction, model, material id) + 2 ints
  // for packed_filename size and packed_descriptor size + char in
  // packed_filename and packed_descriptor
  size_t size = 5 * sizeof(int) + packed_filename.size() + packed_descriptor.size();

  // make a container to hold packed data
  vector<char> packed(size);

  // make a packer and set it
  rtt_dsxx::Packer packer;
  packer.set_buffer(size, &packed[0]);

  // pack the descriptor
  packer << static_cast<int>(packed_descriptor.size());
  for (char &c : packed_descriptor)
    packer << c;

  // pack the filename (size and elements)
  packer << static_cast<int>(packed_filename.size());
  for (char &c : packed_filename)
    packer << c;

  // pack the material id
  packer << static_cast<int>(materialID);

  // pack the model and reaction
  packer << static_cast<int>(opacityModel) << static_cast<int>(opacityReaction);

  Ensure(packer.get_ptr() == &packed[0] + size);
  return packed;
}
//------------------------------------------------------------------------------------------------//
/*!
 * Pack the IpcressMultigroupOpacity state into a char string represented by a
 * vector<char>. This can be used for persistence, communication, etc. by
 * accessing the char * under the vector (required by implication by the
 * standard) with the syntax &char_string[0]. Note, it is unsafe to use
 * iterators because they are \b not required to be char *.
 */
Pack the IpcressMultigroupOpacity state into a char string represented by a
vector. This can be used for persistence, communication, etc. by
accessing the char * under the vector (required by implication by the
standard) with the syntax &char_string[0]. Note, it is unsafe to use
iterators because they are \b not required to be char *.
Pack the IpcressMultigroupOpacity state into a char string represented by a vector . This can be used for persistence communication etc . by accessing the char * under the vector ( required by implication by the standard ) with the syntax &char_string [ 0 ] . Note it is unsafe to use iterators because they are \ b not required to be char * .
std::vector<char> IpcressMultigroupOpacity::pack() const {
  using std::string;
  using std::vector;
  vector<char> packed_descriptor;
  rtt_dsxx::pack_data(energyPolicyDescriptor, packed_descriptor);
  vector<char> packed_filename;
  rtt_dsxx::pack_data(ipcressFilename, packed_filename);
  size_t size = 5 * sizeof(int) + packed_filename.size() + packed_descriptor.size();
  vector<char> packed(size);
  rtt_dsxx::Packer packer;
  packer.set_buffer(size, &packed[0]);
  packer << static_cast<int>(packed_descriptor.size());
  for (char &c : packed_descriptor)
    packer << c;
  packer << static_cast<int>(packed_filename.size());
  for (char &c : packed_filename)
    packer << c;
  packer << static_cast<int>(materialID);
  packer << static_cast<int>(opacityModel) << static_cast<int>(opacityReaction);
  Ensure(packer.get_ptr() == &packed[0] + size);
  return packed;
}
std :: vector < char > IpcressMultigroupOpacity :: pack ( ) const { using std :: string ; using std :: vector ; vector < char > packed_descriptor ; rtt_dsxx :: pack_data ( energyPolicyDescriptor , packed_descriptor ) ; vector < char > packed_filename ; rtt_dsxx :: pack_data ( ipcressFilename , packed_filename ) ; size_t size = 5 * sizeof ( int ) + packed_filename . size ( ) + packed_descriptor . size ( ) ; vector < char > packed ( size ) ; rtt_dsxx :: Packer packer ; packer . set_buffer ( size , & packed [ 0 ] ) ; packer << static_cast < int > ( packed_descriptor . size ( ) ) ; for ( char & c : packed_descriptor ) packer << c ; packer << static_cast < int > ( packed_filename . size ( ) ) ; for ( char & c : packed_filename ) packer << c ; packer << static_cast < int > ( materialID ) ; packer << static_cast < int > ( opacityModel ) << static_cast < int > ( opacityReaction ) ; Ensure ( packer . get_ptr ( ) == & packed [ 0 ] + size ) ; return packed ; }
Pack the IpcressMultigroupOpacity state into a char string represented by a
 vector<char>.
Pack the IpcressMultigroupOpacity state into a char string represented by a vector<char > .
// pack up the energy policy descriptor // pack up the ipcress file name // determine the total size: 3 ints (reaction, model, material id) + 2 ints // for packed_filename size and packed_descriptor size + char in // packed_filename and packed_descriptor // make a container to hold packed data // make a packer and set it // pack the descriptor // pack the filename (size and elements) // pack the material id // pack the model and reaction