eisgenerator 1.0.x
Public Member Functions | Static Public Member Functions | Data Fields
eis::Range Class Reference

A range. More...

#include <eistype.h>

Public Member Functions

fvalue stepSize () const
 calculates the distance between elements in the range will calculate the log10 of the distance if the range is logarithmic
 
fvalue stepValue () const
 calculates the value of the current step
 
fvalue center () const
 calculates the mean of the start and the end values
 
fvalue at (size_t index) const
 calculates the value at the given index
 
fvalue operator[] (size_t index) const
 
Range operator* (fvalue in) const
 
Range operator/ (fvalue in) const
 
Range operator* (int in) const
 
Range operator/ (int in) const
 
 Range (fvalue startI, fvalue endI, size_t countI, bool logI=false)
 
void print (int level) const
 prints the range to stdout via eis::Log
 
std::string getString () const
 gets a machine parseable string encoding this range
 
bool isSane () const
 checks if the values of this range are sane this checks for some common errors like having a end < being
 
std::vector< fvalue > getRangeVector () const
 this function constructs a vector that contains all elements of this range
 

Static Public Member Functions

static Range fromString (std::string str, size_t count)
 this function creates a range from the parseable string
 
static std::vector< RangerangesFromParamString (const std::string &paramStr, size_t count)
 this function creates a vector ranges from the parseable parameter array string
 

Data Fields

fvalue start
 Start of the range.
 
fvalue end
 End of the range.
 
size_t count = 0
 Number of elements in the range.
 
size_t step = 0
 Currently active step.
 
bool log = false
 True if the elements in the range are to be spaced in log10 increments.
 

Detailed Description

A range.

Examples
compileing.cpp, and simple.cpp.

Member Function Documentation

◆ at()

fvalue eis::Range::at ( size_t  index) const
inline

calculates the value at the given index

Returns
the value at the given index

References count, log, start, and stepSize().

Referenced by stepValue().

◆ center()

fvalue eis::Range::center ( ) const
inline

calculates the mean of the start and the end values

Returns
the mean of the start and the end values

References end, and start.

◆ fromString()

static Range eis::Range::fromString ( std::string  str,
size_t  count 
)
static

this function creates a range from the parseable string

Exceptions
std::invalid_argumentwhen the string syntax is incorrect
Returns
the range that was parsed from the string

◆ getRangeVector()

std::vector< fvalue > eis::Range::getRangeVector ( ) const

this function constructs a vector that contains all elements of this range

Returns
the vector with the elements of this range
Examples
simple.cpp.

◆ getString()

std::string eis::Range::getString ( ) const

gets a machine parseable string encoding this range

Returns
the string

◆ isSane()

bool eis::Range::isSane ( ) const

checks if the values of this range are sane this checks for some common errors like having a end < being

Returns
true if sane, false if not

◆ print()

void eis::Range::print ( int  level) const

prints the range to stdout via eis::Log

Parameters
levelthe eis::Log::Level to print at

◆ rangesFromParamString()

static std::vector< Range > eis::Range::rangesFromParamString ( const std::string &  paramStr,
size_t  count 
)
static

this function creates a vector ranges from the parseable parameter array string

Exceptions
std::invalid_argumentwhen the string syntax is incorrect
Returns
the vector of ranges that was parsed from the string

◆ stepSize()

fvalue eis::Range::stepSize ( ) const
inline

calculates the distance between elements in the range will calculate the log10 of the distance if the range is logarithmic

Returns
the distance between steps of this range

References count, end, log, and start.

Referenced by at().

◆ stepValue()

fvalue eis::Range::stepValue ( ) const
inline

calculates the value of the current step

Returns
the value of the current step

References at(), and step.