Class PacketTableConfig#
Defined in File DataLogger.h
Inheritance Relationships#
Base Type#
public Karana::Core::LockingBase(Class LockingBase)
Class Documentation#
-
class PacketTableConfig : public Karana::Core::LockingBase#
Define the columns and associated update functions for a PacketTable. The PacketTable is the table that stores data in the H5 log file.
Public Functions
-
PacketTableConfig(std::string_view name)#
PacketTableConfig constructor. The constructor is not meant to be called directly. Please use the create(…) method instead to create an instance.
- Parameters:
name – Name of the table. A / will be interpreted as a new group. Groups will be added as needed.
-
~PacketTableConfig()#
Destroy packet table config.
-
inline void addData(const kc::ks_ptr<kc::Var_T<km::Vec>> &var, bool as_scalars = false)#
Add data to the table via a Var_T<km::Vec>.
- Parameters:
var – The Var_T<km::Vec> to add to the table.
as_scalars – Rather than using one column for the vector, use multiple. This logs each vector component as a scalar. The column names will be appended with a _X where “X” is an integer that corresponds with the index in the vector.
-
inline void addData(const kc::ks_ptr<kc::Var_T<km::Mat>> &var, bool as_scalars = false)#
Add data to the table via a Var_T<km::Mat>.
- Parameters:
var – The Var_T<km::Mat> to add to the table.
as_scalars – Rather than using one column for the vector, use multiple. This logs each vector component as a scalar. The column names will be appended with a _X where “X” is an integer that corresponds with the index in the vector.
-
template<int rows>
inline void addData(const kc::ks_ptr<kc::Var_T<Eigen::Matrix<double, rows, 1>>> &var, bool as_scalars = false)# Add data to the table via a vector-valued Var_T with fixed size, e.g., Var_T<km::Vec3>.
- Parameters:
var – The fixed-size, vector-valued Var_T to add to the table.
as_scalars – Rather than using one column for the vector, use multiple. This logs each vector component as a scalar. The column names will be appended with a _X where “X” is an integer that corresponds with the index in the vector.
-
template<int rows, int cols>
inline void addData(const kc::ks_ptr<kc::Var_T<Eigen::Matrix<double, rows, cols, Eigen::RowMajor>>> &var, bool as_scalars = false)# Add data to the table via a matrix-valued Var_T with fixed size, e.g., Var_T<km::Mat33>.
- Parameters:
var – The fixed-size, matrix-valued Var_T to add to the table.
as_scalars – Rather than using one column for the matrix, use multiple. This logs each matrix component as a scalar. The column names will be appended with a _X_Y where “X” and “Y” are integers that correspond with the row and index of the element in the matrix.
-
template<class T>
inline void addData(const kc::ks_ptr<kc::Var_T<T>> &var)# Add data to the table via a Var_T with loggable data.
- Parameters:
var – The Var_T to add to the table.
-
template<class T>
inline void addData(std::string_view name, const T &f, int vector_size, bool as_scalars = false)# Add data to the table via function.
- Parameters:
name – The name of the column in the table.
f – The function that produces the data (dynamic vector). This vector must always be the same size.
vector_size – The size of the vector that the function produces. This vector must always be the same size.
as_scalars – Rather than using one column for the vector, use multiple. This logs each vector component as a scalar. The column names will be appended with a _X where “X” is an integer that corresponds with the index in the vector.
-
template<class T>
inline void addData(std::string_view name, const T &f, int matrix_rows, int matrix_cols, bool as_scalars = false)# Add data to the table via function.
- Parameters:
name – The name of the column in the table.
f – The function that produces the data (dynamic matrix). This matrix must always be the same size.
matrix_rows – The number of rows in the matrix that the function produces. This matrix must always be the same size.
matrix_cols – The number of columns in the matrix that the function produces. This matrix must always be the same size.
as_scalars – Rather than using one column for the matrix, use multiple. This logs each matrix component as a scalar. The column names will be appended with a _X_Y where “X” and “Y” are integers that correspond with the row and index of the element in the matrix.
-
template<class T, class R = typename std::invoke_result<T>::type>
inline void addData(std::string_view name, const T &f, bool as_scalars = false)# Add data to the table via function.
- Parameters:
name – The name of the column in the table.
f – The function that produces the data.
as_scalars – Rather than using one column for the vector, use multiple. This logs each vector component as a scalar. The column names will be appended with a _X where “X” is an integer that corresponds with the index in the vector.
-
template<class T, class R = typename std::invoke_result<T>::type>
inline void addData(std::string_view name, const T &f, bool as_scalars = false) Add data to the table via function.
- Parameters:
name – The name of the column in the table.
f – The function that produces the data.
as_scalars – Rather than using one column for the matrix, use multiple. This logs each matrix component as a scalar. The column names will be appended with a _X_Y where “X” and “Y” are integers that correspond with the row and index of the element in the matrix.
-
template<class T, class R = typename std::invoke_result<T>::type>
inline void addData(std::string_view name, const T &f)# Add data to the table via function.
- Parameters:
name – The name of the column in the table.
f – The function that produces the data.
-
void fillBuf()#
Fill the buffer by calling all the functions.
Public Static Functions
-
static kc::ks_ptr<PacketTableConfig> create(std::string_view name)#
Create a packet table config.
- Parameters:
name – Name of the table. A / will be interpreted as a new group. Groups will be added as needed.
- Returns:
A ks_ptr to the newly created instance of PacketTableConfig.
Protected Functions
-
void _addVector(std::string_view name, int rows, bool as_scalars)#
Add a vector type to this PacketTableConfig.
- Parameters:
name – The name of the data to log.
rows – The number of rows the vector has.
as_scalars – Whether to add the vector as individual scalars or as one vector.
-
void _addMatrix(std::string_view name, int rows, int cols, bool as_scalars)#
Add a matrix type to this PacketTableConfig.
- Parameters:
name – The name of the data to log.
rows – The number of rows the matrix has.
cols – The number of cols the matrix has.
as_scalars – Whether to add the matrix as individual scalars or as one matrix.
-
virtual void _makeHealthy()#
Create the data type and buffer for the data. This can only be done once.
-
virtual void _makeNotHealthy()#
This should never be called. If it is, then there is an issue.
-
PacketTableConfig(std::string_view name)#