Skip to content

Commit 19e189f

Browse files
committed
iox-#27 Add constraints to the request and response types of client and server
1 parent 18dafcd commit 19e189f

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

iceoryx_posh/include/iceoryx_posh/internal/popo/client_impl.hpp

+10
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@ namespace popo
3535
template <typename Req, typename Res, typename BaseClientT = BaseClient<>>
3636
class ClientImpl : public BaseClientT, public RpcInterface<Request<Req>>
3737
{
38+
static_assert(!std::is_void<Req>::value, "The type `Req` must not be void. Use the UntypedClient for void types.");
39+
static_assert(!std::is_void<Res>::value, "The type `Res` must not be void. Use the UntypedClient for void types.");
40+
41+
static_assert(!std::is_const<Req>::value, "The type `Req` must not be const.");
42+
static_assert(!std::is_const<Res>::value, "The type `Res` must not be const.");
43+
static_assert(!std::is_reference<Req>::value, "The type `Req` must not be a reference.");
44+
static_assert(!std::is_reference<Res>::value, "The type `Res` must not be a reference.");
45+
static_assert(!std::is_pointer<Req>::value, "The type `Req` must not be a pointer.");
46+
static_assert(!std::is_pointer<Res>::value, "The type `Res` must not be a pointer.");
47+
3848
public:
3949
explicit ClientImpl(const capro::ServiceDescription& service, const ClientOptions& clientOptions = {}) noexcept;
4050
ClientImpl(const ClientImpl&) = delete;

iceoryx_posh/include/iceoryx_posh/internal/popo/server_impl.hpp

+10
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@ namespace popo
3535
template <typename Req, typename Res, typename BaseServerT = BaseServer<>>
3636
class ServerImpl : public BaseServerT, public RpcInterface<Response<Res>>
3737
{
38+
static_assert(!std::is_void<Req>::value, "The type `Req` must not be void. Use the UntypedServer for void types.");
39+
static_assert(!std::is_void<Res>::value, "The type `Res` must not be void. Use the UntypedServer for void types.");
40+
41+
static_assert(!std::is_const<Req>::value, "The type `Req` must not be const.");
42+
static_assert(!std::is_const<Res>::value, "The type `Res` must not be const.");
43+
static_assert(!std::is_reference<Req>::value, "The type `Req` must not be a reference.");
44+
static_assert(!std::is_reference<Res>::value, "The type `Res` must not be a reference.");
45+
static_assert(!std::is_pointer<Req>::value, "The type `Req` must not be a pointer.");
46+
static_assert(!std::is_pointer<Res>::value, "The type `Res` must not be a pointer.");
47+
3848
public:
3949
explicit ServerImpl(const capro::ServiceDescription& service, const ServerOptions& serverOptions = {}) noexcept;
4050
ServerImpl(const ServerImpl&) = delete;

0 commit comments

Comments
 (0)