OpenKalman
layout_mapping_policy.hpp
Go to the documentation of this file.
1 /* This file is part of OpenKalman, a header-only C++ library for
2  * Kalman filters and other recursive filters.
3  *
4  * Copyright (c) 2025 Christopher Lee Ogden <ogden@gatech.edu>
5  *
6  * This Source Code Form is subject to the terms of the Mozilla Public
7  * License, v. 2.0. If a copy of the MPL was not distributed with this
8  * file, You can obtain one at https://mozilla.org/MPL/2.0/.
9  */
10 
16 #ifndef OPENKALMAN_LAYOUT_MAPPING_POLICY_HPP
17 #define OPENKALMAN_LAYOUT_MAPPING_POLICY_HPP
18 
19 #include "basics/basics.hpp"
20 
21 namespace OpenKalman::internal
22 {
23  namespace detail
24  {
25  template<typename E>
26  struct is_extents : std::false_type {};
27 
28  template<typename IndexType, std::size_t...Extents>
29  struct is_extents<stdex::extents<IndexType, Extents...>> : std::true_type {};
30  }
31 
32 
36  template<typename M>
37 #ifdef __cpp_concepts
38  concept layout_mapping =
39 #else
40  constexpr bool layout_mapping =
41 #endif
42  stdex::copyable<M> and
43  stdex::equality_comparable<M> and
44  std::is_nothrow_move_constructible_v<M> and
45  std::is_nothrow_move_assignable_v<M> and
46  std::is_nothrow_swappable_v<M> and
48  stdex::same_as<typename M::index_type, typename M::extents_type::index_type> and
49  stdex::same_as<typename M::rank_type, typename M::extents_type::rank_type>;
50 
51 
52  namespace detail
53  {
54  template<typename MP, typename M, typename E>
55 #ifdef __cpp_concepts
56  concept layout_mapping_policy_impl_impl =
57 #else
58  constexpr bool layout_mapping_policy_impl_impl =
59 #endif
60  layout_mapping<M> and
61  stdex::same_as<MP, typename M::layout_type> and
62  stdex::same_as<E, typename M::extents_type>;
63 
64 
65  template<typename MP, typename E>
66 #ifdef __cpp_concepts
67  concept layout_mapping_policy_impl =
68 #else
69  constexpr bool layout_mapping_policy_impl =
70 #endif
71  layout_mapping_policy_impl_impl<MP, typename MP::template mapping<E>, E>;
72 
73  }
74 
75 
79  template<typename MP>
80 #ifdef __cpp_concepts
81  concept layout_mapping_policy =
82 #else
83  constexpr bool layout_mapping_policy =
84 #endif
85  detail::layout_mapping_policy_impl<MP, stdex::extents<std::size_t>>;
86 
87 }
88 
89 #endif
Definition: layout_mapping_policy.hpp:26
Basic definitions for OpenKalman as a whole.
constexpr bool layout_mapping_policy
MP is a LayoutMappingPolicy.
Definition: layout_mapping_policy.hpp:83
Definition: basics.hpp:48
constexpr bool layout_mapping
MP is a LayoutMapping.
Definition: layout_mapping_policy.hpp:40