本文整理汇总了C++中CError::getCode方法的典型用法代码示例。如果您正苦于以下问题:C++ CError::getCode方法的具体用法?C++ CError::getCode怎么用?C++ CError::getCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CError
的用法示例。
在下文中一共展示了CError::getCode方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addProfile
void CProfileRepoServerClb::addProfile(const RepoRequest * req, UInt32 payloadSize, UInt8* const pResponseBuffer, UInt32& bufferSize)
{
LOG4CPLUS_TRACE_METHOD(msLogger, __PRETTY_FUNCTION__ );
CError err = mProfileDB.addProfile(bufferToString(req->data));
UInt32 code = err.getCode();
memcpy (pResponseBuffer, &code,4);
bufferSize = 4;
}
示例2: removeProfileImplementationPl
void CProfileRepoServerClb::removeProfileImplementationPl(const RepoRequest * req, UInt32 payloadSize, UInt8* const pResponseBuffer, UInt32& bufferSize)
{
LOG4CPLUS_TRACE_METHOD(msLogger, __PRETTY_FUNCTION__ );
UID uid(bufferToString(req->data));
int pos = stringInBufSize(uid.value);
std::string platform = bufferToString(req->data + pos);
CError err = mProfileDB.removeProfileImplementation(uid,platform);
UInt32 code = err.getCode();
memcpy (pResponseBuffer, &code, 4);
bufferSize = 4;
}
示例3: addProfileImplementation
void CProfileRepoServerClb::addProfileImplementation(const RepoRequest * req, UInt32 payloadSize, UInt8* const pResponseBuffer, UInt32& bufferSize)
{
LOG4CPLUS_TRACE_METHOD(msLogger, __PRETTY_FUNCTION__ );
UID uid(bufferToString(req->data));
int pos = stringInBufSize(uid.value);
iviLink::LibDescriptor ld;
ld.libPath = bufferToString(req->data + pos);
pos += stringInBufSize(ld.libPath);
ld.platform = bufferToString(req->data + pos);
CError err = mProfileDB.addProfileImplementation(uid,ld);
UInt32 code = err.getCode();
memcpy (pResponseBuffer, &code, 4);
bufferSize = 4;
}
示例4: ProcessIPCClientMessage
void NegotiatorIPCHandler::ProcessIPCClientMessage(std::string message, std::string &response)
{
LOG4CPLUS_TRACE_METHOD(msLogger, __PRETTY_FUNCTION__);
ChannelSupervisor::Messages::Message * msg = NULL;
CError err = CSError(CSError::ERROR_OTHER);
LOG4CPLUS_TRACE(msLogger,
"NegotiatorIPCHandler::ProcessIPCClientMessage() message = \n" + message);
pugi::xml_document* doc = new pugi::xml_document();
ParseResponse(doc, (Int8*) message.c_str());
if (Notification::NOTIFICATIONTTYPE_ALLOCATE == Notification::GetNotificationType(doc))
{
LOG4CPLUS_INFO(msLogger, "NegotiatorIPCHandler::ProcessIPCClientMessage()==>ALLOCATE=====");
AllocateChannelRequest * request = new AllocateChannelRequest(doc);
std::string tag = request->GetTag();
UInt32 channel = request->GetChannelID();
delete request;
err = NegotiateChannel(tag, channel);
LOG4CPLUS_INFO(msLogger,
"NegotiatorIPCHandler::ProcessIPCClientMessage()==>IDLE====="
+ convertIntegerToString(channel));
msg = new AllocateChannelResponse(tag.c_str(), channel);
if (!err.isNoError())
{
// TODO correctly set other types of errors
if (err.getCode() == CSError::NEGOTIATION_CHANNEL_TIMEOUT)
{
((AllocateChannelResponse*) msg)->SetError(ERRORCODE_TIMEOUT_OCCURRED, "timeout");
} else
{
((AllocateChannelResponse*) msg)->SetError(ERRORCODE_OTHER, "other error");
}
}
} else if (Notification::NOTIFICATIONTTYPE_DEALLOCATE == Notification::GetNotificationType(doc))
{
LOG4CPLUS_INFO(msLogger,
"NegotiatorIPCHandler::ProcessIPCClientMessage()==>DEALLOCATE=====");
DeallocateChannelRequest * request = new DeallocateChannelRequest(doc);
UInt32 channel = request->GetChannelId();
delete request;
err = ChannelDeallocated(channel);
msg = new DeallocateChannelResponse(channel);
if (!err.isNoError())
{
// TODO correctly set other types of errors
if (err.getCode() == CSError::DEALLOCATION_CHANNEL_MAP_WRONG_CID)
((DeallocateChannelResponse*) msg)->SetError(ERRORCODE_WRONG_CHANNELID,
"wrong cid");
else if (err.getCode() == CSError::DEALLOCATION_CHANNEL_MAP_TIMEOUT)
((DeallocateChannelResponse*) msg)->SetError(ERRORCODE_TIMEOUT_OCCURRED, "timeout");
else
((DeallocateChannelResponse*) msg)->SetError(ERRORCODE_OTHER, "other error");
}
} else if (Request::REQUESTTYPE_CA_ALLOCATION_DONE == Request::GetRequestType(doc))
{
LOG4CPLUS_INFO(msLogger,
"NegotiatorIPCHandler::ProcessIPCClientMessage()==>CA_ALLOCATION_DONE=====");
CAAllocateDoneRequest * request = new CAAllocateDoneRequest(doc);
std::string tag = request->GetTag();
UInt32 channel = request->GetChannelId();
delete request;
err = UpdateMap(tag, channel);
msg = new CAAllocateDoneResponse(tag.c_str(), channel);
if (!err.isNoError())
{
// TODO correctly set other types of errors
if (err.getCode() == CSError::UPDATE_MAP_TIMEOUT)
{
((CAAllocateDoneResponse*) msg)->SetError(ERRORCODE_TIMEOUT_OCCURRED, "timeout");
} else
{
((CAAllocateDoneResponse*) msg)->SetError(ERRORCODE_OTHER, "other error");
}
}
} else //error here
{
LOG4CPLUS_ERROR(msLogger,
"NegotiatorIPCHandler::ProcessIPCClientMessage()==> UNKNOWN REQUEST");
msg = new CommandRejectResponse("");
}
std::stringstream messageToBeSent;
msg->Write(messageToBeSent);
response = messageToBeSent.str();
if (msg)
delete msg;
msg = NULL;
}
示例5: ProcessIPCClientMessage
void NegotiatorIPCHandler::ProcessIPCClientMessage(std::string message, std::string &response)
{
LOG4CPLUS_TRACE_METHOD(msLogger, "NegotiatorIPCHandler::ProcessIPCClientMessage()==>START=====");
Message * msg = NULL;
CError err = CSError(CSError::ERROR_OTHER);
LOG4CPLUS_TRACE(msLogger, "NegotiatorIPCHandler::ProcessIPCClientMessage() message = \n" + message);
pugi::xml_document* doc = new pugi::xml_document();
ParseResponse(doc, (Int8*) message.c_str());
if (m_state == IDLE) //process allocate and deallocate
{
LOG4CPLUS_TRACE(msLogger, "NegotiatorIPCHandler::ProcessIPCClientMessage()==>IDLE=====");
if (Notification::NOTIFICATIONTTYPE_ALLOCATE == Notification::GetNotificationType(doc))
{
LOG4CPLUS_TRACE(msLogger, "NegotiatorIPCHandler::ProcessIPCClientMessage()==>ALLOCATE=====");
AllocateChannelRequest * request = new AllocateChannelRequest(doc);
std::string tag = request->GetTag();
UInt32 channel = 0;
err = NegotiateChannel(tag, channel);
LOG4CPLUS_TRACE(msLogger, "NegotiatorIPCHandler::ProcessIPCClientMessage()==>IDLE=====" + convertIntegerToString(channel));
msg = new AllocateChannelResponse(tag.c_str(), channel);
if (!err.isNoError())
{
if (err.getCode() == CSError::UPDATE_MAP_WRONG_CID)
((AllocateChannelResponse*) msg)->SetError(ERRORCODE_WRONG_CHANNELID, "wrong cid");
else if (err.getCode() == CSError::UPDATE_MAP_TIMEOUT)
((AllocateChannelResponse*) msg)->SetError(ERRORCODE_TIMEOUT_OCCURRED, "timeout");
else
((AllocateChannelResponse*) msg)->SetError(ERRORCODE_OTHER, "other error");
}
if (request)
{
delete request;
}
request = 0;
m_state = NEGOTIATED;
}
else if (Notification::NOTIFICATIONTTYPE_DEALLOCATE == Notification::GetNotificationType(doc))
{
LOG4CPLUS_TRACE(msLogger, "NegotiatorIPCHandler::ProcessIPCClientMessage()==>DEALLOCATE=====");
DeallocateChannelRequest * request = new DeallocateChannelRequest(doc);
std::string tag = request->GetTag();
UInt32 channel = request->GetChannelId();
err = ChannelDeallocated(tag, channel);
msg = new DeallocateChannelResponse(tag.c_str(), channel);
if (!err.isNoError())
{
if (err.getCode() == CSError::DEALLOCATION_CHANNEL_MAP_WRONG_CID)
((DeallocateChannelResponse*) msg)->SetError(ERRORCODE_WRONG_CHANNELID, "wrong cid");
else if (err.getCode() == CSError::DEALLOCATION_CHANNEL_MAP_TIMEOUT)
((DeallocateChannelResponse*) msg)->SetError(ERRORCODE_TIMEOUT_OCCURRED, "timeout");
else
((DeallocateChannelResponse*) msg)->SetError(ERRORCODE_OTHER, "other error");
}
if (request)
delete request;
request = 0;
m_state = IDLE;
}
else
{
msg = new CommandRejectResponse("");
}
}
else if (m_state == NEGOTIATED) //process update map only
{
LOG4CPLUS_TRACE(msLogger, "NegotiatorIPCHandler::ProcessIPCClientMessage()==>CA_ALLOCATION_DONE=====");
if (Request::REQUESTTYPE_CA_ALLOCATION_DONE == Request::GetRequestType(doc))
{
CAAllocateDoneRequest * request = new CAAllocateDoneRequest(doc);
std::string tag = request->GetTag();
UInt32 channel = request->GetChannelId();
err = UpdateMap(tag, channel);
msg = new CAAllocateDoneResponse(tag.c_str(), channel);
if (!err.isNoError())
{
if (err.getCode() == CSError::UPDATE_MAP_WRONG_CID)
((CAAllocateDoneResponse*) msg)->SetError(ERRORCODE_WRONG_CHANNELID, "wrong cid");
else if (err.getCode() == CSError::UPDATE_MAP_TIMEOUT)
((CAAllocateDoneResponse*) msg)->SetError(ERRORCODE_TIMEOUT_OCCURRED, "timeout");
else
((CAAllocateDoneResponse*) msg)->SetError(ERRORCODE_OTHER, "other error");
}
if (request)
{
delete request;
}
request = 0;
//.........这里部分代码省略.........