#include "stdafx.h" #include "CJobDataB.h" namespace SERVO { CJobDataB::CJobDataB() { } CJobDataB::~CJobDataB() { } int CJobDataB::serialize(char* pszBuffer, int nBufferSize) { int index = 0; memcpy(&pszBuffer[index], &m_nPortNo, sizeof(short)); index += sizeof(short); int strLen = min(20, m_strCarrierId.size()); memcpy(&pszBuffer[index], m_strCarrierId.c_str(), strLen); index += strLen; strLen = min(20, m_pruductId.size()); memcpy(&pszBuffer[index], m_pruductId.c_str(), strLen); index += strLen; memcpy(&pszBuffer[index], &m_nCarrierState, sizeof(short)); index += sizeof(short); memcpy(&pszBuffer[index], &m_nSlotMapping, sizeof(int)); index += sizeof(int); memcpy(&pszBuffer[index], &m_nSlotSelectedFlag, sizeof(int)); index += sizeof(int); for (int i = 0; i < min(25, m_glassIds.size()); i++) { std::string& strGlassId = m_glassIds.at(i); strLen = min(20, strGlassId.size()); memcpy(&pszBuffer[index], strGlassId.c_str(), strLen); index += strLen; } return 320 * 2; } }