NEURON
neuron::container::non_owning_identifier_without_container Struct Reference

A non-owning permutation-stable identifier for an entry in a container. More...

#include <non_owning_soa_identifier.hpp>

Inheritance diagram for neuron::container::non_owning_identifier_without_container:
neuron::container::non_owning_identifier< Storage >

Public Member Functions

 non_owning_identifier_without_container ()=default
 Create a null identifier. More...
 
 non_owning_identifier_without_container (const non_owning_identifier_without_container &other)=default
 
 non_owning_identifier_without_container (non_owning_identifier_without_container &&other)=default
 
non_owning_identifier_without_containeroperator= (const non_owning_identifier_without_container &)=default
 
non_owning_identifier_without_containeroperator= (non_owning_identifier_without_container &&)=default
 
 ~non_owning_identifier_without_container ()=default
 
 operator bool () const
 Does the identifier refer to a valid entry? More...
 
std::size_t current_row () const
 What is the current row? More...
 
bool was_once_valid () const
 Did the identifier use to refer to a valid entry? More...
 
bool has_always_been_null () const
 Has the identifier always been null. More...
 

Protected Member Functions

 non_owning_identifier_without_container (std::shared_ptr< std::size_t > ptr)
 
void set_current_row (std::size_t row)
 
 non_owning_identifier_without_container (size_t row)
 

Private Attributes

std::shared_ptr< std::size_t > m_ptr {}
 

Friends

template<typename >
struct owning_identifier
 
template<typename , typename... >
struct soa
 
struct std::hash< non_owning_identifier_without_container >
 
std::ostream & operator<< (std::ostream &os, non_owning_identifier_without_container const &id)
 
bool operator== (non_owning_identifier_without_container lhs, non_owning_identifier_without_container rhs)
 Test if two handles are both null or refer to the same valid row. More...
 
bool operator!= (non_owning_identifier_without_container lhs, non_owning_identifier_without_container rhs)
 
bool operator< (non_owning_identifier_without_container lhs, non_owning_identifier_without_container rhs)
 

Detailed Description

A non-owning permutation-stable identifier for an entry in a container.

The container type is not specified. This is essentially a wrapper for std::size_t* that avoids using that naked type in too many places.

Definition at line 25 of file non_owning_soa_identifier.hpp.

Constructor & Destructor Documentation

◆ non_owning_identifier_without_container() [1/5]

neuron::container::non_owning_identifier_without_container::non_owning_identifier_without_container ( )
default

Create a null identifier.

◆ non_owning_identifier_without_container() [2/5]

neuron::container::non_owning_identifier_without_container::non_owning_identifier_without_container ( const non_owning_identifier_without_container other)
default

◆ non_owning_identifier_without_container() [3/5]

neuron::container::non_owning_identifier_without_container::non_owning_identifier_without_container ( non_owning_identifier_without_container &&  other)
default

◆ ~non_owning_identifier_without_container()

neuron::container::non_owning_identifier_without_container::~non_owning_identifier_without_container ( )
default

◆ non_owning_identifier_without_container() [4/5]

neuron::container::non_owning_identifier_without_container::non_owning_identifier_without_container ( std::shared_ptr< std::size_t >  ptr)
inlineexplicitprotected

Definition at line 122 of file non_owning_soa_identifier.hpp.

◆ non_owning_identifier_without_container() [5/5]

neuron::container::non_owning_identifier_without_container::non_owning_identifier_without_container ( size_t  row)
inlineexplicitprotected

Definition at line 129 of file non_owning_soa_identifier.hpp.

Member Function Documentation

◆ current_row()

std::size_t neuron::container::non_owning_identifier_without_container::current_row ( ) const
inline

What is the current row?

The returned value is invalidated by any deletions from the underlying container, and by any permutations of the underlying container.

Definition at line 61 of file non_owning_soa_identifier.hpp.

◆ has_always_been_null()

bool neuron::container::non_owning_identifier_without_container::has_always_been_null ( ) const
inline

Has the identifier always been null.

has_always_been_null() --> "null" !has_always_been_null && was_once_valid --> "died" !has_always_been_null && !was_once_valid --> "row=X"

Definition at line 82 of file non_owning_soa_identifier.hpp.

◆ operator bool()

neuron::container::non_owning_identifier_without_container::operator bool ( ) const
inlineexplicit

Does the identifier refer to a valid entry?

The row can be invalid because the identifier was always null, or it can have become invalid if the relevant entry was deleted after the identifier was created.

Definition at line 51 of file non_owning_soa_identifier.hpp.

◆ operator=() [1/2]

non_owning_identifier_without_container& neuron::container::non_owning_identifier_without_container::operator= ( const non_owning_identifier_without_container )
default

◆ operator=() [2/2]

non_owning_identifier_without_container& neuron::container::non_owning_identifier_without_container::operator= ( non_owning_identifier_without_container &&  )
default

◆ set_current_row()

void neuron::container::non_owning_identifier_without_container::set_current_row ( std::size_t  row)
inlineprotected

Definition at line 124 of file non_owning_soa_identifier.hpp.

◆ was_once_valid()

bool neuron::container::non_owning_identifier_without_container::was_once_valid ( ) const
inline

Did the identifier use to refer to a valid entry?

Definition at line 71 of file non_owning_soa_identifier.hpp.

Friends And Related Function Documentation

◆ operator!=

Definition at line 104 of file non_owning_soa_identifier.hpp.

◆ operator<

Definition at line 109 of file non_owning_soa_identifier.hpp.

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
non_owning_identifier_without_container const &  id 
)
friend

Definition at line 86 of file non_owning_soa_identifier.hpp.

◆ operator==

Test if two handles are both null or refer to the same valid row.

Definition at line 99 of file non_owning_soa_identifier.hpp.

◆ owning_identifier

template<typename >
friend struct owning_identifier
friend

Definition at line 117 of file non_owning_soa_identifier.hpp.

◆ soa

template<typename , typename... >
friend struct soa
friend

Definition at line 120 of file non_owning_soa_identifier.hpp.

◆ std::hash< non_owning_identifier_without_container >

friend struct std::hash< non_owning_identifier_without_container >
friend

Definition at line 120 of file non_owning_soa_identifier.hpp.

Member Data Documentation

◆ m_ptr

std::shared_ptr<std::size_t> neuron::container::non_owning_identifier_without_container::m_ptr {}
private

Definition at line 133 of file non_owning_soa_identifier.hpp.


The documentation for this struct was generated from the following file: