Template Class NumericVar#
Defined in File NumericVar.h
Inheritance Relationships#
Base Type#
public Karana::Core::VarBase(Class VarBase)
Derived Type#
public Karana::Core::Var< T, quantity >(Template Class Var)
Class Documentation#
-
template<typename T>
class NumericVar : public Karana::Core::VarBase# Numeric interface shared by Vars with the same value type.
- Template Parameters:
T – The type of data the Var holds.
Subclassed by Karana::Core::Var< T, quantity >
Public Functions
-
inline T operator()() const#
Return the value that the Var contains.
- Returns:
The value that the Var contains.
-
inline std::function<T()> getPlottingFunction() const#
Return the plotting function associated with this Var.
- Returns:
The plotting function associated with this Var.
-
inline std::function<void(char*)> getLoggingFunction() const#
Return the logging function associated with this Var.
- Returns:
The logging function associated with this Var.
-
inline size_t getSize() const#
Get the size in bytes for this Var.
- Returns:
The size in bytes for this Var.
-
inline int getVectorSize() const#
Get the size of the vector that this Var holds.
- Returns:
The size of the vector that this Var holds.
-
inline const std::pair<int, int> &getMatrixSize() const#
Get the size of the matrix that this Var holds.
- Returns:
The size of the matrix that this Var holds.
Protected Functions
-
inline NumericVar(std::string_view name, const NumericVar<T> &other, std::string_view description)#
Rename NumericVar constructor for NumericVar<T>.
- Parameters:
name – The name of the NumericVar<T>
other – The NumericVar<T> to copy the callable and units from.
description – A description of the Var.
-
template<class F>
inline NumericVar(std::string_view name, const F &f, int vector_size, std::string_view description, std::string_view units = "")# NumericVar constructor for NumericVar<km::Vec>.
- Template Parameters:
F – Templated callable type that produces km::Vec.
- Parameters:
name – The name of the NumericVar<km::Vec>
f – The callable that produces km::Vec.
vector_size – The size of the km::Vec that the callable produces. This must always be the same size.
description – A description of the Var.
units – The units of the Var.
-
template<class F>
inline NumericVar(std::string_view name, const F &f, int vector_size, std::string_view description, std::string_view units = "") NumericVar constructor for NumericVar<km::VecInt>.
- Template Parameters:
F – Templated callable type that produces km::VecInt.
- Parameters:
name – The name of the NumericVar<km::VecInt>
f – The callable that produces km::VecInt.
vector_size – The size of the km::VecInt that the callable produces. This must always be the same size.
description – A description of the Var.
units – The units of the Var.
-
template<class F>
inline NumericVar(std::string_view name, const F &f, int matrix_rows, int matrix_cols, std::string_view description, std::string_view units = "")# NumericVar constructor for NumericVar<km::Mat>.
- Template Parameters:
F – Templated callable type that produces km::Mat.
- Parameters:
name – The name of the NumericVar<km::Mat>
f – The callable that produces km::Mat.
matrix_rows – The number of rows in the km::Mat that the callable produces. The matrix that the callable produces must always be the same size.
matrix_cols – The number of cols in the km::Mat that the callable produces. The matrix that the callable produces must always be the same size.
description – A description of the Var.
units – The units of the Var.
-
template<class F>
inline NumericVar(std::string_view name, const F &f, std::string_view description, std::string_view units = "")# NumericVar constructor for NumericVar<T>. The constructor is not meant to be called directly. Use Var<T>::create(…) to create a concrete Var instead.
Protected Attributes
-
std::function<void(char *buf)> _logging_fn#
The logging function associated with the Var.
This takes runs the _fn, converts it to bytes, and copies the bytes into the provided buffer.
-
int _vector_size = 0#
The vector size for NumericVar<km::Vec>.
-
std::pair<int, int> _matrix_size = {0, 0}#
The matrix size for NumericVar<km::Mat>.