LCOV - code coverage report
Current view: top level - motion/contracts - state_mem_intf.h (source / functions) Coverage Total Hit
Test: lcov.info Lines: 100.0 % 2 2
Test Date: 2026-04-26 21:52:20 Functions: - 0 0
Legend: Lines: hit not hit

            Line data    Source code
       1              : #ifndef D8B229A8_8FAA_41E5_AA06_3E1B7FBA4F47
       2              : #define D8B229A8_8FAA_41E5_AA06_3E1B7FBA4F47
       3              : 
       4              : 
       5              : #include "base/first_include.h" // IWYU pragma: keep
       6              : #include "base/interface_contract.h"
       7              : #include "base/require_copy_intf.h"
       8              : #include "base/require_move_intf.h"
       9              : 
      10              : 
      11              : namespace tracking
      12              : {
      13              : namespace motion
      14              : {
      15              : namespace contract
      16              : {
      17              : #if __cplusplus == 202002L
      18              : // clang-format off
      19              : namespace state_mem
      20              : {
      21              : template<typename T>
      22              : concept has_getVec_const_member_func = requires {
      23              :   { std::declval<const T>().getVec() } -> std::same_as<typename T::ConstStateVec&>;
      24              : };
      25              : template<typename T>
      26              : concept has_getCov_const_member_func = requires {
      27              :   { std::declval<const T>().getCov() } -> std::same_as<typename T::ConstStateCov&>;
      28              : };
      29              : template<typename T>
      30              : concept has_round_brackets_const_op_int_int = requires {
      31              :   { std::declval<const T>().operator()(std::declval<int>(), std::declval<int>()) } -> std::same_as<typename T::value_type>;
      32              : };
      33              : template<typename T>
      34              : concept has_round_brackets_op_int_int = requires {
      35              :   { std::declval<T>().operator()(std::declval<int>(), std::declval<int>()) } -> std::same_as<typename T::value_type&>;
      36              : };
      37              : template<typename T>
      38              : concept has_square_brackets_const_op_int = requires {
      39              :   { std::declval<const T>().operator[](std::declval<int>()) } -> std::same_as<typename T::value_type>;
      40              : };
      41              : 
      42              : //###### protected members ######################
      43              : template<typename T>
      44              : concept has_getVec_member_func = requires {
      45              :   { std::declval<T>().getVec() } -> std::same_as<typename T::StateVec&>;
      46              : };
      47              : template<typename T>
      48              : concept has_getCov_member_func = requires {
      49              :   { std::declval<T>().getCov() } -> std::same_as<typename T::StateCov&>;
      50              : };
      51              : template<typename T>
      52              : concept has_square_brackets_op_int = requires {
      53              :   { std::declval<T>().operator[](std::declval<int>()) } -> std::same_as<typename T::value_type&>;
      54              : };
      55              : // clang-format on
      56              : } // namespace state_mem
      57              : #endif // __cplusplus == 202002L
      58              : 
      59              : template <typename ImplType>
      60              : struct StateMemIntf
      61              :     : public base::contract::RequireCopyIntf<ImplType>
      62              :     , public base::contract::RequireMoveIntf<ImplType>
      63              : {
      64           14 :   StateMemIntf()
      65              :       : base::contract::RequireCopyIntf<ImplType>()
      66           14 :       , base::contract::RequireMoveIntf<ImplType>()
      67              : 
      68              :   {
      69              :     static_assert(std::is_floating_point<typename ImplType::value_type>());
      70              : 
      71              : #if __cplusplus == 202002L
      72              :     static_assert(state_mem::has_getVec_const_member_func<ImplType>, ERR_MSG_MISSING_FUNCTION);
      73              :     static_assert(state_mem::has_getCov_const_member_func<ImplType>, ERR_MSG_MISSING_FUNCTION);
      74              :     static_assert(state_mem::has_square_brackets_const_op_int<ImplType>, ERR_MSG_DEFINED_UNEXPECTED_FUNCTION);
      75              :     static_assert(state_mem::has_round_brackets_const_op_int_int<ImplType>, ERR_MSG_MISSING_FUNCTION);
      76              :     static_assert(!state_mem::has_round_brackets_op_int_int<ImplType>, ERR_MSG_DEFINED_UNEXPECTED_FUNCTION);
      77              : #if defined(TEST_BUILD)
      78              :     static_assert(state_mem::has_getVec_member_func<ImplType>, ERR_MSG_MISSING_FUNCTION);
      79              :     static_assert(state_mem::has_getCov_member_func<ImplType>, ERR_MSG_MISSING_FUNCTION);
      80              :     static_assert(state_mem::has_square_brackets_op_int<ImplType>, ERR_MSG_DEFINED_UNEXPECTED_FUNCTION);
      81              : #endif // TEST_BUILD
      82              : #endif // __cplusplus == 202002L
      83              :   }
      84              : };
      85              : 
      86              : } // namespace contract
      87              : } // namespace motion
      88              : } // namespace tracking
      89              : 
      90              : #endif // D8B229A8_8FAA_41E5_AA06_3E1B7FBA4F47
        

Generated by: LCOV version 2.0-1