Line data Source code
1 0 : // Distributed under the MIT License.
2 : // See LICENSE.txt for details.
3 :
4 : #pragma once
5 :
6 : #include <type_traits>
7 :
8 : #include "ControlSystem/Protocols/Submeasurement.hpp"
9 : #include "Utilities/ProtocolHelpers.hpp"
10 : #include "Utilities/TMPL.hpp"
11 :
12 : namespace control_system::protocols {
13 : /*!
14 : * \brief Definition of a measurement for the control systems
15 : *
16 : * A class conforming to this protocol is referenced from each control
17 : * system to define measurements to be made. Multiple control systems
18 : * can share the same measurement.
19 : *
20 : * A conforming class must provide a `submeasurements` type alias to a
21 : * `tmpl::list` of structs conforming to the Submeasurement protocol.
22 : *
23 : * Here's an example for a class conforming to this protocol:
24 : *
25 : * \snippet Helpers/ControlSystem/Examples.hpp Measurement
26 : *
27 : * A measurement may optionally specify a `const_global_cache_tags` type alias
28 : * that is a list of the tags to add to the const GlobalCache.
29 : */
30 1 : struct Measurement {
31 : template <typename ConformingType>
32 0 : struct test {
33 0 : using submeasurements = typename ConformingType::submeasurements;
34 :
35 : static_assert(
36 : tmpl::all<submeasurements,
37 : tt::assert_conforms_to<tmpl::_1, Submeasurement>>::value);
38 : };
39 : };
40 : } // namespace control_system::protocols
|