src/cdi_analytic/Analytic_EICoupling.cc
//------------------------------------------------------------------------------------------------//
/*!
 * \brief Unpacking constructor.
 *
 * This constructor rebuilds and Analytic_EICoupling from a vector<char> that
 * was created by a call to pack().  It can only rebuild Analytic_Model types
 * that have been registered in the rtt_cdi_analytic::EICoupling_Models
 * enumeration.
 */
\brief Unpacking constructor.
This constructor rebuilds and Analytic_EICoupling from a vector that
was created by a call to pack().  It can only rebuild Analytic_Model types
that have been registered in the rtt_cdi_analytic::EICoupling_Models
enumeration.
\ brief Unpacking constructor . This constructor rebuilds and Analytic_EICoupling from a vector that was created by a call to pack () . It can only rebuild Analytic_Model types that have been registered in the rtt_cdi_analytic :: EICoupling_Models enumeration .
Analytic_EICoupling::Analytic_EICoupling(const sf_char &packed) : analytic_model() {
  Require(packed.size() >= 2 * sizeof(int));
  rtt_dsxx::Unpacker unpacker;
  unpacker.set_buffer(packed.size(), &packed[0]);
  int size_analytic;
  unpacker >> size_analytic;
  Check(static_cast<size_t>(size_analytic) >= sizeof(int));
  std::vector<char> packed_analytic(size_analytic);
  for (size_t i = 0; i < static_cast<size_t>(size_analytic); ++i)
    unpacker >> packed_analytic[i];
  Check(unpacker.get_ptr() == &packed[0] + packed.size());
  unpacker.set_buffer(size_analytic, &packed_analytic[0]);
  int indicator;
  unpacker >> indicator;
  if (indicator == CONSTANT_ANALYTIC_EICOUPLING_MODEL) {
    analytic_model = std::make_shared<Constant_Analytic_EICoupling_Model>(packed_analytic);
  } else {
    Insist(0, "Unregistered analytic EICoupling model!");
  }
  Ensure(analytic_model);
}
Analytic_EICoupling :: Analytic_EICoupling ( const sf_char & packed ) : analytic_model ( ) { Require ( packed . size ( ) >= 2 * sizeof ( int ) ) ; rtt_dsxx :: Unpacker unpacker ; unpacker . set_buffer ( packed . size ( ) , & packed [ 0 ] ) ; int size_analytic ; unpacker >> size_analytic ; Check ( static_cast < size_t > ( size_analytic ) >= sizeof ( int ) ) ; std :: vector < char > packed_analytic ( size_analytic ) ; for ( size_t i = 0 ; i < static_cast < size_t > ( size_analytic ) ; ++ i ) unpacker >> packed_analytic [ i ] ; Check ( unpacker . get_ptr ( ) == & packed [ 0 ] + packed . size ( ) ) ; unpacker . set_buffer ( size_analytic , & packed_analytic [ 0 ] ) ; int indicator ; unpacker >> indicator ; if ( indicator == CONSTANT_ANALYTIC_EICOUPLING_MODEL ) { analytic_model = std :: make_shared < Constant_Analytic_EICoupling_Model > ( packed_analytic ) ; } else { Insist ( 0 , " " ) ; } Ensure ( analytic_model ) ; }
\brief Unpacking constructor.
\ brief Unpacking constructor .
// the packed size must be at least 2 integers (size, // analytic model indicator) // make an unpacker // set the buffer // unpack the size of the analytic model // unpack the packed analytic model // now reset the buffer so that we can determine the analytic model // indicator // unpack the indicator // now determine which analytic model we need to build