SPH
Public Member Functions | Static Public Member Functions | Friends | List of all members
Unit Class Reference

Single benchmark unit. More...

#include <Session.h>

Public Member Functions

 Unit (const std::string &name, const Function func)
 
const std::string & getName () const
 
Expected< Resultrun (const Target target)
 
 Unit ()=default
 
 Unit (const Float &value, const UnitDimensions &dimensions, const UnitSystem &system)
 Creates a unit, given its value, dimensions and a unit system in which the value is expressed. More...
 
Float value (const UnitSystem &system) const
 Returns the value in given unit system. More...
 
UnitDimensions dimension () const
 
Unitoperator+= (const Unit &other)
 Arithmetics. More...
 
Unitoperator-= (const Unit &other)
 
Unit operator- () const
 
Unitoperator*= (const Float f)
 
Unitoperator*= (const Unit &other)
 
Unitoperator/= (const Unit &other)
 
bool operator== (const Unit &other) const
 
bool operator!= (const Unit &other) const
 
bool operator< (const Unit &other) const
 
bool operator<= (const Unit &other) const
 
bool operator> (const Unit &other) const
 
bool operator>= (const Unit &other) const
 

Static Public Member Functions

static Unit dimensionless (const Float value)
 
static Unit kilogram (const Float value)
 
static Unit meter (const Float value)
 
static Unit second (const Float value)
 
static Unit radian (const Float value)
 

Friends

std::ostream & operator<< (std::ostream &stream, const Unit &u)
 Utility functions. More...
 
Unit pow (const Unit &u, const int power)
 
bool almostEqual (const Unit &u1, const Unit &u2, const Float eps)
 

Detailed Description

Single benchmark unit.

Todo:
better name

Definition at line 118 of file Session.h.

Constructor & Destructor Documentation

◆ Unit() [1/3]

Unit::Unit ( const std::string &  name,
const Function  func 
)
inline

Definition at line 126 of file Session.h.

◆ Unit() [2/3]

Unit::Unit ( )
default

◆ Unit() [3/3]

Unit::Unit ( const Float value,
const UnitDimensions dimensions,
const UnitSystem system 
)
inline

Creates a unit, given its value, dimensions and a unit system in which the value is expressed.

Definition at line 247 of file Units.h.

Member Function Documentation

◆ dimension()

UnitDimensions Unit::dimension ( ) const
inline

Definition at line 259 of file Units.h.

◆ dimensionless()

static Unit Unit::dimensionless ( const Float  value)
inlinestatic

Definition at line 354 of file Units.h.

◆ getName()

const std::string& Unit::getName ( ) const
inline

Definition at line 132 of file Session.h.

◆ kilogram()

static Unit Unit::kilogram ( const Float  value)
inlinestatic

Definition at line 358 of file Units.h.

◆ meter()

static Unit Unit::meter ( const Float  value)
inlinestatic

Definition at line 362 of file Units.h.

◆ operator!=()

bool Unit::operator!= ( const Unit other) const
inline

Definition at line 305 of file Units.h.

◆ operator*=() [1/2]

Unit& Unit::operator*= ( const Float  f)
inline

Definition at line 283 of file Units.h.

◆ operator*=() [2/2]

Unit& Unit::operator*= ( const Unit other)
inline

Definition at line 288 of file Units.h.

◆ operator+=()

Unit& Unit::operator+= ( const Unit other)
inline

Arithmetics.

Definition at line 264 of file Units.h.

◆ operator-()

Unit Unit::operator- ( ) const
inline

Definition at line 276 of file Units.h.

◆ operator-=()

Unit& Unit::operator-= ( const Unit other)
inline

Definition at line 270 of file Units.h.

◆ operator/=()

Unit& Unit::operator/= ( const Unit other)
inline

Definition at line 294 of file Units.h.

◆ operator<()

bool Unit::operator< ( const Unit other) const
inline

Definition at line 309 of file Units.h.

◆ operator<=()

bool Unit::operator<= ( const Unit other) const
inline

Definition at line 314 of file Units.h.

◆ operator==()

bool Unit::operator== ( const Unit other) const
inline

Definition at line 300 of file Units.h.

◆ operator>()

bool Unit::operator> ( const Unit other) const
inline

Definition at line 319 of file Units.h.

◆ operator>=()

bool Unit::operator>= ( const Unit other) const
inline

Definition at line 323 of file Units.h.

◆ radian()

static Unit Unit::radian ( const Float  value)
inlinestatic

Definition at line 370 of file Units.h.

◆ run()

Expected<Result> Unit::run ( const Target  target)
inline

Definition at line 136 of file Session.h.

◆ second()

static Unit Unit::second ( const Float  value)
inlinestatic

Definition at line 366 of file Units.h.

◆ value()

Float Unit::value ( const UnitSystem system) const
inline

Returns the value in given unit system.

Definition at line 255 of file Units.h.

Friends And Related Function Documentation

◆ almostEqual

bool almostEqual ( const Unit u1,
const Unit u2,
const Float  eps 
)
friend

Definition at line 349 of file Units.h.

◆ operator<<

std::ostream& operator<< ( std::ostream &  stream,
const Unit u 
)
friend

Utility functions.

Prints in the most suitable units (so that the value is as close to 1 as possible).

Can be only used with base units.

Definition at line 50 of file Units.cpp.

◆ pow

Unit pow ( const Unit u,
const int  power 
)
friend

Definition at line 342 of file Units.h.


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