Skip to content

Commit

Permalink
fix the build correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
francisco-miguel-almeida committed May 8, 2019
1 parent e53cde1 commit fd14e71
Showing 1 changed file with 22 additions and 32 deletions.
54 changes: 22 additions & 32 deletions rtt_roscomm/include/rtt_roscomm/rtt_rosservice_proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,52 +75,42 @@ class ROSServiceServerOperationCaller : public ROSServiceServerOperationCallerBa
typedef typename Wrapper::ProxyOperationCallerType ProxyOperationCallerType;
typedef boost::shared_ptr<ProxyOperationCallerType> ProxyOperationCallerTypePtr;

static Ptr connect(RTT::OperationInterfacePart* operation) {
ProxyOperationCallerTypePtr proxy_operation_caller
= boost::make_shared<ProxyOperationCallerType>(operation->getLocalOperation(), RTT::internal::GlobalEngine::Instance());
if (proxy_operation_caller->ready()) {
return Ptr(new ROSServiceServerOperationCaller<ROS_SERVICE_T, variant>(proxy_operation_caller));
}
return tryNextVariant(operation);
}

virtual bool call(typename ROS_SERVICE_T::Request& request, typename ROS_SERVICE_T::Response& response) const {
// Check if the operation caller is ready, and then call it.
if (!proxy_operation_caller_->ready()) return false;
return Wrapper::call(*proxy_operation_caller_, request, response);
}

private:
template<typename Dummy>
struct Void {
typedef void type;
};
template<typename Dummy> struct Void { typedef void type; };

template<typename R = void, typename Enabled = void>
struct EnableIfHasNextVariant {};
template<typename R = void, typename Enabled = void> struct EnableIfHasNextVariant { };

template<typename R>
struct EnableIfHasNextVariant<R,
template<typename R> struct EnableIfHasNextVariant<R,
typename Void<typename ROSServiceServerOperationCallerWrapper<ROS_SERVICE_T, variant + 1>::ProxyOperationCallerType>::type> {
typedef R type;
};

template<typename R = void, typename Enabled = void>
struct DisableIfHasNextVariant {
typedef R type;
struct NextVariant {
static Ptr connect(RTT::OperationInterfacePart*) { return Ptr(); }
};

template<typename R>
struct DisableIfHasNextVariant<R, typename EnableIfHasNextVariant<R>::type> {};
struct NextVariant<R, typename EnableIfHasNextVariant<R>::type> {
static Ptr connect(RTT::OperationInterfacePart* operation) {
return ROSServiceServerOperationCaller<ROS_SERVICE_T, variant + 1>::connect(operation);
}
};

template<typename Dummy>
static typename EnableIfHasNextVariant<Ptr>::type tryNextVariant(RTT::OperationInterfacePart* operation, Dummy* = 0) {
return ROSServiceServerOperationCaller<ROS_SERVICE_T, variant + 1>::connect(operation);
public:
static Ptr connect(RTT::OperationInterfacePart* operation) {
ProxyOperationCallerTypePtr proxy_operation_caller
= boost::make_shared<ProxyOperationCallerType>(operation->getLocalOperation(), RTT::internal::GlobalEngine::Instance());
if (proxy_operation_caller->ready()) {
return Ptr(new ROSServiceServerOperationCaller<ROS_SERVICE_T, variant>(proxy_operation_caller));
}
return NextVariant<void>::connect(operation);
}

template<typename Dummy>
static typename DisableIfHasNextVariant<Ptr>::type tryNextVariant(RTT::OperationInterfacePart* operation, Dummy* = 0) {
return Ptr();
virtual bool call(typename ROS_SERVICE_T::Request& request, typename ROS_SERVICE_T::Response& response) const {
// Check if the operation caller is ready, and then call it.
if (!proxy_operation_caller_->ready()) return false;
return Wrapper::call(*proxy_operation_caller_, request, response);
}

ROSServiceServerOperationCaller(const boost::shared_ptr<ProxyOperationCallerType>& impl)
Expand Down

0 comments on commit fd14e71

Please sign in to comment.