本文整理汇总了C++中CDatum::GetBinarySize方法的典型用法代码示例。如果您正苦于以下问题:C++ CDatum::GetBinarySize方法的具体用法?C++ CDatum::GetBinarySize怎么用?C++ CDatum::GetBinarySize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDatum
的用法示例。
在下文中一共展示了CDatum::GetBinarySize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MsgFileUpload
void CAeonEngine::MsgFileUpload (const SArchonMessage &Msg, const CHexeSecurityCtx *pSecurityCtx)
// MsgFileUpload
//
// Aeon.fileUpload {filePath} {fileUploadDesc} {data}
{
AEONERR error;
CMsgProcessCtx Ctx(*GetProcessCtx(), Msg, pSecurityCtx);
// Get the filePath
CString sError;
CString sTable;
CString sFilePath;
if (!CAeonTable::ParseFilePathForCreate(Msg.dPayload.GetElement(0), &sTable, &sFilePath, &sError))
{
SendMessageReplyError(MSG_ERROR_UNABLE_TO_COMPLY, strPattern(STR_ERROR_PARSING_FILE_PATH, sError), Msg);
return;
}
// Make sure we are allowed access to this table
if (!ValidateTableAccess(Msg, pSecurityCtx, sTable))
return;
// Get other parameters
CDatum dUploadDesc = Msg.dPayload.GetElement(1);
CDatum dData = Msg.dPayload.GetElement(2);
// Lock while we find or create a table
CSmartLock Lock(m_cs);
// If the table doesn't exist, then we create a new one inside the lock
CAeonTable *pTable;
if (!m_Tables.Find(sTable, &pTable))
{
// Compose a table descriptor
CDatum dTableDesc;
if (!CDatum::Deserialize(CDatum::formatAEONScript, CBuffer(strPattern(STR_FILE_TABLE_DESC_PATTERN, sTable)), &dTableDesc))
{
SendMessageReplyError(MSG_ERROR_UNABLE_TO_COMPLY, strPattern(STR_ERROR_INVALID_TABLE_NAME, sTable), Msg);
return;
}
// Create the table
if (!CreateTable(dTableDesc, &pTable, NULL, &sError))
{
SendMessageReplyError(MSG_ERROR_UNABLE_TO_COMPLY, sError, Msg);
return;
}
}
// Unlock
Lock.Unlock();
// Generate a unique session ID from the message
CString sSessionID = strPattern("%s/%x%s", Msg.sReplyAddr, Msg.dwTicket, sFilePath);
#ifdef DEBUG_FILE_UPLOAD
DWORD dwStart = ::sysGetTickCount();
Log(MSG_LOG_INFO, strPattern("Aeon.fileUpload %s [%d bytes]", sFilePath, dData.GetBinarySize()));
#endif
// Let the table handle the rest
int iComplete;
if (error = pTable->UploadFile(Ctx, sSessionID, sFilePath, dUploadDesc, dData, &iComplete, &sError))
{
if (error == AEONERR_OUT_OF_DATE)
SendMessageReplyError(MSG_ERROR_OUT_OF_DATE, sError, Msg);
else
SendMessageReplyError(MSG_ERROR_UNABLE_TO_COMPLY, sError, Msg);
return;
}
#ifdef DEBUG_FILE_UPLOAD
Log(MSG_LOG_INFO, strPattern("Aeon.fileUpload complete: %d seconds.", ::sysGetTicksElapsed(dwStart) / 1000));
#endif
// Reply
if (iComplete == 100)
SendMessageReply(MSG_OK, CDatum(), Msg);
else
{
CDatum dReceipt;
// LATER: Fill in receipt
SendMessageReply(MSG_AEON_FILE_UPLOAD_PROGRESS, dReceipt, Msg);
}
}