Automatic Differentiation
 
Loading...
Searching...
No Matches
stan::math::internal::mpi_parallel_call_cache< call_id, member, T > Class Template Reference

Detailed Description

template<int call_id, int member, typename T>
class stan::math::internal::mpi_parallel_call_cache< call_id, member, T >

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.

Template Parameters
call_idlabel of static data defined by the user
memberlabels a specific data item for the call_id context
Tthe 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_cacheoperator= (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_tdata ()
 Obtain const reference to locally cached data if cache is valid (throws otherwise).
 

Static Private Attributes

static T local_
 
static bool is_valid_ = false
 

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