From 53795c74aead4e6021bc788b788f8ed5b4a0166d Mon Sep 17 00:00:00 2001 From: Andrej Rode Date: Mon, 3 Apr 2017 18:49:58 -0700 Subject: uhd: add cut-down rpclib source tree and import tool --- .../deps/rpclib/include/rpc/detail/func_traits.h | 77 ++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 host/lib/deps/rpclib/include/rpc/detail/func_traits.h (limited to 'host/lib/deps/rpclib/include/rpc/detail/func_traits.h') diff --git a/host/lib/deps/rpclib/include/rpc/detail/func_traits.h b/host/lib/deps/rpclib/include/rpc/detail/func_traits.h new file mode 100644 index 000000000..1847d99dc --- /dev/null +++ b/host/lib/deps/rpclib/include/rpc/detail/func_traits.h @@ -0,0 +1,77 @@ +#pragma once + +#ifndef FUNC_TRAITS_H_HWIWA6G0 +#define FUNC_TRAITS_H_HWIWA6G0 + +#include "rpc/detail/bool.h" + +namespace rpc { +namespace detail { + +template +using is_zero = invoke>; + +template +using nth_type = invoke>>; + +namespace tags { + +// tags for the function traits, used for tag dispatching +struct zero_arg {}; +struct nonzero_arg {}; +struct void_result {}; +struct nonvoid_result {}; + +template struct arg_count_trait { typedef nonzero_arg type; }; + +template <> struct arg_count_trait<0> { typedef zero_arg type; }; + +template struct result_trait { typedef nonvoid_result type; }; + +template <> struct result_trait { typedef void_result type; }; +} + +//! \brief Provides a small function traits implementation that +//! works with a reasonably large set of functors. +template +struct func_traits : func_traits {}; + +template +struct func_traits : func_traits {}; + +template +struct func_traits : func_traits {}; + +template struct func_traits { + using result_type = R; + using arg_count = std::integral_constant; + using args_type = std::tuple::type...>; +}; + +template +struct func_kind_info : func_kind_info {}; + +template +struct func_kind_info : func_kind_info {}; + +template +struct func_kind_info + : func_kind_info {}; + +template struct func_kind_info { + typedef typename tags::arg_count_trait::type args_kind; + typedef typename tags::result_trait::type result_kind; +}; + +template using is_zero_arg = is_zero::arg_count>; + +template +using is_single_arg = + invoke::arg_count == 1, true_, false_>>; + +template +using is_void_result = std::is_void::result_type>; +} +} + +#endif /* end of include guard: FUNC_TRAITS_H_HWIWA6G0 */ -- cgit v1.2.3