aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/types/IdentifierRegistry.hpp
diff options
context:
space:
mode:
author Hop311 <Hop3114@gmail.com>2024-01-24 09:49:58 +0100
committer GitHub <noreply@github.com>2024-01-24 09:49:58 +0100
commit3e2ee2cd3553cb0a5949d7a34c5ef2f10ff5c949 (patch)
treeb370690ab7c7d3360d2a567f7f4ed8611aa6b23e /src/openvic-simulation/types/IdentifierRegistry.hpp
parent76d9463cc1a72c24592f79d3d7a9c8e337165d8c (diff)
parentc56131a7d615e20e117114e005d0a3e4c9fae2ca (diff)
Merge pull request #139 from OpenVicProject/constexpr-date
Made Date constexpr so that PROPERTY getters can be constexpr
Diffstat (limited to 'src/openvic-simulation/types/IdentifierRegistry.hpp')
-rw-r--r--src/openvic-simulation/types/IdentifierRegistry.hpp14
1 files changed, 3 insertions, 11 deletions
diff --git a/src/openvic-simulation/types/IdentifierRegistry.hpp b/src/openvic-simulation/types/IdentifierRegistry.hpp
index 6396e75..4d002e7 100644
--- a/src/openvic-simulation/types/IdentifierRegistry.hpp
+++ b/src/openvic-simulation/types/IdentifierRegistry.hpp
@@ -185,19 +185,15 @@ namespace OpenVic {
static constexpr bool storage_type_reservable = Reservable<storage_type>;
private:
- const std::string name;
+ const std::string PROPERTY(name);
const bool log_lock;
storage_type PROPERTY_REF(items);
- bool locked = false;
+ bool PROPERTY_CUSTOM_PREFIX(locked, is);
identifier_index_map_t identifier_index_map;
public:
constexpr UniqueKeyRegistry(std::string_view new_name, bool new_log_lock = true)
- : name { new_name }, log_lock { new_log_lock } {}
-
- constexpr std::string_view get_name() const {
- return name;
- }
+ : name { new_name }, log_lock { new_log_lock }, locked { false } {}
constexpr bool add_item(
item_type&& item, NodeTools::Callback<std::string_view, std::string_view> auto duplicate_callback
@@ -233,10 +229,6 @@ namespace OpenVic {
}
}
- constexpr bool is_locked() const {
- return locked;
- }
-
constexpr void reset() {
identifier_index_map.clear();
items.clear();