Jamba  3.2.0
pongasoft::Utils Namespace Reference

Namespaces

 Collection
 
 Concurrent
 

Classes

class  Cast
 
class  Disposable
 
class  Lerp
 
struct  Range
 

Typedefs

using DPLerp = Lerp< double, double, double >
 
template<typename X >
using DPLerpX = Lerp< double, X, double >
 
template<typename X , typename Y >
using DPLerpXY = Lerp< double, X, Y >
 
template<typename Y >
using DPLerpY = Lerp< double, double, Y >
 
using SPLerp = Lerp< float, float, float >
 
template<typename X >
using SPLerpX = Lerp< float, X, float >
 
template<typename X , typename Y >
using SPLerpXY = Lerp< float, X, Y >
 
template<typename Y >
using SPLerpY = Lerp< float, float, Y >
 

Functions

template<typename T , typename U >
static T clamp (const U &iValue, const T &iLower, const T &iUpper)
 
template<typename T , typename U >
static T clampE (const U &value, const T &lower, const T &upper)
 
template<typename T , typename U >
static T clampRange (const U &iValue, const T &iFrom, const T &iTo)
 
template<typename X , typename Y >
static DPLerpXY< X, Y > mapRangeDPXY (X iFromLow, X iFromHigh, Y iToLow, Y iToHigh)
 
template<typename X , typename Y >
static SPLerpXY< X, Y > mapRangeSPXY (X iFromLow, X iFromHigh, Y iToLow, Y iToHigh)
 
static double mapValueDP (double iValue, double iFromLow, double iFromHigh, double iToLow, double iToHigh, bool iClamp=true)
 
template<typename X >
static double mapValueDPX (X iValue, X iFromLow, X iFromHigh, double iToLow, double iToHigh, bool iClamp=true)
 
template<typename X , typename Y >
static Y mapValueDPXY (X iValue, X iFromLow, X iFromHigh, Y iToLow, Y iToHigh, bool iClamp=true)
 
template<typename Y >
static Y mapValueDPY (double iValue, double iFromLow, double iFromHigh, Y iToLow, Y iToHigh, bool iClamp=true)
 
static float mapValueSP (float iValue, float iFromLow, float iFromHigh, float iToLow, float iToHigh, bool iClamp=true)
 
template<typename X >
static float mapValueSPX (X iValue, X iFromLow, X iFromHigh, float iToLow, float iToHigh, bool iClamp=true)
 
template<typename X , typename Y >
static Y mapValueSPXY (X iValue, X iFromLow, X iFromHigh, Y iToLow, Y iToHigh, bool iClamp=true)
 
template<typename Y >
static Y mapValueSPY (float iValue, float iFromLow, float iFromHigh, Y iToLow, Y iToHigh, bool iClamp=true)
 
template<typename TFloat >
std::vector< TFloat > splitFloats (const std::string &iString, char iDelimiter, bool iSkipEmptyEntries=false)
 
std::vector< std::string > splitString (const std::string &iString, char iDelimiter, bool iSkipEmptyEntries)
 
template<typename Out >
void splitString (const std::string &iString, char iDelimiter, Out oResult, bool iSkipEmptyEntries=false)
 
template<typename TFloat >
bool stringToFloat (const std::string &iString, TFloat &oValue)
 
template<typename TFloat >
TFloat stringToFloat (const std::string &iString)
 

Variables

constexpr auto mapRangeDP = mapRangeDPXY<double, double>
 
template<typename X >
constexpr auto mapRangeDPX = mapRangeDPXY<X, double>
 
template<typename Y >
constexpr auto mapRangeDPY = mapRangeDPXY<double, Y>
 
constexpr auto mapRangeSP = mapRangeSPXY<float, float>
 
template<typename X >
constexpr auto mapRangeSPX = mapRangeSPXY<X, float>
 
template<typename Y >
constexpr auto mapRangeSPY = mapRangeSPXY<float, Y>
 
constexpr Steinberg::int32 MAX_INT32 = 0x7fffffff
 
