aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-simulation/types/IdentifierRegistry.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/openvic-simulation/types/IdentifierRegistry.hpp')
-rw-r--r--src/openvic-simulation/types/IdentifierRegistry.hpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/openvic-simulation/types/IdentifierRegistry.hpp b/src/openvic-simulation/types/IdentifierRegistry.hpp
index 482e917..7fe2656 100644
--- a/src/openvic-simulation/types/IdentifierRegistry.hpp
+++ b/src/openvic-simulation/types/IdentifierRegistry.hpp
@@ -155,6 +155,10 @@ namespace OpenVic {
return nullptr;
}
+ bool has_identifier(std::string_view identifier) const {
+ return get_item_by_identifier(identifier) != nullptr;
+ }
+
T* get_item_by_index(size_t index) {
return index < items.size() ? &items[index] : nullptr;
}
@@ -163,6 +167,10 @@ namespace OpenVic {
return index < items.size() ? &items[index] : nullptr;
}
+ bool has_index(size_t index) const {
+ return get_item_by_index(index) != nullptr;
+ }
+
std::vector<T>& get_items() {
return items;
}
@@ -244,6 +252,8 @@ namespace OpenVic {
bool plural##_are_locked() const { return plural.is_locked(); } \
type const* get_##singular##_by_identifier(std::string_view identifier) const { \
return plural.get_item_by_identifier(identifier); } \
+ bool has_##singular##_identifier(std::string_view identifier) const { \
+ return plural.has_identifier(identifier); } \
size_t get_##singular##_count() const { \
return plural.size(); } \
std::vector<type> const& get_##plural() const { \