本文整理汇总了C++中BaseError::getCode方法的典型用法代码示例。如果您正苦于以下问题:C++ BaseError::getCode方法的具体用法?C++ BaseError::getCode怎么用?C++ BaseError::getCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseError
的用法示例。
在下文中一共展示了BaseError::getCode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sendKill
void IpcServer::sendKill(iviLink::Ipc::DirectionID * pDirID)
{
LOG4CPLUS_TRACE_METHOD(mLogger, __PRETTY_FUNCTION__);
std::string dieRequest(DIE_REQUEST);
UInt8 * writeBuf = new UInt8(dieRequest.size());
memcpy(writeBuf, dieRequest.c_str(), dieRequest.size());
UInt8 * readBuf = new UInt8(1);
UInt32 respSize = 1;
timeval begin, end;
double requestTime;
gettimeofday(&begin, NULL);
BaseError err = mIpc->request(mMsgIdGen.getNext(), writeBuf, dieRequest.size(), readBuf, respSize, pDirID);
assert (!err.isNoError());
LOG4CPLUS_INFO(mLogger, "Request returned an error as expected");
assert (err.getCode() == CIpcError::ERROR_CONNECTION_LOST);
LOG4CPLUS_INFO(mLogger, "Request returned an error and the error code is as expected");
gettimeofday(&end, NULL);
requestTime = (end.tv_sec - begin.tv_sec) * 1000.0; // sec to ms
requestTime += (end.tv_usec - begin.tv_usec) / 1000.0; // us to ms
std::ostringstream s;
s << "(" << requestTime << ") ms";
LOG4CPLUS_INFO(mLogger, "Time elapsed requesting: " + s.str());
assert (requestTime < 100);
LOG4CPLUS_INFO(mLogger, "Request's time is within the expected limits");
delete writeBuf;
delete readBuf;
}