FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
ValuesDisplayBase Class Reference

Formats the lines Trawl/ValuesDisplay shows on the HUD, one per signal. More...

#include <ValuesDisplayBase.h>

Classes

struct  DisplayValue
 

Public Member Functions

 ValuesDisplayBase (std::vector< DisplayValue > valueSpec)
 
std::vector< std::string > FormatLines (const double *const vals) const
 
std::size_t NumLines () const
 

Detailed Description

Author
Karl-Johan Reite

Plain C++ with no Ogre dependency, so it is built and unit-tested in every configuration.

Revision history:
20.11.2013 KJR: Initial version. 26.09.2026: Formatting only; the text is drawn by fhsim::Hud (fhsim 3.3.0).

Constructor & Destructor Documentation

◆ ValuesDisplayBase()

ValuesDisplayBase::ValuesDisplayBase ( std::vector< DisplayValue >  valueSpec)
explicit

Stores how each signal is formatted.

Parameters
valueSpecOne entry per signal, in display order.

Member Function Documentation

◆ FormatLines()

std::vector< std::string > ValuesDisplayBase::FormatLines ( const double *const  vals) const

Formats one line per signal: "description value unit".

The value part is the signal's fmt format applied to its elements, each multiplied by the signal's multiplier; the unit and its leading space are left out when the unit is empty. Throws fmt::format_error when a format does not match its signal.

Parameters
valsAll signal elements, concatenated in signal order.
Returns
One line per signal, in the order given to the constructor.

◆ NumLines()

std::size_t ValuesDisplayBase::NumLines ( ) const
inline

Tells how many lines FormatLines() returns.

Returns
The number of signals.

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