![]() |
NEURON
|
Base class for neuron::container::soa<...> handles. More...
#include <view_utils.hpp>
Public Member Functions | |
handle_base (Identifier identifier) | |
Construct a handle from an identifier. More... | |
std::size_t | current_row () const |
Return current offset in the underlying storage where this object lives. More... | |
non_owning_identifier_without_container | id () const |
Obtain a lightweight identifier of the current entry. More... | |
auto | id_hack () const |
This is a workaround for id sometimes being a macro. More... | |
auto & | underlying_storage () |
Obtain a reference to the storage this handle refers to. More... | |
auto const & | underlying_storage () const |
Obtain a const reference to the storage this handle refers to. More... | |
Protected Member Functions | |
template<typename Tag > | |
auto | get_handle () |
Get a data_handle<T> referring to the given field inside this handle. More... | |
template<typename Tag > | |
auto | get_handle (int field_index, int array_offset=0) |
Get a data_handle<T> referring to the (runtime) field_index-th copy of a given (static) field. More... | |
template<typename Tag > | |
auto & | get () |
template<typename Tag > | |
auto const & | get () const |
template<typename Tag > | |
constexpr Tag const & | get_tag () const |
Get the instance of the given tag type from underlying storage. More... | |
template<typename Tag > | |
auto & | get (int field_index, int array_offset=0) |
template<typename Tag > | |
auto const & | get (int field_index, int array_offset=0) const |
Private Attributes | |
Identifier | m_identifier |
Base class for neuron::container::soa<...> handles.
Identifier | Identifier type used for this handle. This encodes both the referred-to type (Node, Mechanism, ...) and the ownership semantics (owning, non-owning). The instance of this type manages both the pointer-to-row and pointer-to-storage members of the handle. |
This provides some common methods that are neither specific to a particular data structure (Node, Mechanism, ...) nor specific to whether or not the handle has owning semantics or not. Methods that are specific to the data type (e.g. Node) belong in the interface template for that type (e.g. Node::interface). Methods that are specific to the owning/non-owning semantics belong in the generic templates non_owning_identifier<T> and owning_identifier<T>.
The typical way these components fit together is:
Node::identifier = non_owning_identifier<Node::storage> Node::owning_identifier = owning_identifier<Node::storage> Node::handle = Node::interface<Node::identifier> inherits from: handle_base<Node::identifier> Node::owning_handle = Node::interface<Node::owning_identifier> inherits from handle_base<Node::owning_identifier>
Where the "identifier" types should be viewed as an implementation detail and the handle types as user-facing.
Definition at line 34 of file view_utils.hpp.
|
inline |
Construct a handle from an identifier.
Definition at line 38 of file view_utils.hpp.
|
inline |
Return current offset in the underlying storage where this object lives.
Definition at line 44 of file view_utils.hpp.
|
inlineprotected |
Definition at line 111 of file view_utils.hpp.
|
inlineprotected |
Definition at line 115 of file view_utils.hpp.
|
inlineprotected |
Definition at line 132 of file view_utils.hpp.
|
inlineprotected |
Definition at line 138 of file view_utils.hpp.
|
inlineprotected |
Get a data_handle<T> referring to the given field inside this handle.
Tag | Tag type of the field we want a data_handle to. |
This is used to implement methods like area_handle() and v_handle() in the interface templates.
Definition at line 92 of file view_utils.hpp.
|
inlineprotected |
Get a data_handle<T> referring to the (runtime) field_index-th copy of a given (static) field.
Tag | Tag type of the set of fields the from which the field_index-th one is being requested. |
Definition at line 105 of file view_utils.hpp.
|
inlineconstexprprotected |
Get the instance of the given tag type from underlying storage.
Tag | The tag type. |
This is a thin wrapper that calls soa::get_tag<Tag>
on the storage container (currently an instance of Node::storage
or Mechanism::storage
) that this handle refers to an instance inside.
Definition at line 128 of file view_utils.hpp.
|
inline |
Obtain a lightweight identifier of the current entry.
The return type is essentially std::size_t* – it does not contain a pointer/reference to the actual storage container.
Definition at line 54 of file view_utils.hpp.
|
inline |
This is a workaround for id sometimes being a macro.
Definition at line 62 of file view_utils.hpp.
|
inline |
Obtain a reference to the storage this handle refers to.
Definition at line 69 of file view_utils.hpp.
|
inline |
Obtain a const reference to the storage this handle refers to.
Definition at line 76 of file view_utils.hpp.
|
private |
Definition at line 145 of file view_utils.hpp.