Stan Math Library
5.0.0
Automatic Differentiation
|
Container for locally cached data which is essentially implemented as singleton.
That is, the static data is labelled by the user with call_id which forms a type in the program. As we have to associate multiple data items with a given call_id the member integer is used to allow for multiple items per call_id. Think of this as a singleton per static data.
The singleton must be initialized with data once using the store method. After calling the store method the state of the object is valid and the data can be read using the data function which returns a const reference to the data.
call_id | label of static data defined by the user |
member | labels a specific data item for the call_id context |
T | the type of the object stored |
Definition at line 41 of file mpi_parallel_call.hpp.
#include <mpi_parallel_call.hpp>
Public Types | |
using | cache_t = const T |
Public Member Functions | |
mpi_parallel_call_cache ()=delete | |
mpi_parallel_call_cache (const mpi_parallel_call_cache< call_id, member, T > &)=delete | |
mpi_parallel_call_cache & | operator= (const mpi_parallel_call_cache< call_id, member, T > &)=delete |
Static Public Member Functions | |
static bool | is_valid () |
Query if cache is in valid which it is once data has been stored. | |
static void | store (const T &data) |
Store data to be cached locally. | |
static cache_t & | data () |
Obtain const reference to locally cached data if cache is valid (throws otherwise). | |
Static Private Attributes | |
static T | local_ |
static bool | is_valid_ = false |