https://mooseframework.inl.gov
Classes | Functions
UniqueStorage.h File Reference

Go to the source code of this file.

Classes

class  UniqueStorage< T >
 Storage container that stores a vector of unique pointers of T, but represents most of the public facing accessors (iterators, operator[]) as a vector of T. More...
 
class  UniqueStorage< T >
 Storage container that stores a vector of unique pointers of T, but represents most of the public facing accessors (iterators, operator[]) as a vector of T. More...
 
struct  UniqueStorage< T >::DereferenceIterator< BaseIterator >
 Iterator that adds an additional dereference to BaseIterator. More...
 

Functions

template<typename T >
void storeHelper (std::ostream &stream, UniqueStorage< T > &, void *)
 UniqueStorage helper routine. More...
 
template<typename T >
void loadHelper (std::istream &stream, UniqueStorage< T > &, void *)
 UniqueStorage helper routine. More...
 

Function Documentation

◆ loadHelper()

template<typename T >
void loadHelper ( std::istream &  stream,
UniqueStorage< T > &  data,
void context 
)
inline

UniqueStorage helper routine.

UniqueStorage Helper Function.

The unique_ptr<T> loader is called to load the data. That is, you will likely need a specialization of unique_ptr<T> that will appropriately construct and then fill the piece of data.

Definition at line 1088 of file DataIO.h.

1089 {
1090  std::size_t size;
1091  dataLoad(stream, size, nullptr);
1092  data.resize(size);
1093 
1094  for (const auto i : index_range(data))
1095  loadHelper(stream, data.pointerValue(i), context);
1096 }
const std::unique_ptr< T > & pointerValue(const std::size_t i) const
Returns a read-only reference to the underlying unique pointer at index i.
void resize(const std::size_t size)
Resizes the underlying vector.
void dataLoad(std::istream &stream, T &v, void *)
Definition: DataIO.h:551
void loadHelper(std::istream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:1010
auto index_range(const T &sizable)

◆ storeHelper()

template<typename T >
void storeHelper ( std::ostream &  stream,
UniqueStorage< T > &  data,
void context 
)
inline

UniqueStorage helper routine.

The data within the UniqueStorage object cannot be null. The helper for unique_ptr<T> is called to store the data.

Definition at line 995 of file DataIO.h.

996 {
997  std::size_t size = data.size();
998  dataStore(stream, size, nullptr);
999 
1000  for (const auto i : index_range(data))
1001  {
1002  mooseAssert(data.hasValue(i), "Data doesn't have a value");
1003  storeHelper(stream, data.pointerValue(i), context);
1004  }
1005 }
const std::unique_ptr< T > & pointerValue(const std::size_t i) const
Returns a read-only reference to the underlying unique pointer at index i.
std::size_t size() const
void storeHelper(std::ostream &stream, P &data, void *context)
Scalar helper routine.
Definition: DataIO.h:918
void dataStore(std::ostream &stream, T &v, void *)
Definition: DataIO.h:183
bool hasValue(const std::size_t i) const
auto index_range(const T &sizable)