Line data Source code
1 : #ifndef A9EE36F9_16A8_4666_9CFE_801E34978BAC
2 : #define A9EE36F9_16A8_4666_9CFE_801E34978BAC
3 :
4 : #include "base/first_include.h" // IWYU pragma: keep
5 : #include "math/linalg/covariance_matrix_policies.h" // IWYU pragma: keep
6 :
7 :
8 : namespace tracking
9 : {
10 : namespace math
11 : {
12 : namespace contract
13 : {
14 :
15 : template <typename PolicyType>
16 : struct CovarianceMatrixPolicyIntf
17 : {
18 68 : CovarianceMatrixPolicyIntf()
19 : {
20 : #if __cplusplus == 202002L
21 : // Check inheritance from base policy
22 : static_assert(std::is_base_of_v<math::CovarianceMatrixPolicyBase, PolicyType>,
23 : "CovarianceMatrixPolicy must inherit from CovarianceMatrixPolicyBase");
24 :
25 : // Check that it has the required value_type alias
26 : static_assert(requires { PolicyType::is_factored; }, "CovarianceMatrixPolicy must define is_factored flag");
27 :
28 : // Check that it has the required value_type alias
29 : static_assert(requires { typename PolicyType::value_type; }, "CovarianceMatrixPolicy must define value_type");
30 :
31 : // Check that it has the required Instantiate template
32 : static_assert(
33 : requires { typename PolicyType::template Instantiate<4>; }, "CovarianceMatrixPolicy must define Instantiate template");
34 :
35 : // Additional check to ensure it's one of the concrete policy types
36 : static_assert(std::is_same_v<PolicyType, math::FullCovarianceMatrixPolicy<typename PolicyType::value_type>> ||
37 : std::is_same_v<PolicyType, math::FactoredCovarianceMatrixPolicy<typename PolicyType::value_type>>,
38 : "CovarianceMatrixPolicy must be either FullCovarianceMatrixPolicy or FactoredCovarianceMatrixPolicy");
39 : #endif //__cplusplus == 202002L
40 : }
41 : };
42 :
43 : } // namespace contract
44 : } // namespace math
45 : } // namespace tracking
46 :
47 :
48 : #endif // A9EE36F9_16A8_4666_9CFE_801E34978BAC
|