constexpr auto ZERO_INT32 = static_cast<Steinberg::int32>(0)
 

Typedef Documentation

◆ DPLerp

using pongasoft::Utils::DPLerp = typedef Lerp<double, double, double>

◆ DPLerpX

template<typename X >
using pongasoft::Utils::DPLerpX = typedef Lerp<double, X, double>

◆ DPLerpXY

template<typename X , typename Y >
using pongasoft::Utils::DPLerpXY = typedef Lerp<double, X, Y>

◆ DPLerpY

template<typename Y >
using pongasoft::Utils::DPLerpY = typedef Lerp<double, double, Y>

◆ SPLerp

using pongasoft::Utils::SPLerp = typedef Lerp<float, float, float>

◆ SPLerpX

template<typename X >
using pongasoft::Utils::SPLerpX = typedef Lerp<float, X, float>

◆ SPLerpXY

template<typename X , typename Y >
using pongasoft::Utils::SPLerpXY = typedef Lerp<float, X, Y>

◆ SPLerpY

template<typename Y >
using pongasoft::Utils::SPLerpY = typedef Lerp<float, float, Y>

Function Documentation

◆ clamp()

template<typename T , typename U >
static T pongasoft::Utils::clamp ( const U &  iValue,
const T &  iLower,
const T &  iUpper 
)
inlinestatic

Make sure that the value remains within its bounds

Parameters
iLowerthe lower bound (must be <= iUpper)
iUpperthe upper bound (must be >= iLower)

◆ clampE()

template<typename T , typename U >
static T pongasoft::Utils::clampE ( const U &  value,
const T &  lower,
const T &  upper 
)
inlinestatic

Same as clamp except it will actually fail/assert in debug mode. For example can be used to access an array with an index and making sure the index is valid within the array. If it happens in production release then it will no randomly crash the application by accessing random memory.

◆ clampRange()

template<typename T , typename U >
static T pongasoft::Utils::clampRange ( const U &  iValue,
const T &  iFrom,
const T &  iTo 
)
inlinestatic

Make sure that the value remains within its bounds. The difference with clamp is that iFrom and iTo do not have to be provided in any specific order.

◆ mapRangeDPXY()

template<typename X , typename Y >
static DPLerpXY<X, Y> pongasoft::Utils::mapRangeDPXY ( iFromLow,
iFromHigh,
iToLow,
iToHigh 
)
inlinestatic

Convenient shortcut for double precision. See Lerp::mapRange

◆ mapRangeSPXY()

template<typename X , typename Y >
static SPLerpXY<X, Y> pongasoft::Utils::mapRangeSPXY ( iFromLow,
iFromHigh,
iToLow,
iToHigh 
)
inlinestatic

Convenient shortcut for single precision. See Lerp::mapRange

◆ mapValueDP()

static double pongasoft::Utils::mapValueDP ( double  iValue,
double  iFromLow,
double  iFromHigh,
double  iToLow,
double  iToHigh,
bool  iClamp = true 
)
inlinestatic

Convenient shortcut for single precision. See Lerp::mapValue

◆ mapValueDPX()

template<typename X >
static double pongasoft::Utils::mapValueDPX ( iValue,
iFromLow,
iFromHigh,
double  iToLow,
double  iToHigh,
bool  iClamp = true 
)
inlinestatic

Convenient shortcut for single precision. See Lerp::mapValue

◆ mapValueDPXY()

template<typename X , typename Y >
static Y pongasoft::Utils::mapValueDPXY ( iValue,
iFromLow,
iFromHigh,
iToLow,
iToHigh,
bool  iClamp = true 
)
inlinestatic

Convenient shortcut for single precision. See Lerp::mapValue

◆ mapValueDPY()

template<typename Y >
static Y pongasoft::Utils::mapValueDPY ( double  iValue,
double  iFromLow,
double  iFromHigh,
iToLow,
iToHigh,
bool  iClamp = true 
)
inlinestatic

Convenient shortcut for single precision. See Lerp::mapValue

