LRT14  1.0
 All Classes Namespaces Functions Variables Enumerations Enumerator
Util Class Reference

Class containing utility functions. More...

#include <Util.h>

Static Public Member Functions

template<typename T >
static T Clamp (T val, T min, T max)
 Clamps a given value between the min and the max.
 
template<typename T >
static T Rescale (T val, T min0, T max0, T min1, T max1)
 Rescales a value from [min0, max0] to [min1, max1].
 
template<typename T >
static std::string ToString (T val)
 Converts a value to a string.
 
template<typename T >
static int Sign (T val)
 Returns the sign of a value.
 
template<typename T >
static T Abs (T val)
 takes the absolute value
 
template<typename T >
static void MinMaxMean (T val[], int n, T *minOut, T *maxOut, T *meanOut)
 calculates the min, max and mean of an array
 
template<typename T >
static T AddDeadband (T raw, T deadbandSize)
 Adds a deadband into the center of a range.
 
template<typename T >
static T ValWithAbsMax (T val1, T val2)
 Returns value which has a higher absolute.
 
template<typename T >
static T Max (T val1, T val2)
 Returns the higher value.
 
template<typename T >
static T Min (T val1, T val2)
 Returns the lower value.
 
template<typename T >
static T MinAbs (T val1, T val2)
 Returns the value with the lesser absolute value.
 
template<typename T >
static T PowPreseveSign (T val, int power)
 Takes the exponent without changing the sign.
 
template<class A , class B >
static bool DeleteMapFirst (std::pair< A, B > x)
 Frees the resources pointed to in a map<pointer, object>
 
template<class A , class B >
static bool DeleteMapSecond (std::pair< A, B > x)
 Frees the resources pointed to in a map<object, pointer>
 
template<class A , class B >
static bool DeleteMapBoth (std::pair< A, B > x)
 Frees the resources pointed to in a map<pointer, pointer>
 
template<class A >
static bool DeleteVector (A x)
 Frees the resources pointed to in a vector<pointer>
 
static void Die ()
 Kills the current process.
 
static void Die (const char *message)
 Kills the current process with an exit message.
 
static bool Assert (bool test, const char *message)
 Prints the message if the test fails.
 

Detailed Description

Class containing utility functions.

Author
Robert Ying
Karthik Viswanathan
Brian Axelrod
David Giandomenico
Tony Peng
Raphael Chang
Manoj Vasishta

Member Function Documentation

template<typename T >
static T Util::Abs ( val)
inlinestatic

takes the absolute value

Parameters
valthe value to absolute
Returns
the absolute value
template<typename T >
static T Util::AddDeadband ( raw,
deadbandSize 
)
inlinestatic

Adds a deadband into the center of a range.

Parameters
rawthe raw value from -1 to 1
deadbandSizethe size of the deadband
Returns
the value with a deadband
static bool Util::Assert ( bool  test,
const char *  message 
)
static

Prints the message if the test fails.

Parameters
testthe test
messagethe message to be printed
Returns
whether or not the test was passed
template<typename T >
static T Util::Clamp ( val,
min,
max 
)
inlinestatic

Clamps a given value between the min and the max.

Parameters
valvalue to clamp
minminimum of that value
maxmaximum of that value
Returns
clamped value
static void Util::Die ( const char *  message)
static

Kills the current process with an exit message.

Parameters
message
template<typename T >
static T Util::Max ( val1,
val2 
)
inlinestatic

Returns the higher value.

Parameters
val1first value to compare
val2second value to compare
Returns
the higher value

Here is the caller graph for this function:

template<typename T >
static T Util::Min ( val1,
val2 
)
inlinestatic

Returns the lower value.

Parameters
val1first value to compare
val2second value to compare
Returns
the lower value

Here is the caller graph for this function:

template<typename T >
static T Util::MinAbs ( val1,
val2 
)
inlinestatic

Returns the value with the lesser absolute value.

Parameters
val1first value to compare
val2second value to compare
Returns
the lower value
template<typename T >
static void Util::MinMaxMean ( val[],
int  n,
T *  minOut,
T *  maxOut,
T *  meanOut 
)
inlinestatic

calculates the min, max and mean of an array

Parameters
valthe array of values
nthe number of values in the array
minOuta pointer to the minimum
maxOuta pointer to the maximum
meanOuta pointer to the mean
template<typename T >
static T Util::PowPreseveSign ( val,
int  power 
)
inlinestatic

Takes the exponent without changing the sign.

Parameters
valthe base of the exponent
powerthe power of the exponent
Returns
the exponent
template<typename T >
static T Util::Rescale ( val,
min0,
max0,
min1,
max1 
)
inlinestatic

Rescales a value from [min0, max0] to [min1, max1].

Parameters
valvalue to rescale
min0initial minimum value
max0initial maximum value
min1final minimum value
max1final maximum value
Returns
the rescaled value
template<typename T >
static int Util::Sign ( val)
inlinestatic

Returns the sign of a value.

Parameters
valthe value to compare
Returns
the sign of the value

Here is the caller graph for this function:

template<typename T >
static std::string Util::ToString ( val)
inlinestatic

Converts a value to a string.

Parameters
valthe value to convert
Returns
the stringified value

Here is the caller graph for this function:

template<typename T >
static T Util::ValWithAbsMax ( val1,
val2 
)
inlinestatic

Returns value which has a higher absolute.

Parameters
val1first value to compare
val2second value to compare
Returns
value which is farther from 0

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