x
Yes
No
Do you want to visit DriveHQ English website?
首页
产品服务
价格
免费试用
下载客户端
关于我们
云文件服务
|
云备份服务
|
FTP服务
|
企业邮箱服务
|
网站托管
|
客户端软件
云文件服务
云备份服务
FTP服务
企业级邮箱服务
网站托管
客户端软件
RecordReplay.cpp - Hosted on DriveHQ Cloud IT Platform
返回上层目录
上传
下载
共享
发布
新建文件夹
新建文件
复制
剪切
删除
粘贴
评论
升级服务
路径: \\game3dprogramming\materials\GameFactory\GameFactoryDemo\GameFactory\RecordReplay.cpp
旋转
特效
属性
历史版本
#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
网页地址
文件地址
上一页
36/55
下一页
下载
( 2 KB )
Comments
Total ratings:
0
Average rating:
无评论
of 10
Would you like to comment?
Join now
, or
Logon
if you are already a member.