Renaming: Server<> --> ServiceServer<>

This commit is contained in:
Pavel Kirienko
2014-03-14 01:20:27 +04:00
parent cefc346ebb
commit bc70390722
3 changed files with 13 additions and 13 deletions
@@ -15,10 +15,10 @@ template <typename DataType_,
typename DataType_::Response&), typename DataType_::Response&),
unsigned int NumStaticReceivers = 2, unsigned int NumStaticReceivers = 2,
unsigned int NumStaticBufs = 1> unsigned int NumStaticBufs = 1>
class Server : public GenericSubscriber<DataType_, typename DataType_::Request, class ServiceServer : public GenericSubscriber<DataType_, typename DataType_::Request,
typename TransferListenerInstantiationHelper<typename DataType_::Request, typename TransferListenerInstantiationHelper<typename DataType_::Request,
NumStaticReceivers, NumStaticReceivers,
NumStaticBufs>::Type> NumStaticBufs>::Type>
{ {
public: public:
typedef DataType_ DataType; typedef DataType_ DataType;
@@ -44,19 +44,19 @@ private:
callback_(request, response_); callback_(request, response_);
} }
else else
handleFatalError("Invalid server callback"); handleFatalError("Invalid service server callback");
const int res = publisher_.publish(response_, TransferTypeServiceResponse, request.getSrcNodeID(), const int res = publisher_.publish(response_, TransferTypeServiceResponse, request.getSrcNodeID(),
request.getTransferID()); request.getTransferID());
if (res <= 0) if (res <= 0)
{ {
UAVCAN_TRACE("Server", "Response publication failure: %i", res); UAVCAN_TRACE("ServiceServer", "Response publication failure: %i", res);
response_failure_count_++; response_failure_count_++;
} }
} }
public: public:
Server(Scheduler& scheduler, IAllocator& allocator, IMarshalBufferProvider& buffer_provider) ServiceServer(Scheduler& scheduler, IAllocator& allocator, IMarshalBufferProvider& buffer_provider)
: SubscriberType(scheduler, allocator) : SubscriberType(scheduler, allocator)
, publisher_(scheduler, buffer_provider, getDefaultTxTimeout()) , publisher_(scheduler, buffer_provider, getDefaultTxTimeout())
, callback_() , callback_()
@@ -73,7 +73,7 @@ public:
if (!try_implicit_cast<bool>(callback, true)) if (!try_implicit_cast<bool>(callback, true))
{ {
UAVCAN_TRACE("Server", "Invalid callback"); UAVCAN_TRACE("ServiceServer", "Invalid callback");
return -1; return -1;
} }
callback_ = callback; callback_ = callback;
+2 -2
View File
@@ -4,7 +4,7 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <uavcan/service_client.hpp> #include <uavcan/service_client.hpp>
#include <uavcan/server.hpp> #include <uavcan/service_server.hpp>
#include <uavcan/util/method_binder.hpp> #include <uavcan/util/method_binder.hpp>
#include <root_ns_a/StringService.hpp> #include <root_ns_a/StringService.hpp>
#include <queue> #include <queue>
@@ -157,7 +157,7 @@ TEST(ServiceClient, Basic)
uavcan::DefaultDataTypeRegistrator<root_ns_a::StringService> _registrator; uavcan::DefaultDataTypeRegistrator<root_ns_a::StringService> _registrator;
// Server // Server
uavcan::Server<root_ns_a::StringService> server(node_a.scheduler, node_a.poolmgr, node_a.buffer_provider); uavcan::ServiceServer<root_ns_a::StringService> server(node_a.scheduler, node_a.poolmgr, node_a.buffer_provider);
ASSERT_EQ(1, server.start(stringServiceServerCallback)); ASSERT_EQ(1, server.start(stringServiceServerCallback));
{ {
@@ -3,7 +3,7 @@
*/ */
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <uavcan/server.hpp> #include <uavcan/service_server.hpp>
#include <uavcan/util/method_binder.hpp> #include <uavcan/util/method_binder.hpp>
#include <root_ns_a/StringService.hpp> #include <root_ns_a/StringService.hpp>
#include "clock.hpp" #include "clock.hpp"
@@ -34,7 +34,7 @@ struct ServerImpl
}; };
TEST(Server, Basic) TEST(ServiceServer, Basic)
{ {
uavcan::PoolAllocator<uavcan::MemPoolBlockSize * 8, uavcan::MemPoolBlockSize> pool; uavcan::PoolAllocator<uavcan::MemPoolBlockSize * 8, uavcan::MemPoolBlockSize> pool;
uavcan::PoolManager<1> poolmgr; uavcan::PoolManager<1> poolmgr;
@@ -55,7 +55,7 @@ TEST(Server, Basic)
ServerImpl impl("456"); ServerImpl impl("456");
{ {
uavcan::Server<root_ns_a::StringService, ServerImpl::Binder> server(sch, poolmgr, buffer_provider); uavcan::ServiceServer<root_ns_a::StringService, ServerImpl::Binder> server(sch, poolmgr, buffer_provider);
ASSERT_EQ(0, sch.getDispatcher().getNumServiceRequestListeners()); ASSERT_EQ(0, sch.getDispatcher().getNumServiceRequestListeners());
server.start(impl.bind()); server.start(impl.bind());