Files | Namespaces | Macros | Functions
Utils
Collaboration diagram for Utils:

Files

file  misc.h
 some general case utility functions
 
file  timeutil.h
 utility functions for handling time related stuff
 

Namespaces

 g2o
 

Macros

#define DO_EVERY(secs, code)   DO_EVERY_TS(secs, g2o::get_time(), code)
 Executes code, only if secs are gone since last exec. More...
 
#define DO_EVERY_TS(secs, currentTime, code)
 
#define MEASURE_FUNCTION_TIME   g2o::ScopeTime scopeTime(__PRETTY_FUNCTION__)
 
#define MEASURE_TIME(text, code)
 

Functions

template<typename T >
bool g2o::convertString (const std::string &s, T &x, bool failIfLeftoverChars=true)
 
std::string g2o::formatString (const char *fmt,...)
 
template<typename OutputIterator >
OutputIterator g2o::readFloats (const char *str, OutputIterator out)
 
template<typename OutputIterator >
OutputIterator g2o::readInts (const char *str, OutputIterator out)
 
int g2o::readLine (std::istream &is, std::stringstream &currentLine)
 
bool g2o::strEndsWith (const std::string &s, const std::string &end)
 
std::string g2o::strExpandFilename (const std::string &filename)
 
template<typename T >
g2o::stringToType (const std::string &s, bool failIfLeftoverChars=true)
 
int g2o::strPrintf (std::string &str, const char *fmt,...)
 
std::vector< std::string > g2o::strSplit (const std::string &str, const std::string &delimiters)
 
bool g2o::strStartsWith (const std::string &s, const std::string &start)
 
std::string g2o::strToLower (const std::string &s)
 
std::string g2o::strToUpper (const std::string &s)
 
std::string g2o::trim (const std::string &s)
 
std::string g2o::trimLeft (const std::string &s)
 
std::string g2o::trimRight (const std::string &s)
 

Detailed Description

Macro Definition Documentation

#define DO_EVERY (   secs,
  code 
)    DO_EVERY_TS(secs, g2o::get_time(), code)

Executes code, only if secs are gone since last exec.

Definition at line 65 of file timeutil.h.

#define DO_EVERY_TS (   secs,
  currentTime,
  code 
)
Value:
if (1) {\
static double s_lastDone_ = (currentTime); \
double s_now_ = (currentTime); \
if (s_lastDone_ > s_now_) \
s_lastDone_ = s_now_; \
if (s_now_ - s_lastDone_ > (secs)) { \
code; \
s_lastDone_ = s_now_; \
}\
} else \
(void)0

Executes code, only if secs are gone since last exec. extended version, in which the current time is given, e.g., timestamp of IPC message

Definition at line 49 of file timeutil.h.

#define MEASURE_FUNCTION_TIME   g2o::ScopeTime scopeTime(__PRETTY_FUNCTION__)

Definition at line 126 of file timeutil.h.

#define MEASURE_TIME (   text,
  code 
)
Value:
if(1) { \
double _start_time_ = g2o::get_time(); \
code; \
fprintf(stderr, "%s took %f sec\n", text, g2o::get_time() - _start_time_); \
} else \
(void) 0
double get_time()
Definition: timeutil.h:91

Definition at line 69 of file timeutil.h.

Function Documentation

template<typename T >
bool g2o::convertString ( const std::string &  s,
T &  x,
bool  failIfLeftoverChars = true 
)

convert a string into an other type.

Definition at line 124 of file string_tools.h.

std::string g2o::formatString ( const char *  fmt,
  ... 
)

format a string and return a std::string. Format is just like printf, see man 3 printf

Definition at line 95 of file string_tools.cpp.

template<typename OutputIterator >
OutputIterator g2o::readFloats ( const char *  str,
OutputIterator  out 
)

read float values (seperated by spaces) from a string and store them in the given OutputIterator.

Definition at line 95 of file string_tools.h.

template<typename OutputIterator >
OutputIterator g2o::readInts ( const char *  str,
OutputIterator  out 
)

read integer values (seperated by spaces) from a string and store them in the given OutputIterator.

Definition at line 76 of file string_tools.h.

int g2o::readLine ( std::istream &  is,
std::stringstream &  currentLine 
)

read a line from is into currentLine.

Returns
the number of characters read into currentLine (excluding newline), -1 on eof()

Definition at line 172 of file string_tools.cpp.

bool g2o::strEndsWith ( const std::string &  str,
const std::string &  substr 
)

return true, if str ends with substr

Definition at line 165 of file string_tools.cpp.

std::string g2o::strExpandFilename ( const std::string &  filename)

expand the given filename like a posix shell, e.g., ~ $CARMEN_HOME and other will get expanded. Also command substitution, e.g. pwd will give the current directory.

Definition at line 124 of file string_tools.cpp.

template<typename T >
T g2o::stringToType ( const std::string &  s,
bool  failIfLeftoverChars = true 
)

convert a string into an other type. Return the converted value. Throw error if parsing is wrong.

Definition at line 138 of file string_tools.h.

int g2o::strPrintf ( std::string &  str,
const char *  fmt,
  ... 
)

replacement function for sprintf which fills a std::string instead of a char*

Definition at line 112 of file string_tools.cpp.

std::vector< std::string > g2o::strSplit ( const std::string &  s,
const std::string &  delim 
)

split a string into token based on the characters given in delim

Definition at line 143 of file string_tools.cpp.

bool g2o::strStartsWith ( const std::string &  str,
const std::string &  substr 
)

return true, if str starts with substr

Definition at line 158 of file string_tools.cpp.

std::string g2o::strToLower ( const std::string &  s)

convert the string to lower case

Definition at line 81 of file string_tools.cpp.

std::string g2o::strToUpper ( const std::string &  s)

convert a string to upper case

Definition at line 88 of file string_tools.cpp.

std::string g2o::trim ( const std::string &  s)

remove whitespaces from the start/end of a string

Definition at line 48 of file string_tools.cpp.

std::string g2o::trimLeft ( const std::string &  s)

remove whitespaces from the left side of the string

Definition at line 59 of file string_tools.cpp.

std::string g2o::trimRight ( const std::string &  s)

remove whitespaced from the right side of the string

Definition at line 70 of file string_tools.cpp.



orb_slam2_ros
Author(s):
autogenerated on Wed Apr 21 2021 02:53:05