Celeritas
0.5.0-86+4a8eea4
|
Helper class for storing parameters and multiple stream-dependent states. More...
#include <StreamStore.hh>
Public Types | |
Type aliases | |
using | ParamsHostVal = P< Ownership::value, MemSpace::host > |
Public Member Functions | |
StreamStore (ParamsHostVal &&host, StreamId::size_type num_streams) | |
Construct with parameters and the number of streams. More... | |
operator bool () const | |
Whether the instance is ready for storing data. | |
StreamId::size_type | num_streams () const |
Number of streams being stored. | |
template<MemSpace M> | |
P< Ownership::const_reference, M > const & | params () const |
Get a reference to the params data. | |
template<MemSpace M> | |
S< Ownership::reference, M > & | state (StreamId stream_id, size_type size) |
Get a reference to the state data, allocating if necessary. | |
template<MemSpace M> | |
S< Ownership::reference, M > const * | state (StreamId stream_id) const |
Get a pointer to the state data, null if not allocated. | |
template<MemSpace M> | |
S< Ownership::reference, M > * | state (StreamId stream_id) |
Get a mutable pointer to the state data, null if not allocated. | |
Helper class for storing parameters and multiple stream-dependent states.
This requires a templated ParamsData and StateData. Hopefully this frankenstein of a class will be replaced by a std::any-like data container owned by each (possibly thread-local) State.
Usage:
There is some additional complexity in the "state" accessors to allow for const correctness.
|
inline |
Construct with parameters and the number of streams.
The constructor is not thread safe and should be called during params setup, not at run time.