aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/types/HasIdentifier.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/openvic-simulation/types/HasIdentifier.hpp')
-rw-r--r--src/openvic-simulation/types/HasIdentifier.hpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/openvic-simulation/types/HasIdentifier.hpp b/src/openvic-simulation/types/HasIdentifier.hpp
index 925d58b..74961e3 100644
--- a/src/openvic-simulation/types/HasIdentifier.hpp
+++ b/src/openvic-simulation/types/HasIdentifier.hpp
@@ -2,6 +2,8 @@
#include <algorithm>
#include <cassert>
+#include <string>
+#include <string_view>
#include <ostream>
#include "openvic-simulation/types/Colour.hpp"
@@ -49,6 +51,11 @@ namespace OpenVic {
return obj != nullptr ? stream << *obj : stream << "<NULL>";
}
+ template<typename T>
+ concept HasGetIdentifier = requires(T const& t) {
+ { t.get_identifier() } -> std::same_as<std::string_view>;
+ };
+
/*
* Base class for objects with associated colour information.
*/
@@ -71,6 +78,11 @@ namespace OpenVic {
using HasColour = _HasColour<colour_t>;
using HasAlphaColour = _HasColour<colour_argb_t>;
+ template<typename T>
+ concept HasGetColour = requires(T const& t) {
+ { t.get_colour() } -> IsColour;
+ };
+
/*
* Base class for objects with a unique string identifier and associated colour information.
*/
@@ -107,4 +119,9 @@ namespace OpenVic {
HasIndex& operator=(HasIndex const&) = delete;
HasIndex& operator=(HasIndex&&) = delete;
};
+
+ template<typename T>
+ concept HasGetIndex = requires(T const& t) {
+ { t.get_index() } -> std::unsigned_integral;
+ };
}