x
Yes
No
Do you want to visit DriveHQ English website?
Inicio
Características
Precios
Prueba gratuita
Software cliente
Acerca de nosotros
Servidor de archivos
|
Solución de copias de seguridad
|
Servidor FTP
|
Servidor de correo electrónico
|
Alojamiento web
|
Software cliente
Servidor de archivos
Solución de copia de seguridad
Servidor FTP
Servidor de correo electrónico
Alojamiento web
Software cliente
RecordReplay.cpp - Hosted on DriveHQ Cloud IT Platform
Arriba
Subir
Descargar
Compartir
Publicar
Nueva carpeta
Nuevo archivo
Copiar
Cortar
Eliminar
Pegar
Clasificación
Actualizar
Ruta de la carpeta: \\game3dprogramming\materials\GameFactory\GameFactoryDemo\GameFactory\RecordReplay.cpp
Girar
Efecto
Propiedad
Historial
#include "RecordReplay.h" #include "boost/serialization/serialization.hpp" RandomGenerator* RandomGenerator::theSingleton = NULL; RecordReplay* RecordReplay::theSingleton = NULL; RecordReplay::RecordReplay():mCurrentMode(mode::RECORDING),mFileName("serialize.txt"),mNumberOfData(0){ myassert(theSingleton==NULL); theSingleton = this; if (mCurrentMode == mode::RECORDING){ mRecordStream = new std::ofstream(mFileName.c_str(),ios_base::out | ios_base::binary | ios_base::trunc); mRecordArchive = new boost::archive::binary_oarchive(*mRecordStream); }else if (mCurrentMode == mode::REPLAYING){ FILE* fTemp = fopen("serial_n.txt","r"); fscanf(fTemp,"%d",&mNumberOfData); fclose(fTemp); mReplayStream = new std::ifstream(mFileName.c_str(),ios_base::in | ios_base::binary); mReplayArchive = new boost::archive::binary_iarchive(*mReplayStream); //std::ifstream xxx(mFileName.c_str(),ios_base::in | ios_base::binary); //mReplayArchive = new boost::archive::binary_iarchive(xxx); } RandomGenerator* theGenerator = new RandomGenerator(); } RecordReplay::~RecordReplay(){ if (mCurrentMode == mode::RECORDING){ mRecordStream->flush(); mRecordStream->close(); SAFE_DELETE(mRecordArchive); SAFE_DELETE(mRecordStream); FILE* fTemp = fopen("serial_n.txt","w"); fprintf(fTemp,"%d",mNumberOfData); fclose(fTemp); }else if (mCurrentMode == mode::REPLAYING){ mReplayStream->close(); SAFE_DELETE(mReplayArchive); SAFE_DELETE(mReplayStream); } theSingleton = NULL; } //template
//void RecordReplay::push(paramType1 param1){ // //do nothing for now // (*mRecordArchive) << param1; //} //template
//returnType RecordReplay::pop(){ // //do nothing for now // returnType val; // (*mReplayArchive) >> val; // return val; //} //template
//returnType RecordReplay::funcWrapper(instanceType inst, funcType func,paramType1 param1){ // if (mRecordMode){ // returnType val = (inst->*func)(param1); // push(val); // return val; // }else{//replay // returnType val = pop
(); // return val; // } //}; //template
//returnType RecordReplay::funcWrapper(funcType func){ // if (mRecordMode){ // returnType val = func(); // push(val); // return val; // }else{//replay // returnType val = pop
(); // return val; // } //} //template
//returnType GameFactory::RecordReplay::funcWrapper(returnType param1){ // if (mRecordMode){ // push(param1); // return param1; // }else{ // returnType val = pop
(); // return val; // } //}
RecordReplay.cpp
Dirección de la página
Dirección del archivo
Anterior
36/55
Siguiente
Descargar
( 2 KB )
Comments
Total ratings:
0
Average rating:
No clasificado
of 10
Would you like to comment?
Join now
, or
Logon
if you are already a member.