11 void invalidate_cache() {
27 [](
void* ptr) { operator delete[](ptr); });
37 if (
auto maybe_info = mech_data->find_container_info(cont); maybe_info) {
63 os <<
"generic_data_handle{";
66 auto*
const container_data = *
static_cast<void**
>(dh.
m_container);
69 if (!maybe_info->container().empty()) {
70 os <<
"cont=" << maybe_info->container() <<
' ';
72 os << maybe_info->field() <<
' ' << dh.
m_offset <<
'/' << maybe_info->size();
76 os <<
"cont=" << (container_data ?
"unknown " :
"deleted ") << dh.
m_offset
90 return os <<
" type=" << dh.
type_name() <<
'}';
103 return get_field_instance<field::FloatingPoint>(instance,
field, array_index);
106 return get_field_instance<field::FloatingPoint>(instance,
field, array_index);
111 return get_field_instance_handle<field::FloatingPoint>(
id,
field, array_index);
120 return os <<
data.name() <<
"::storage{type=" <<
data.type() <<
", "
138 if (
auto h = mech_data.find_data_handle(gdh); h.refers_to_a_modern_data_structure()) {
void move(Item *q1, Item *q2, Item *q3)
std::optional< Model > model
std::ostream & operator<<(std::ostream &os, storage const &data)
std::vector< void * > * defer_delete_storage
Defer deleting pointers to deallocated memory.
generic_data_handle promote_or_clear(generic_data_handle)
Try and promote a generic_data_handle wrapping a raw pointer.
std::unique_ptr< storage_info > find_container_info(void const *)
Try and find a helpful name for a container.
std::ostream & operator<<(std::ostream &os, generic_data_handle const &dh)
In mechanism libraries, cannot use auto const token = nrn_ensure_model_data_are_sorted(); because the...
Model & model()
Access the global Model instance.
static double done(void *v)
std::unique_ptr< container::utils::storage_info > find_container_info(void const *cont) const
Find some metadata about the given container.
std::vector< void * > m_ptrs_for_deferred_deletion
Backing storage for defer_delete helper.
void set_unsorted_callback(container::Mechanism::storage &mech_data)
std::vector< std::unique_ptr< container::Mechanism::storage > > m_mech_data
Storage for mechanism-specific data.
container::Node::storage m_node_data
One structure for all Nodes.
void apply_to_mechanisms(Callable const &callable)
Apply a function to each non-null Mechanism.
container::Node::storage & node_data()
Access the structure containing the data of all Nodes.
Catch-all for floating point per-instance variables in the MOD file.
Underlying storage for all instances of a particular Mechanism.
storage(short mech_type, std::string name, std::vector< Variable > floating_point_fields={})
std::string_view name() const
The name of this mechanism.
short type() const
The type of this mechanism.
double & fpfield(std::size_t instance, int field, int array_index=0)
Access floating point values.
data_handle< double > fpfield_handle(non_owning_identifier_without_container id, int field, int array_index=0)
Access floating point values.
Non-template stable handle to a generic value.
bool refers_to_a_modern_data_structure() const
Check if this handle contains a data_handle<T> or just a literal.
non_owning_identifier_without_container m_offset
std::string type_name() const
Return the demangled name of the type this handle refers to.
A non-owning permutation-stable identifier for an entry in a container.
bool has_always_been_null() const
Has the identifier always been null.
void set_unsorted_callback(std::function< void()> unsorted_callback)
Set the callback that is invoked when the container becomes unsorted.
neuron::container::generic_data_handle find_data_handle(neuron::container::generic_data_handle input_handle) const
Return a permutation-stable handle if ptr is inside us.
std::unique_ptr< utils::storage_info > find_container_info(void const *cont) const
Check if cont refers to a field in this container.