Skip to content

Commit

Permalink
iox-#27 Add constraints to the request and response types of client a…
Browse files Browse the repository at this point in the history
…nd server
  • Loading branch information
elBoberido committed Feb 21, 2022
1 parent 3fe942d commit 04cde7d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions iceoryx_posh/include/iceoryx_posh/internal/popo/client_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ namespace popo
template <typename Req, typename Res, typename BaseClientT = BaseClient<>>
class ClientImpl : public BaseClientT, public RpcInterface<Request<Req>>
{
static_assert(!std::is_void<Req>::value, "The type `Req` must not be void. Use the UntypedClient for void types.");
static_assert(!std::is_void<Res>::value, "The type `Res` must not be void. Use the UntypedClient for void types.");

static_assert(!std::is_const<Req>::value, "The type `Req` must not be const.");
static_assert(!std::is_const<Res>::value, "The type `Res` must not be const.");
static_assert(!std::is_reference<Req>::value, "The type `Req` must not be a reference.");
static_assert(!std::is_reference<Res>::value, "The type `Res` must not be a reference.");
static_assert(!std::is_pointer<Req>::value, "The type `Req` must not be a pointer.");
static_assert(!std::is_pointer<Res>::value, "The type `Res` must not be a pointer.");

public:
explicit ClientImpl(const capro::ServiceDescription& service, const ClientOptions& clientOptions = {}) noexcept;
ClientImpl(const ClientImpl&) = delete;
Expand Down
10 changes: 10 additions & 0 deletions iceoryx_posh/include/iceoryx_posh/internal/popo/server_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ namespace popo
template <typename Req, typename Res, typename BaseServerT = BaseServer<>>
class ServerImpl : public BaseServerT, public RpcInterface<Response<Res>>
{
static_assert(!std::is_void<Req>::value, "The type `Req` must not be void. Use the UntypedServer for void types.");
static_assert(!std::is_void<Res>::value, "The type `Res` must not be void. Use the UntypedServer for void types.");

static_assert(!std::is_const<Req>::value, "The type `Req` must not be const.");
static_assert(!std::is_const<Res>::value, "The type `Res` must not be const.");
static_assert(!std::is_reference<Req>::value, "The type `Req` must not be a reference.");
static_assert(!std::is_reference<Res>::value, "The type `Res` must not be a reference.");
static_assert(!std::is_pointer<Req>::value, "The type `Req` must not be a pointer.");
static_assert(!std::is_pointer<Res>::value, "The type `Res` must not be a pointer.");

public:
explicit ServerImpl(const capro::ServiceDescription& service, const ServerOptions& serverOptions = {}) noexcept;
ServerImpl(const ServerImpl&) = delete;
Expand Down

0 comments on commit 04cde7d

Please sign in to comment.