47 #ifndef MIRA_FRAMEWORK_INCLUDE_FW_SERVICECALL_H_ 48 #define MIRA_FRAMEWORK_INCLUDE_FW_SERVICECALL_H_ 65 template<
class Ret,
class... ARGS>
79 : mServiceProvider(
std::move(serviceProvider)), mMethod(
std::move(method))
97 return call(args...).get();
102 return MIRA_FW.getRPCManager().call<Ret>(mServiceProvider, mMethod, args...);
115 if (!
MIRA_FW.getRPCManager().waitForService(mServiceProvider, timeout)) {
119 auto matchSignature = [sig = getSignature()](
const auto& method) {
return method.signature == sig; };
121 while (!boost::this_thread::interruption_requested()) {
122 if (
MIRA_FW.getRPCManager().getLocalServices().count(mServiceProvider)) {
123 const auto& methods =
MIRA_FW.getRPCManager().getLocalService(mServiceProvider).methods;
124 if (std::any_of(methods.begin(), methods.end(), matchSignature)) {
129 else if (
MIRA_FW.getRPCManager().getRemoteServices().count(mServiceProvider)) {
130 const auto& methods =
MIRA_FW.getRPCManager().getRemoteService(mServiceProvider).methods;
131 if (std::any_of(methods.begin(), methods.end(), matchSignature)) {
149 template<
typename Reflector>
152 r.member(
"ServiceProvider", mServiceProvider,
"Provider for the service method",
154 r.member(
"Method", mMethod,
"Name of method to be called",
159 std::string mServiceProvider;
167 #endif // MIRA_FRAMEWORK_INCLUDE_FW_SERVICECALL_H_ void waitForServiceCall() const
Definition: ServiceCall.h:105
RPCSignature getSignature() const
Definition: ServiceCall.h:144
bool isValid() const
Checks if this duration is invalid.
Definition: Time.h:255
specialize cv::DataType for our ImgPixel and inherit from cv::DataType<Vec>
Definition: IOService.h:67
RPCSignature makeRPCSignature(std::string name)
Definition: RPCSignature.h:145
#define MIRA_FW
Macro for accessing the framework instance.
Definition: Framework.h:73
An RPCFuture is a proxy for the result of an asynchronous RPC call.
Definition: RPCFuture.h:173
Wrapper class for boost::posix_time::ptime for adding more functionality to it.
Definition: Time.h:416
Use this class to represent time durations.
Definition: Time.h:104
void reflect(Reflector &r)
Definition: ServiceCall.h:150
Ret operator()(const ARGS &... args) const
Call operator to allow function like usage.
Definition: ServiceCall.h:95
static Duration infinity()
Returns a special duration time representing positive infinity.
Definition: Time.h:240
RPCFuture< Ret > call(const ARGS &... args) const
Definition: ServiceCall.h:100
ServiceCall(std::string serviceProvider, std::string method)
Construct a ServiceCall object referring to a specific service provider and method.
Definition: ServiceCall.h:78
bool isInfinity() const
Checks if this duration is infinity.
Definition: Time.h:262
static Time now() static Time eternity()
Returns the current utc based time.
Definition: Time.h:479
bool waitForServiceCall(Duration timeout) const
Definition: ServiceCall.h:110
Stores the signature of an RPC method including the methods name and its parameter types...
Definition: RPCSignature.h:68
#define MIRA_SLEEP(ms)
Sleeps for ms milliseconds This is a thread interruption point - if interruption of the current threa...
Definition: Thread.h:95
The framework that holds all manager classes and provides startup and shutdown of all framework relat...
Definition: Authority.h:78
When this flag is used in calls to Reflector::member(), that member is also reflected as read-only pr...
Definition: ReflectControlFlags.h:103