NEURON
mechanism_data.hpp
Go to the documentation of this file.
1 #pragma once
4 
5 #include <string_view>
6 
8 /**
9  * @brief Underlying storage for all instances of a particular Mechanism.
10  *
11  * To mitigate Python wheel ABI issues, a basic set of methods are defined in .cpp code that is
12  * compiled as part of NEURON.
13  */
14 struct storage: soa<storage, field::FloatingPoint> {
16  // Defined in .cpp to avoid instantiating base_type constructors too often.
17  storage(short mech_type, std::string name, std::vector<Variable> floating_point_fields = {});
18  /**
19  * @brief Access floating point values.
20  */
21  [[nodiscard]] double& fpfield(std::size_t instance, int field, int array_index = 0);
22  /**
23  * @brief Access floating point values.
24  */
25  [[nodiscard]] double const& fpfield(std::size_t instance, int field, int array_index = 0) const;
26  /**
27  * @brief Access floating point values.
28  */
30  int field,
31  int array_index = 0);
32  /**
33  * @brief The name of this mechanism.
34  */
35  [[nodiscard]] std::string_view name() const;
36  /**
37  * @brief The type of this mechanism.
38  */
39  [[nodiscard]] short type() const;
40  /**
41  * @brief Pretty printing for mechanism data structures.
42  */
43  friend std::ostream& operator<<(std::ostream& os, storage const& data);
44 
45  private:
46  short m_mech_type{};
47  std::string m_mech_name{};
48 };
49 
50 /**
51  * @brief Non-owning handle to a Mechanism instance.
52  */
54 
55 /**
56  * @brief Owning handle to a Mechanism instance.
57  */
59 } // namespace neuron::container::Mechanism
mech_type
Base class defining the public API of Mechanism handles.
Definition: mechanism.hpp:71
Underlying storage for all instances of a particular Mechanism.
friend std::ostream & operator<<(std::ostream &os, storage const &data)
Pretty printing for mechanism data structures.
Definition: container.cpp:119
storage(short mech_type, std::string name, std::vector< Variable > floating_point_fields={})
Definition: container.cpp:98
std::string_view name() const
The name of this mechanism.
Definition: container.cpp:113
short type() const
The type of this mechanism.
Definition: container.cpp:116
double & fpfield(std::size_t instance, int field, int array_index=0)
Access floating point values.
Definition: container.cpp:102
data_handle< double > fpfield_handle(non_owning_identifier_without_container id, int field, int array_index=0)
Access floating point values.
Definition: container.cpp:108
A non-owning permutation-stable identifier for an entry in a container.
Utility for generating SOA data structures.