33#include <unordered_map>
56 using Base::add_parameters;
63 bool dtor_sequence_initiated =
false;
74 dtor_sequence_initiated =
true;
98 m_elements[
key] = element;
109 m_elements[
key] = element;
120 m_elements.erase(
key);
126 auto const &
elements()
const {
return m_elements; }
132 for (
auto const &
key : std::views::elements<0>(m_elements)) {
165 if (
method ==
"get_map") {
170 auto const view = std::views::elements<0>(m_elements);
171 return std::vector<KeyType>{
view.begin(),
view.end()};
180 return static_cast<int>(m_elements.size());
184 return m_elements.empty();
187 if (
method ==
"contains") {
196 for (
auto const &[
key, element] : m_elements) {
205 using namespace detail::demangle;
206 auto const actual = simplify_symbol_variant(
key);
207 auto const target = simplify_symbol(
static_cast<key_type *
>(
nullptr));
208 if (Base::context()->is_head_node()) {
209 throw std::invalid_argument(
"Key has to be of type '" +
target +
210 "', got type '" +
actual +
"'");
Owning map of object handles.
std::shared_ptr< ManagedType > mapped_type
virtual key_type insert_in_core(mapped_type const &obj_ptr)=0
virtual void erase_in_core(key_type const &key)=0
ObjectContainer< ObjectMap, ManagedType, BaseType > Base
void clear()
Clear the map.
key_type get_key(Variant const &key) const
void erase(key_type const &key)
Removes all occurrences of an element from the map.
std::unordered_map< key_type, mapped_type > container_type
void do_construct(VariantMap const ¶ms) override=0
auto const & elements() const
Map elements.
virtual void insert_in_core(key_type const &key, mapped_type const &obj_ptr)=0
void restore_from_checkpoint(VariantMap const ¶ms)
key_type insert(mapped_type const &element)
Add an element to the map.
Variant do_call_method(std::string const &method, VariantMap const ¶meters) override
void insert(key_type const &key, mapped_type const &element)
Add an element to the map.
std::conditional_t< std::is_same_v< BaseType, ObjectHandle >, AutoParameters< Container< ManagedType, BaseType >, BaseType >, BaseType > ObjectContainer
Base class for containers whose BaseType might be a full specialization of AutoParameters.
T get_value(Variant const &v)
Extract value of specific type T from a Variant.
std::unordered_map< std::string, Variant > VariantMap
auto make_unordered_map_of_variants(std::unordered_map< K, V > const &v)
constexpr const None none
None-"literal".
static SteepestDescentParameters params
Currently active steepest descent instance.
static constexpr const ReadOnly read_only
Recursive variant implementation.