◆ mapValueSP()

static float pongasoft::Utils::mapValueSP ( float  iValue,
float  iFromLow,
float  iFromHigh,
float  iToLow,
float  iToHigh,
bool  iClamp = true 
)
inlinestatic

Convenient shortcut for single precision. See Lerp::mapValue

◆ mapValueSPX()

template<typename X >
static float pongasoft::Utils::mapValueSPX ( iValue,
iFromLow,
iFromHigh,
float  iToLow,
float  iToHigh,
bool  iClamp = true 
)
inlinestatic

Convenient shortcut for single precision. See Lerp::mapValue

◆ mapValueSPXY()

template<typename X , typename Y >
static Y pongasoft::Utils::mapValueSPXY ( iValue,
iFromLow,
iFromHigh,
iToLow,
iToHigh,
bool  iClamp = true 
)
inlinestatic

Convenient shortcut for single precision. See Lerp::mapValue

◆ mapValueSPY()

template<typename Y >
static Y pongasoft::Utils::mapValueSPY ( float  iValue,
float  iFromLow,
float  iFromHigh,
iToLow,
iToHigh,
bool  iClamp = true 
)
inlinestatic

Convenient shortcut for single precision. See Lerp::mapValue

◆ splitFloats()

template<typename TFloat >
std::vector<TFloat> pongasoft::Utils::splitFloats ( const std::string &  iString,
char  iDelimiter,
bool  iSkipEmptyEntries = false 
)

Converts the string to a TFloat

Returns
the float or nan if not a number

◆ splitString() [1/2]

std::vector< std::string > pongasoft::Utils::splitString ( const std::string &  iString,
char  iDelimiter,
bool  iSkipEmptyEntries 
)

Split a string according to a delimiter and returns a vector

Parameters
iStringthe string to split
iDelimiterthe delimiter
iSkipEmptyEntrieswhether to include or not empty entries

◆ splitString() [2/2]

template<typename Out >
void pongasoft::Utils::splitString ( const std::string &  iString,
char  iDelimiter,
Out  oResult,
bool  iSkipEmptyEntries = false 
)

Split a string according to a delimiter and writes the result into Out (can be a vector, array, etc...)

Parameters
iStringthe string to split
iDelimiterthe delimiter
oResultthe result
iSkipEmptyEntrieswhether to include or not empty entries

◆ stringToFloat() [1/2]

template<typename TFloat >
bool pongasoft::Utils::stringToFloat ( const std::string &  iString,
TFloat &  oValue 
)

Converts the string to a TFloat (float or double)

Returns
true if it could be extracted in which case oValue will contain the float, false otherwise

◆ stringToFloat() [2/2]

template<typename TFloat >
TFloat pongasoft::Utils::stringToFloat ( const std::string &  iString)

Converts the string to a TFloat

Returns
the float or nan if not a number

Variable Documentation

◆ mapRangeDP

constexpr auto pongasoft::Utils::mapRangeDP = mapRangeDPXY<double, double>

◆ mapRangeDPX

template<typename X >
constexpr auto pongasoft::Utils::mapRangeDPX = mapRangeDPXY<X, double>

◆ mapRangeDPY

template<typename Y >
constexpr auto pongasoft::Utils::mapRangeDPY = mapRangeDPXY<double, Y>

◆ mapRangeSP

constexpr auto pongasoft::Utils::mapRangeSP = mapRangeSPXY<float, float>

◆ mapRangeSPX

template<typename X >
constexpr auto pongasoft::Utils::mapRangeSPX = mapRangeSPXY<X, float>

◆ mapRangeSPY

template<typename Y >
constexpr auto pongasoft::Utils::mapRangeSPY = mapRangeSPXY<float, Y>

◆ MAX_INT32

constexpr Steinberg::int32 pongasoft::Utils::MAX_INT32 = 0x7fffffff

◆ ZERO_INT32

constexpr auto pongasoft::Utils::ZERO_INT32 = static_cast<Steinberg::int32>(0)