ACTS
Experiment-independent tracking
Loading...
Searching...
No Matches
detray::bins::dynamic_array< entry_t > Class Template Reference

Bin that views a collection of entries it does not own. More...

#include <detray/utils/grid/grid_bins.hpp>

Inheritance diagram for detray::bins::dynamic_array< entry_t >:
[legend]
Collaboration diagram for detray::bins::dynamic_array< entry_t >:
[legend]

Classes

struct  data
 Metadata describing one bin's range in shared storage. More...

Public Types

using data_ptr_t = const data*
 Pointer type used to view shared bin metadata.
using entry_ptr_t = const entry_type*
 Pointer type used to view entries in shared storage.
using entry_type = entry_t
 Type stored in each bin.

Public Member Functions

constexpr dynamic_array ()
 Default constructor initializer the bin with an invalid value.
 dynamic_array (const entry_type *bin_storage, const data &bin_data)
 Construct from an externally owned container of bin content.
 dynamic_array (entry_type *bin_storage, data &bin_data)
 Construct from an externally owned container of bin content.
constexpr dindex capacity () const noexcept
template<typename storage_t>
constexpr auto init (const storage_t &content) -> dynamic_array &
 Initialize from an entire bin content content.
constexpr auto init (entry_type entry=detail::invalid_value< entry_type >()) -> dynamic_array &
constexpr bool operator== (const dynamic_array &rhs) const
 Equality operator.
template<typename E = entry_type>
constexpr void push_back (E &&entry)
 Add a new entry to the bin.
constexpr dindex size () const
auto begin ()
 Returns an iterator to the first entry in this bin.
auto end ()
 Returns an iterator one past the last valid entry.
auto begin () const
 Returns a const iterator to the first entry in this bin.
auto end () const
 Returns a const iterator one past the last valid entry.
Public Member Functions inherited from detray::ranges::view_interface< dynamic_array< entry_t > >
constexpr decltype(auto) back () const
 Return a reference to the last element.
constexpr auto data () const
 Return a pointer to the first element, or null for an empty view.
constexpr auto empty () const -> bool
 Check whether the view contains no elements.
constexpr decltype(auto) front () const
 Return a reference to the first element.
constexpr operator bool () const
 Test whether the view contains at least one element.
constexpr decltype(auto) operator[] (const dindex i) const
 Subscript operator that takes detray dindex.
constexpr auto size () const
 Return the number of elements in the view.

Detailed Description

template<typename entry_t>
class detray::bins::dynamic_array< entry_t >

Bin that views a collection of entries it does not own.

Used if the bin capacity is not static.

Constructor & Destructor Documentation

◆ dynamic_array() [1/2]

template<typename entry_t>
detray::bins::dynamic_array< entry_t >::dynamic_array ( entry_type * bin_storage,
data & bin_data )

Construct from an externally owned container of bin content.

Parameters
bin_storageand access to an offset, size and capacity in
bin_data

◆ dynamic_array() [2/2]

template<typename entry_t>
detray::bins::dynamic_array< entry_t >::dynamic_array ( const entry_type * bin_storage,
const data & bin_data )

Construct from an externally owned container of bin content.

Parameters
bin_storageand access to an offset, size and capacity in
bin_data- const

Member Function Documentation

◆ begin() [1/2]

template<typename entry_t>
auto detray::bins::dynamic_array< entry_t >::begin ( )

Returns an iterator to the first entry in this bin.

Returns
view iterator over bin content in start or end position

◆ begin() [2/2]

template<typename entry_t>
auto detray::bins::dynamic_array< entry_t >::begin ( ) const

Returns a const iterator to the first entry in this bin.

Returns
Const iterator to the first entry.

◆ capacity()

template<typename entry_t>
dindex detray::bins::dynamic_array< entry_t >::capacity ( ) const
constexprnoexcept
Returns
The storage capacity reserved for this bin.

◆ end() [1/2]

template<typename entry_t>
auto detray::bins::dynamic_array< entry_t >::end ( )

Returns an iterator one past the last valid entry.

Returns
Iterator past the last valid entry.

◆ end() [2/2]

template<typename entry_t>
auto detray::bins::dynamic_array< entry_t >::end ( ) const

Returns a const iterator one past the last valid entry.

Returns
Const iterator past the last valid entry.

◆ init() [1/2]

template<typename entry_t>
template<typename storage_t>
auto detray::bins::dynamic_array< entry_t >::init ( const storage_t & content) ->dynamic_array &
constexpr

Initialize from an entire bin content content.

Parameters
contentStorage indexed from zero with at least capacity entries; invalid sentinels are excluded from the resulting size.
Returns
Access to the initialized bin

◆ init() [2/2]

template<typename entry_t>
auto detray::bins::dynamic_array< entry_t >::init ( entry_type entry = detail::invalid_value<entry_type>()) ->dynamic_array &
constexpr
Parameters
entryInitial value; the invalid sentinel leaves the bin empty.
Note
The bin capacity has to be set correctly before calling this method
Returns
Access to an initialized bin in the backend storage

◆ operator==()

template<typename entry_t>
bool detray::bins::dynamic_array< entry_t >::operator== ( const dynamic_array< entry_t > & rhs) const
constexpr

Equality operator.

Parameters
rhsthe bin to be compared with
Returns
true if the view is identical

◆ push_back()

template<typename entry_t>
template<typename E = entry_type>
void detray::bins::dynamic_array< entry_t >::push_back ( E && entry)
constexpr

Add a new entry to the bin.

Parameters
entryValue to append.
Note
This does not check the state of the container it points to!!!

◆ size()

template<typename entry_t>
dindex detray::bins::dynamic_array< entry_t >::size ( ) const
constexpr
Returns
the number of entries in this bin - const