Privacy
An open-source, flexible 3D physical simulation framework
misc.h File Reference
#include <sys/time.h>
#include <unistd.h>
#include <string>
#include <vector>
#include <sstream>

Go to the source code of this file.

Namespaces

 mars
 Copyright 2012, DFKI GmbH Robotics Innovation Center.
 
 mars::utils
 

Functions

double mars::utils::radToDeg (const double &r)
 converts an angle given in radians to degrees. More...
 
float mars::utils::radToDeg (const float &r)
 
double mars::utils::degToRad (const double &d)
 converts an angle given in degrees to radians. More...
 
float mars::utils::degToRad (const float &d)
 
template<typename T >
std::string mars::utils::numToStr (T Number)
 
long long mars::utils::getTime ()
 
long long mars::utils::getTimeDiff (long long start)
 returns the time difference between now and a given reference. More...
 
void mars::utils::msleep (unsigned int milliseconds)
 sleeps for at least the specified time. More...
 
bool mars::utils::pathExists (const std::string &path)
 check whether a file or directory exists. More...
 
bool mars::utils::matchPattern (const std::string &pattern, const std::string &str)
 basic pattern matching function More...
 
std::string mars::utils::trim (const std::string &str)
 remove leading and trailing whitespaces More...
 
void mars::utils::handleFilenamePrefix (std::string *file, const std::string &prefix)
 
std::string mars::utils::pathJoin (const std::string &path1, const std::string &path2)
 
void mars::utils::removeFilenamePrefix (std::string *file)
 given a filepath "bla/da/fnord/foobar.baz" this will remove everything before and including the last slash "/" resulting in "foobar.baz". More...
 
void mars::utils::removeFilenameSuffix (std::string *file)
 given a filename "foobar.baz" this will remove the extension (including the dot ".") resulting in "foobar". More...
 
std::string mars::utils::getFilenameSuffix (const std::string &file)
 given a filename "foobar.baz" this will return ".baz" More...
 
std::string mars::utils::getPathOfFile (const std::string &filename)
 
std::string mars::utils::getCurrentWorkingDir ()
 
unsigned int mars::utils::createDirectory (const std::string &dir, int mode=0755)
 creates a directory at the given path. More...
 
std::vector< std::string > mars::utils::explodeString (const char c, const std::string &s)
 
std::string mars::utils::replaceString (const std::string &source, const std::string &s1, const std::string &s2)
 
std::string mars::utils::toupper (const std::string &s)
 
std::string mars::utils::tolower (const std::string &s)