PulseView  0.3.0
A Qt-based sigrok GUI
pv::util Namespace Reference

Typedefs

typedef boost::multiprecision::number< boost::multiprecision::cpp_dec_float< 24 >, boost::multiprecision::et_off > Timestamp
 Timestamp type providing yoctosecond resolution. More...
 

Enumerations

enum  TimeUnit { TimeUnit::Time = 1, TimeUnit::Samples = 2 }
 
enum  SIPrefix {
  SIPrefix::unspecified = -1, SIPrefix::yocto, SIPrefix::zepto, SIPrefix::atto,
  SIPrefix::femto, SIPrefix::pico, SIPrefix::nano, SIPrefix::micro,
  SIPrefix::milli, SIPrefix::none, SIPrefix::kilo, SIPrefix::mega,
  SIPrefix::giga, SIPrefix::tera, SIPrefix::peta, SIPrefix::exa,
  SIPrefix::zetta, SIPrefix::yotta
}
 

Functions

static QTextStream & operator<< (QTextStream &stream, SIPrefix prefix)
 
int exponent (SIPrefix prefix)
 Returns the exponent that corresponds to a given prefix. More...
 
static SIPrefix successor (SIPrefix prefix)
 
static QTextStream & operator<< (QTextStream &stream, const Timestamp &t)
 
QString format_time_si (const Timestamp &v, SIPrefix prefix, unsigned int precision, QString unit, bool sign)
 
QString format_time_si_adjusted (const Timestamp &t, SIPrefix prefix, unsigned precision, QString unit, bool sign)
 
static QString pad_number (unsigned int number, int length)
 
QString format_time_minutes (const Timestamp &t, signed precision, bool sign)
 
QString format_time_si (const Timestamp &t, SIPrefix prefix=SIPrefix::unspecified, unsigned precision=0, QString unit="s", bool sign=true)
 

Typedef Documentation

typedef boost::multiprecision::number< boost::multiprecision::cpp_dec_float<24>, boost::multiprecision::et_off> pv::util::Timestamp

Timestamp type providing yoctosecond resolution.

Definition at line 58 of file util.hpp.

Enumeration Type Documentation

enum pv::util::SIPrefix
strong
Enumerator
unspecified 
yocto 
zepto 
atto 
femto 
pico 
nano 
micro 
milli 
none 
kilo 
mega 
giga 
tera 
peta 
exa 
zetta 
yotta 

Definition at line 41 of file util.hpp.

enum pv::util::TimeUnit
strong
Enumerator
Time 
Samples 

Definition at line 36 of file util.hpp.

Function Documentation

int pv::util::exponent ( SIPrefix  prefix)

Returns the exponent that corresponds to a given prefix.

Definition at line 62 of file util.cpp.

Here is the caller graph for this function:

QString pv::util::format_time_minutes ( const Timestamp t,
signed  precision = 0,
bool  sign = true 
)

Formats the given timestamp using "[+-]DD:HH:MM:SS.mmm uuu nnn ppp..." format.

"DD" and "HH" are left out if they would be "00" (but if "DD" is generated, "HH" is also always generated. The "MM:SS" part is always produced, the number of subsecond digits can be influenced using the 'precision' parameter.

Parameters
tThe value to format.
precisionThe number of digits after the decimal separator.
signWhether or not to add a sign also for positive numbers.
Returns
The formatted value.

Definition at line 174 of file util.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

QString pv::util::format_time_si ( const Timestamp t,
SIPrefix  prefix = SIPrefix::unspecified,
unsigned  precision = 0,
QString  unit = "s",
bool  sign = true 
)

Formats a given timestamp with the specified SI prefix.

If 'prefix' is left 'unspecified', the function chooses a prefix so that the value in front of the decimal point is between 1 and 999.

The default value "s" for the unit argument makes the most sense when formatting time values, but a different value can be given if the function is reused to format a value of another quantity.

Parameters
tThe value to format.
prefixThe SI prefix to use.
precisionThe number of digits after the decimal separator.
unitThe unit of quantity.
signWhether or not to add a sign also for positive numbers.
Returns
The formatted value.
QString pv::util::format_time_si ( const Timestamp v,
SIPrefix  prefix,
unsigned int  precision,
QString  unit,
bool  sign 
)

Definition at line 107 of file util.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

QString pv::util::format_time_si_adjusted ( const Timestamp t,
SIPrefix  prefix,
unsigned  precision = 0,
QString  unit = "s",
bool  sign = true 
)

Wrapper around 'format_time_si()' that interprets the given 'precision' value as the number of decimal places if the timestamp would be formatted without a SI prefix (using 'SIPrefix::none') and adjusts the precision to match the given 'prefix'

Parameters
tThe value to format.
prefixThe SI prefix to use.
precisionThe number of digits after the decimal separator if the 'prefix' would be 'SIPrefix::none', see above for more information.
unitThe unit of quantity.
signWhether or not to add a sign also for positive numbers.
Returns
The formatted value.

Definition at line 149 of file util.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

static QTextStream& pv::util::operator<< ( QTextStream &  stream,
SIPrefix  prefix 
)
static

Definition at line 38 of file util.cpp.

static QTextStream& pv::util::operator<< ( QTextStream &  stream,
const Timestamp t 
)
static

Definition at line 75 of file util.cpp.

static QString pv::util::pad_number ( unsigned int  number,
int  length 
)
static

Definition at line 169 of file util.cpp.

Here is the caller graph for this function:

static SIPrefix pv::util::successor ( SIPrefix  prefix)
static

Definition at line 67 of file util.cpp.

Here is the caller graph for this function: