本文整理汇总了C++中Observer::Call方法的典型用法代码示例。如果您正苦于以下问题:C++ Observer::Call方法的具体用法?C++ Observer::Call怎么用?C++ Observer::Call使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Observer
的用法示例。
在下文中一共展示了Observer::Call方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: locker
void RPC1::OnReceive(ReceivePayload *pPayload, ListenerReceiveResult *lrrOut)
{
OVR_UNUSED(lrrOut);
if (pPayload->pData[0] == OVRID_RPC1)
{
OVR_ASSERT(pPayload->Bytes >= 2);
OVR::Net::BitStream bsIn((char*)pPayload->pData, pPayload->Bytes, false);
bsIn.IgnoreBytes(2);
if (pPayload->pData[1] == RPC_ERROR_FUNCTION_NOT_REGISTERED)
{
Mutex::Locker locker(&callBlockingMutex);
blockingReturnValue->Reset();
blockingOnThisConnection = 0;
callBlockingWait.NotifyAll();
}
else if (pPayload->pData[1] == ID_RPC4_RETURN)
{
Mutex::Locker locker(&callBlockingMutex);
blockingReturnValue->Reset();
blockingReturnValue->Write(bsIn);
blockingOnThisConnection = 0;
callBlockingWait.NotifyAll();
}
else if (pPayload->pData[1] == CALL_BLOCKING)
{
OVR::String uniqueId;
bsIn.Read(uniqueId);
RPCDelegate *bf = registeredBlockingFunctions.Get(uniqueId);
if (bf==0)
{
OVR::Net::BitStream bsOut;
bsOut.Write((unsigned char) OVRID_RPC1);
bsOut.Write((unsigned char) RPC_ERROR_FUNCTION_NOT_REGISTERED);
SendParameters sp(pPayload->pConnection, bsOut.GetData(), bsOut.GetNumberOfBytesUsed());
pSession->Send(&sp);
return;
}
OVR::Net::BitStream returnData;
bsIn.AlignReadToByteBoundary();
(*bf)(&bsIn, &returnData, pPayload);
OVR::Net::BitStream out;
out.Write((MessageID) OVRID_RPC1);
out.Write((MessageID) ID_RPC4_RETURN);
returnData.ResetReadPointer();
out.AlignWriteToByteBoundary();
out.Write(returnData);
SendParameters sp(pPayload->pConnection, out.GetData(), out.GetNumberOfBytesUsed());
pSession->Send(&sp);
}
else if (pPayload->pData[1]==ID_RPC4_SIGNAL)
{
OVR::String sharedIdentifier;
bsIn.Read(sharedIdentifier);
Observer<RPCSlot> *o = slotHash.GetSubject(sharedIdentifier);
if (o)
{
bsIn.AlignReadToByteBoundary();
if (o)
{
OVR::Net::BitStream serializedParameters(bsIn.GetData() + bsIn.GetReadOffset()/8, bsIn.GetNumberOfUnreadBits()/8, false);
o->Call(&serializedParameters, pPayload);
}
}
}
}
}