MOOS

/home/pnewman/code/MOOS/trunk/Core/MOOSGenLib/MOOSGenLibGlobalHelper.h File Reference

#include <string>
#include <list>
#include <vector>
#include <algorithm>

Go to the source code of this file.

Classes

struct  static_caster< D >
struct  dynamic_caster< D >

Defines

#define PI   3.141592653589
#define MOOSHERE   MOOSFormat("File %s Line %d", __FILE__,__LINE__).c_str()
#define UNUSED_PARAMETER(a)

Typedefs

typedef std::list< std::string > STRING_LIST

Functions

bool MOOSGetValueFromToken (STRING_LIST &sParams, const std::string &sToken, std::string &sVal)
bool MOOSValFromString (std::string &sVal, const std::string &sStr, const std::string &sTk)
bool MOOSValFromString (double &dfVal, const std::string &sStr, const std::string &sTk)
bool MOOSValFromString (int &nVal, const std::string &sStr, const std::string &sTk)
bool MOOSValFromString (bool &bVal, const std::string &sStr, const std::string &sTk)
bool MOOSValFromString (std::vector< double > &dfValVec, int &nRows, int &nCols, const std::string &sStr, const std::string &sToken)
bool MOOSVectorFromString (const std::string &sStr, std::vector< double > &dfVecVal, int &nRows, int &nCols)
bool MOOSVectorFromString (const std::string &sStr, std::vector< unsigned int > &dfVecVal, int &nRows, int &nCols)
std::string DoubleVector2String (const std::vector< double > &V)
std::stringstream & Write (std::stringstream &os, const std::vector< double > &Vec)
std::stringstream & Write (std::stringstream &os, const std::vector< int > &Vec)
std::string MOOSChomp (std::string &sStr, const std::string &sTk=",")
void MOOSRemoveChars (std::string &sStr, const std::string &sTok)
void MOOSToUpper (std::string &str)
void MOOSTrimWhiteSpace (std::string &str)
bool MOOSIsNumeric (std::string str)
bool MOOSStrCmp (std::string s1, std::string s2)
double GetMOOSSkew ()
void SetMOOSSkew (double dfSkew)
void MOOSPause (int nMS)
double MOOSTime ()
double HPMOOSTime ()
int MOOSGetch ()
void MOOSTrace (std::string Str)
void MOOSTrace (char *FmtStr,...)
std::string MOOSFormat (char *FmtStr,...)
bool MOOSFail (char *FmtStr,...)
std::string MOOSGetTimeStampString ()
std::string MOOSGetDate ()
void Progress (double dfPC)
std::string MOOSThirdPartyActuationString (double *pdfRudder, double *pdfElevator, double *pdfThrust)
std::string MOOSThirdPartyStatusString (std::string sStatusCommand)
double MOOS_ANGLE_WRAP (double dfAng)
double MOOSDeg2Rad (double dfDeg)
double MOOSRad2Deg (double dfRad)
bool MOOSAbsLimit (double &dfVal, double dfLimit)
double MOOSWhiteNoise (double Sigma)
double MOOSNormalInv (double dfArea)
int MOOSDiscreteUniform (int nMin, int nMax)
double MOOSUniformRandom (double dfMin, double dfMax)
template<class T>
const T & MOOSClamp (const T &val, const T &min, const T &max)
bool GetDirectoryContents (const std::string &sPath, std::list< std::string > &sContents, bool bFiles=true)
bool MOOSCreateDirectory (const std::string &sDirectory)
bool MOOSFileParts (std::string sFullPath, std::string &sPath, std::string &sFile, std::string &sExtension)
template<class T>
SwapByteOrder (const T &v)
bool IsLittleEndian ()


Detailed Description


Define Documentation

#define MOOSHERE   MOOSFormat("File %s Line %d", __FILE__,__LINE__).c_str()
 

useful macro for debugging prints line and file


Function Documentation

std::string DoubleVector2String const std::vector< double > &  V  ) 
 

formats a vector of doublse into standard MOOS format

bool GetDirectoryContents const std::string &  sPath,
std::list< std::string > &  sContents,
bool  bFiles
 

returns a string list of directories or files in a specified location exludes . and ..

double GetMOOSSkew  ) 
 

return the offset between DB time and client time

double HPMOOSTime  ) 
 

return high precision timestamp - time since unix in seconds

bool IsLittleEndian  ) 
 

returns true if architecture is LittleEndian (true for x86 Architectures) Note after first call it remembers answer in a static so v. littel overhead in calling this function frequently

double MOOS_ANGLE_WRAP double  dfAng  ) 
 

Bound angle to +/-PI

bool MOOSAbsLimit double &  dfVal,
double  dfLimit
 

limit dfVal to lie between +/- dfLimit)

template<class T>
const T& MOOSClamp const T &  val,
const T &  min,
const T &  max
 

Clamps a templated type between two values

bool MOOSCreateDirectory const std::string &  sDirectory  ) 
 

make a directory

double MOOSDeg2Rad double  dfDeg  ) 
 

convert deg to rad

int MOOSDiscreteUniform int  nMin,
int  nMax
 

generates uniform noise in integers between interval nMin->nMax

bool MOOSFail char *  FmtStr,
  ...
 

like MOOSTrace but returns false - useful for return statements

bool MOOSFileParts std::string  sFullPath,
std::string &  sPath,
std::string &  sFile,
std::string &  sExtension
 

splits a fully qualified path into parts -path, filestem and extension

std::string MOOSFormat char *  FmtStr,
  ...
 

return a formatted string (with printf-like format codes

int MOOSGetch  ) 
 

useful keyboard trap

std::string MOOSGetDate  ) 
 

get teh current date formatted nicely

std::string MOOSGetTimeStampString  ) 
 

return nicely formatted time stamp string

bool MOOSIsNumeric std::string  str  ) 
 

returbn true if numeric

double MOOSNormalInv double  dfArea  ) 
 

returns x for probablity mass such p(v<=x) = dfArea)

void MOOSPause int  nMS  ) 
 

pause for nMS milliseconds

double MOOSRad2Deg double  dfRad  ) 
 

convert rad 2 deg

void MOOSRemoveChars std::string &  sStr,
const std::string &  sTok
 

remove all characters in sTok from sStr

bool MOOSStrCmp std::string  s1,
std::string  s2
 

case insensitive string comparison. returns true if equal

double MOOSTime  ) 
 

return time as a double (time since unix in seconds)

void MOOSToUpper std::string &  str  ) 
 

convert string to upper case

void MOOSTrace char *  FmtStr,
  ...
 

print a formatted string (with printf-like format codes) and to debug window in DevStudio

void MOOSTrace std::string  Str  ) 
 

print a string

void MOOSTrimWhiteSpace std::string &  str  ) 
 

remove white space form start and end of a string

double MOOSUniformRandom double  dfMin,
double  dfMax
 

generates uniform noise in interval dfMin-dfMax

double MOOSWhiteNoise double  Sigma  ) 
 

returns sample fom Gaussian process strength Sigma mena zero

void Progress double  dfPC  ) 
 

prints a "progress bar" upto 40 characters long dfPC is the fraction complete - ie 0:1

template<class T>
T SwapByteOrder const T &  v  ) 
 

templated function which swaps byte order of type T returning it

std::stringstream& Write std::stringstream &  os,
const std::vector< int > &  Vec
 

formats a vector of ints into standard MOOS format

std::stringstream& Write std::stringstream &  os,
const std::vector< double > &  Vec
 

formats a vector of doubles into standard MOOS format


Generated on Fri Sep 28 20:14:21 2007 for MOOSGenLib by  doxygen 1.4.6