本文整理汇总了C++中Invoker::Swizzle方法的典型用法代码示例。如果您正苦于以下问题:C++ Invoker::Swizzle方法的具体用法?C++ Invoker::Swizzle怎么用?C++ Invoker::Swizzle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Invoker
的用法示例。
在下文中一共展示了Invoker::Swizzle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Invoke
bool Host::Invoke(IPC::Message* msg)
{
#pragma TODO("Unpack the invoker and interface name from the message data")
const char* invokerName = NULL;
const char* interfaceName = NULL;
// find the interface
Interface* interface = GetInterface(interfaceName);
if (interface == NULL)
{
printf("RPC::Unable to find interface '%s'\n", interfaceName);
delete msg;
return true;
}
// find the invoker
Invoker* invoker = interface->GetInvoker(invokerName);
if (invoker == NULL)
{
printf("RPC::Unable to find invoker '%s' in interface '%s'\n", invokerName, interfaceName);
delete msg;
return true;
}
// get our frame from the top of the stack
Frame* frame = m_Stack.Top();
HELIUM_ASSERT(frame->m_Message == NULL);
frame->m_Message = msg;
// call the function
frame->m_MessageTaken = false;
invoker->Invoke(msg->GetData(), msg->GetSize());
HELIUM_ASSERT(frame->m_Message != NULL);
frame->m_Message = NULL;
Args* args = (Args*)msg->GetData();
if (args->m_Flags & RPC::Flags::NonBlocking)
{
if (!frame->m_MessageTaken)
{
delete msg;
}
return true; // async call, we are done
}
// our reply
IPC::Message* reply = NULL;
// if we have data, and a reference args or payload
if (msg->GetSize() > 0 && args->m_Flags & (RPC::Flags::ReplyWithArgs | RPC::Flags::ReplyWithPayload))
{
// total size of reply
uint32_t size = 0;
// size of args section
uint32_t argSize = invoker->GetArgsSize();
// size of payload section
uint32_t payload_size = msg->GetSize() - argSize;
// if we have a ref args
if (args->m_Flags & RPC::Flags::ReplyWithArgs)
{
// alloc for args block
size += argSize;
}
// if we have a ref payload
if (args->m_Flags & RPC::Flags::ReplyWithPayload)
{
// alloc for payload block
size += payload_size;
}
// create message
reply = Create(invoker, size, msg->GetTransaction());
// where to write
uint8_t* ptr = reply->GetData();
// if we have a ref args
if (args->m_Flags & RPC::Flags::ReplyWithArgs)
{
if (Swizzle())
{
invoker->Swizzle( msg->GetData() );
}
// write to ptr
memcpy(ptr, msg->GetData(), argSize);
// incr ptr by amount written
ptr += argSize;
}
// if we have a ref payload
//.........这里部分代码省略.........