Rpc.h
// Rpc.h
//
// Author David Barrett-Lennard
// (C)opyright Cedanet Pty Ltd 2020
@import "cxRpc.h"
@import "Stub.h"
@import "Skeleton.h"
@import "Ceda/cxObject/Object.h"
#include "Ceda/cxUtils/IException.h"
namespace ceda
{
///////////////////////////////////////////////////////////////////////////////////////////////////
// RpcCaller
$adt+ RpcCaller final
{
void Close();
void GetBuffer(xvector<uint8>& buffer);
AnyInterface GetStub();
};
@api RpcCaller* CreateRpcCaller(ConstStringZ qualifiedInterfaceName);
template <typename I>
RpcCaller* CreateRpcCaller()
{
return CreateRpcCaller(GetIpcInterfaceName<I>());
}
template <typename I>
ptr<I> GetStub(RpcCaller* c)
{
cxAssert(c != nullptr);
AnyInterface a = GetStub(c);
return ptr<I>(a.m_self, a.m_table);
}
///////////////////////////////////////////////////////////////////////////////////////////////////
// RpcCallee
$adt+ RpcCallee final
{
void Close();
bool PlayMessages(const void* buffer, ssize_t size);
};
@api RpcCallee* CreateRpcCallee(
ConstStringZ qualifiedInterfaceName, // Interface implemented by 'receiver'
AnyInterface receiver); // Must implement interface ri. Must not be null.
template <typename I>
RpcCallee* CreateRpcCallee(ptr<I> receiver)
{
return CreateRpcCallee(GetIpcInterfaceName<I>(), receiver);
}
} // namespace ceda