Exemple #1
0
    void PyRemoteInfo::pack( PackedData& pd ) const
    {
      //int debug_wait =1 ;
      //while(debug_wait);
      pd.add( fPickledData );
#ifdef DEBUG
      Logger::debug3() << "PyRemoteInfo: Packed Pickled data  is "
		       << fPickledData << endl;
#endif

      
    }
Exemple #2
0
// automatic packing, does simple data correctly, need not be overloaded for simple cases
void Info::pack(PackedData& dp) const
{
    // get the size of the structure (w/o VMT):
    unsigned infoSize = getInfoHandler().getByteSize() - sizeof(Info);
    Logger::debug3() << "Info: automatic packing of " << getInfoHandler().getClassType() << " with size=" << infoSize << std::endl;
    SMART_ASSERT( infoSize>=0 );

    // cast the object as a char array and skip the VMT stuff (everythig in Info):
    const char* data = reinterpret_cast<const char*>(this) + sizeof(Info);	// cast it as a char array

    // and now put it into dp:
    dp.add( infoSize );
    dp.add_array(infoSize, data);
}
Exemple #3
0
    void PyInfo::pack( PackedData& pd ) const
    {
#ifdef SIMX_USE_PRIME
      SMART_ASSERT(false)
	("PyInfo::pack() method must never get called when using SSF. Only PyRemoteInfo may be used");
#else
      //cout << "inside pack" << endl;
      //std::ostringstream os;
      // save data to archive
      //boost::archive::text_oarchive oa(os);
      // write class instance to archive
      //      assert(false);
      //oa << fData;
      //fData.serialize(oa,1);)
      //assert(false);
      // archive and stream closed when destructors are called
      //boost::python::str py_string = boost::python::pickle::dumps(fData);

      // python::object pickler = python::import("cPickle");
      // python::str ps = python::extract<python::str>
      // 	(pickler.attr("dumps")(fData));

      // python::str ps = //python::extract<python::str>
      //	extract<str>( theInfoManager().getPacker()(fData) );
      //string s = python::extract<string>(ps);
      //pd.add(s);
  
      //pd.addAnything(fData);
      //boost::python::str ps = dumps(fData);
      //pd.add(ps);
      //PyGILState_STATE gstate;
      //gstate = PyGILState_Ensure();
      //Py_INCREF(fData.ptr());
      //assert(fData.ptr());
     
      pd.add( 
	     //python::extract<python::str>
	     //(theInfoManager().getPacker()(*fData)));
	     python::extract<string>
	     (theInfoManager().getPacker()(getData())));
      //pd.add( fPickledData );

      //pd.add(theInfoManager().getPacker()(fData));
      //PyGILState_Release(gstate);
      
      //pd.add( theInfoManager().getPacker()(fData) );
#endif
    }
Exemple #4
0
void EventInfo::pack(PackedData& dp) const
{
    dp.add(fDestEntity);
    dp.add( static_cast<int>(fDestService) );
    dp.add(fDelay);
    dp.add(fTime);
    
    if( fInfo )
    {
	dp.add( fInfo->getInfoHandler().getClassType() );
	fInfo->pack( dp );
    } else
    {
	dp.add( Info::ClassType() );
	Logger::error() << "EventInfo: no Info to pack in " << *this << endl;
    }
}