chrono::ChCheckpointReader Class Reference

Description

Reader for a block of checkpoint data written with a ChCheckpointWriter.

Every read checks the type of the next entry and throws a std::runtime_error on a mismatch or if the block has no more data, so that a checkpoint that does not match the system fails loudly.

#include <ChCheckpointBlock.h>

Public Member Functions

 ChCheckpointReader (std::vector< ChCheckpointEntry > entries)
 
void Read (double &value)
 Read a number.
 
template<typename T , typename std::enable_if< std::is_integral< T >::value, int >::type = 0>
void Read (T &value)
 Read an integral number.
 
void Read (ChVector3d &v)
 Read a 3D vector.
 
void Read (ChQuaterniond &q)
 Read a quaternion.
 
void Read (std::vector< double > &v)
 Read a vector of numbers. The vector is resized as needed.
 
template<typename Derived >
void Read (Eigen::PlainObjectBase< Derived > &m)
 Read an Eigen matrix or vector. More...
 
void ReadBytes (std::vector< std::uint8_t > &bytes)
 Read an opaque sequence of bytes.
 
void Read (ChCheckpointReader &block)
 Read a nested block.
 
void ReadIndexedBlocks (size_t n, const std::function< void(size_t, ChCheckpointReader &)> &load)
 Read blocks written with ChCheckpointWriter::WriteIndexedBlocks, passing each one to the provided function. More...
 
bool IsAtEnd () const
 Return true if all data in this block was read.
 
void CheckAtEnd () const
 Throw if not all data in this block was read.
 

Member Function Documentation

◆ Read()

template<typename Derived >
void chrono::ChCheckpointReader::Read ( Eigen::PlainObjectBase< Derived > &  m)
inline

Read an Eigen matrix or vector.

A dynamic-size object is resized as needed; a fixed-size object must have the stored dimensions.

◆ ReadIndexedBlocks()

void chrono::ChCheckpointReader::ReadIndexedBlocks ( size_t  n,
const std::function< void(size_t, ChCheckpointReader &)> &  load 
)

Read blocks written with ChCheckpointWriter::WriteIndexedBlocks, passing each one to the provided function.

Throws if a stored index is not in [0,n) or if the function does not consume its entire block.


The documentation for this class was generated from the following files:
  • /builds/uwsbel/chrono/src/chrono/input_output/ChCheckpointBlock.h
  • /builds/uwsbel/chrono/src/chrono/input_output/ChCheckpointBlock.cpp