当前位置: 首页>>代码示例>>C++>>正文


C++ CDatum::GetBinarySize方法代码示例

本文整理汇总了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);
		}
	}
开发者ID:gmoromisato,项目名称:Hexarc,代码行数:100,代码来源:CAeonEngine.cpp


注:本文中的CDatum::GetBinarySize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。