diff options
author | Hop311 <hop3114@gmail.com> | 2023-09-29 00:33:46 +0200 |
---|---|---|
committer | Hop311 <hop3114@gmail.com> | 2023-09-29 00:39:06 +0200 |
commit | 1e40569a49ab0d557a2a43ee900f4f28d5c81cd3 (patch) | |
tree | 745235805b36eb98092c072fba884263d794dba5 /src/openvic-simulation/types/IdentifierRegistry.hpp | |
parent | 84b5ee7a7749e2dbfeb214b4cedd16d5522f4197 (diff) |
Data types, defaults, callback cleanup
Diffstat (limited to 'src/openvic-simulation/types/IdentifierRegistry.hpp')
-rw-r--r-- | src/openvic-simulation/types/IdentifierRegistry.hpp | 10 |
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 { \ |