Lumiera  0.pre.03
»edit your freedom«
Digxel< NUM, FMT > Class Template Reference

#include "lib/time/digxel.hpp"

Description

template<typename NUM, class FMT = digxel::Formatter<NUM>>
class lib::time::Digxel< NUM, FMT >

A number element for building structured numeric displays.

The purpose is to represent parts of a numeric format, like e.g. the sexagesimal "digits" of a timecode display. A Digxel

  • is customised by template parameters to a specific number format
  • requires that any given number must not overflow the format buffer
  • can receive new numbers by assignment
  • stores and these given value numerically
  • will then format these numbers and cache the formatted representation
  • can store and invoke a mutation functor to pre-process values on setting
Note
comparisons are assumed to be not performance relevant
Parameters
NUMnumeric type to be used for the value
FMTa formatter and buffer holder type
See also
digxel::Formatter default printf based formatter
lib::time::TCode
Digxel_test

Definition at line 226 of file digxel.hpp.

Public Member Functions

template<typename FUN , class THIS >
void installMutator (FUN mutate, THIS &self)
 install an external functor to be applied on any new digxel value. More...
 
size_t maxlen () const
 
 operator NUM () const
 
 operator string () const
 
Digxeloperator++ ()
 
NUM operator++ (int)
 
Digxeloperator+= (NUM inc)
 
Digxeloperator-- ()
 
NUM operator-- (int)
 
Digxeloperator-= (NUM dec)
 
bool operator< (Digxel const &o) const
 
void operator= (NUM n)
 
bool operator== (Digxel const &o) const
 
void setValueRaw (NUM newVal)
 
digxel::CBuf show () const
 

Private Types

typedef Digxel< NUM, FMT > _Digxel
 
typedef function< void(NUM)> _Mutator
 

Private Attributes

FMT buffer_
 
_Mutator mutator
 Functor for setting a new digxel value.
 
NUM value_
 

Member Function Documentation

◆ installMutator()

void installMutator ( FUN  mutate,
THIS &  self 
)
inline

install an external functor to be applied on any new digxel value.

This allows individual instances to limit the possible digxel values, or to update an compound value (e.g. a time comprised of hour, minute and second digxel elements). The installed functor needs to accept a "this" pointer and actually perform any desired state change as sideeffect. The default is to accept any value as-is.

Warning
using a mutator creates significant overhead; measurements indicate a factor of 4
See also
Digxel_test

Definition at line 252 of file digxel.hpp.

Referenced by lib::time::anonymous_namespace{timecode.cpp}::setupComponentNormalisation().

+ Here is the caller graph for this function:
+ Inheritance diagram for Digxel< NUM, FMT >:
+ Collaboration diagram for Digxel< NUM, FMT >:

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