本文整理汇总了C++中CJob::Serialize方法的典型用法代码示例。如果您正苦于以下问题:C++ CJob::Serialize方法的具体用法?C++ CJob::Serialize怎么用?C++ CJob::Serialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CJob
的用法示例。
在下文中一共展示了CJob::Serialize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SendJobsToRemote
int CCommProxy::SendJobsToRemote(vector<CJob*> &vJobs)
{
CJob *pJob = NULL;
char *dataBuf = NULL;
int bufSize = 0;
vector<string> vSerializedJobs;
for(vector<CJob*>::iterator iter = vJobs.begin(); iter != vJobs.end(); ++iter)
{
pJob = *iter;
pJob->Serialize(&dataBuf,bufSize);
if(m_pConfig->compress)
{
vector<uint8_t> compress_out;
compress_buffer(dataBuf,bufSize,compress_out);
delete dataBuf; //delete original bufffer
dataBuf = (char *)&compress_out[0]; //address of the vec buffer
bufSize = compress_out.size(); //compressed size
string strData(dataBuf,bufSize);
vSerializedJobs.push_back(strData);
}
else
{
string strData(dataBuf,bufSize);
vSerializedJobs.push_back(strData);
delete dataBuf;
}
delete pJob;
}
pClient->SendJobsToRemote(vSerializedJobs.size(),vSerializedJobs);
return SUCCESS;
}
示例2: SendCompletedJobsToRemote
int CCommProxy::SendCompletedJobsToRemote(std::vector<CJob*> &vJobs)
{
CJob *pJob = NULL;
char *dataBuf = NULL;
int bufSize = 0;
vector<string> vSerializedJobs;
for(vector<CJob*>::iterator iter = vJobs.begin(); iter != vJobs.end(); ++iter)
{
pJob = *iter;
pJob->Serialize(&dataBuf,bufSize);
string strData(dataBuf,bufSize);
vSerializedJobs.push_back(strData);
delete dataBuf;
}
pClient->SendCompletedJobsToRemote(vSerializedJobs.size(),vSerializedJobs);
return SUCCESS;
}