Namespaces | |
namespace | os |
This namespace provides a OS-independent interface to low-level functions. | |
Classes | |
class | CDirectoryExplorer |
This class allows the enumeration of the files/directories that exist into a given path. More... | |
class | CFileSystemWatcher |
This class subscribes to notifications of file system changes, thus it can be used to efficiently stay informed about changes in a directory tree. More... | |
struct | TThreadHandle |
This structure contains the information needed to interface the threads API on each platform:. More... | |
struct | TTimeParts |
The parts of a date/time (it's like the standard 'tm' but with fractions of seconds). More... | |
Threads | |
enum | TProcessPriority { ppIdle = 0, ppNormal, ppHigh, ppVeryHigh } |
The type for cross-platform process (application) priorities. More... | |
enum | TThreadPriority { tpLow = 0, tpNormal, tpHigh } |
The type for cross-platform thread priorities. More... | |
TThreadHandle MRPTDLLIMPEXP | createThread (void(*func)(void *), void *param=NULL) |
Creates a new thread. | |
void MRPTDLLIMPEXP | joinThread (const TThreadHandle &threadHandle) |
Waits until the given thread ends. | |
unsigned long MRPTDLLIMPEXP | getCurrentThreadId () MRPT_NO_THROWS |
Returns the ID of the current thread. | |
void MRPTDLLIMPEXP | getCurrentThreadTimes (time_t &creationTime, time_t &exitTime, double &cpuTime) |
Returns the creation and exit times of the current thread and its CPU time consumed. | |
void MRPTDLLIMPEXP | changeThreadPriority (const TThreadHandle &threadHandle, TThreadPriority priority) |
Change the priority of the given thread. | |
void MRPTDLLIMPEXP | changeCurrentProcessPriority (TProcessPriority priority) |
Change the priority of the given process (it applies to all the threads, plus independent modifiers for each thread). | |
Time and date functions | |
typedef uint64_t | TTimeStamp |
A system independent time type, it holds the the number of 100-nanosecond intervals since January 1, 1601 (UTC). | |
mrpt::system::TTimeStamp MRPTDLLIMPEXP | buildTimestampFromParts (const mrpt::system::TTimeParts &p) |
Builds a timestamp from the parts (Parts are in UTC). | |
mrpt::system::TTimeStamp MRPTDLLIMPEXP | buildTimestampFromPartsLocalTime (const mrpt::system::TTimeParts &p) |
Builds a timestamp from the parts (Parts are in local time). | |
void MRPTDLLIMPEXP | timestampToParts (TTimeStamp t, TTimeParts &p) |
Gets the individual parts of a date/time (days, hours, minutes, seconds). | |
mrpt::system::TTimeStamp MRPTDLLIMPEXP | getCurrentTime () |
Returns the current (UTC) system time. | |
mrpt::system::TTimeStamp MRPTDLLIMPEXP | now () |
A shortcut for system::getCurrentTime. | |
mrpt::system::TTimeStamp MRPTDLLIMPEXP | getCurrentLocalTime () |
Returns the current (local) time. | |
mrpt::system::TTimeStamp MRPTDLLIMPEXP | time_tToTimestamp (const double &t) |
Transform from standard "time_t" (actually a double number, it can contain fractions of seconds) to TTimeStamp. | |
mrpt::system::TTimeStamp MRPTDLLIMPEXP | time_tToTimestamp (const time_t &t) |
Transform from standard "time_t" to TTimeStamp. | |
double MRPTDLLIMPEXP | timestampTotime_t (const mrpt::system::TTimeStamp &t) |
Transform from TTimeStamp to standard "time_t" (actually a double number, it can contain fractions of seconds). | |
double MRPTDLLIMPEXP | timeDifference (const mrpt::system::TTimeStamp &t_first, const mrpt::system::TTimeStamp &t_later) |
Retuns the time difference from t1 to t2 (positive if t2 is posterior to t1), in seconds. | |
mrpt::system::TTimeStamp MRPTDLLIMPEXP | secondsToTimestamp (const double &nSeconds) |
Transform a time interval (in seconds) into TTimeStamp (e.g. | |
std::string MRPTDLLIMPEXP | formatTimeInterval (const double &timeSeconds) |
Returns a formated string with the given time difference (passed as the number of seconds), as a string [H]H:MM:SS.MILISECS. | |
std::string MRPTDLLIMPEXP | dateTimeToString (const mrpt::system::TTimeStamp &t) |
Convert a timestamp into this textual form (UTC time): YEAR/MONTH/DAY,HH:MM:SS.MMM. | |
std::string MRPTDLLIMPEXP | dateTimeLocalToString (const mrpt::system::TTimeStamp &t) |
Convert a timestamp into this textual form (in local time): YEAR/MONTH/DAY,HH:MM:SS.MMM. | |
std::string MRPTDLLIMPEXP | dateToString (const mrpt::system::TTimeStamp &t) |
Convert a timestamp into this textual form: YEAR/MONTH/DAY. | |
double MRPTDLLIMPEXP | extractDayTimeFromTimestamp (const mrpt::system::TTimeStamp &t) |
Returns the number of seconds ellapsed from midnight in the given timestamp. | |
std::string MRPTDLLIMPEXP | timeToString (const mrpt::system::TTimeStamp &t) |
Convert a timestamp into this textual form (UTC): HH:MM:SS.MMMMMM. | |
std::string MRPTDLLIMPEXP | timeLocalToString (const mrpt::system::TTimeStamp &t) |
Convert a timestamp into this textual form (in local time): HH:MM:SS.MMMMMM. | |
std::string MRPTDLLIMPEXP | intervalFormat (const double seconds) |
This function implements time interval formatting: Given a time in seconds, it will return a string describing the interval with the most appropriate unit. | |
Enumerations | |
enum | TConsoleColor { CONCOL_NORMAL = 0, CONCOL_BLUE = 1, CONCOL_GREEN = 2, CONCOL_RED = 4 } |
For use in setConsoleColor. More... | |
Functions | |
std::string MRPTDLLIMPEXP | stack_trace (bool calling_from_exception=false) |
Dumps the current program stack with detailed information of source files and lines. | |
void MRPTDLLIMPEXP | sleep (int time_ms) MRPT_NO_THROWS |
An OS-independent method for sending the current thread to "sleep" for a given period of time. | |
char MRPTDLLIMPEXP * | strtok (char *str, const char *strDelimit, char **context) MRPT_NO_THROWS |
An OS-independent method for tokenizing a string. | |
void MRPTDLLIMPEXP | tokenize (const std::string &inString, const std::string &inDelimiters, std::deque< std::string > &outTokens) MRPT_NO_THROWS |
Tokenizes a string according to a set of delimiting characters. | |
void MRPTDLLIMPEXP | tokenize (const std::string &inString, const std::string &inDelimiters, std::vector< std::string > &outTokens) MRPT_NO_THROWS |
Tokenizes a string according to a set of delimiting characters. | |
std::string MRPTDLLIMPEXP | trim (const std::string &str) |
Removes leading and trailing spaces:. | |
bool MRPTDLLIMPEXP | isNaN (float f) MRPT_NO_THROWS |
Returns true if the number is NaN. | |
bool MRPTDLLIMPEXP | isNaN (double f) MRPT_NO_THROWS |
Returns true if the number is NaN. | |
bool MRPTDLLIMPEXP | isFinite (float f) MRPT_NO_THROWS |
Returns true if the number is non infinity. | |
bool MRPTDLLIMPEXP | isFinite (double f) MRPT_NO_THROWS |
Returns true if the number is non infinity. | |
void MRPTDLLIMPEXP | pause (const std::string &msg=std::string("Press any key to continue...")) MRPT_NO_THROWS |
Shows the message "Press any key to continue" (or other custom message) to the current standard output and returns when a key is pressed. | |
void MRPTDLLIMPEXP | clearConsole () |
Clears the console window. | |
bool MRPTDLLIMPEXP | vectorToTextFile (const std::vector< float > &vec, const std::string &fileName, bool append=false, bool byRows=false) |
A useful function for debuging, which saves a std::vector into a text file (compat. | |
bool MRPTDLLIMPEXP | vectorToTextFile (const std::vector< double > &vec, const std::string &fileName, bool append=false, bool byRows=false) |
A useful function for debuging, which saves a std::vector into a text file (compat. | |
bool MRPTDLLIMPEXP | vectorToTextFile (const std::vector< int > &vec, const std::string &fileName, bool append=false, bool byRows=false) |
A useful function for debuging, which saves a std::vector into a text file (compat. | |
bool MRPTDLLIMPEXP | vectorToTextFile (const std::vector< size_t > &vec, const std::string &fileName, bool append=false, bool byRows=false) |
A useful function for debuging, which saves a std::vector into a text file (compat. | |
bool MRPTDLLIMPEXP | vectorToBinaryFile (const vector_byte &vec, const std::string &fileName) |
Saves a vector directly as a binary dump to a file:. | |
bool MRPTDLLIMPEXP | loadBinaryFile (vector_byte &out_data, const std::string &fileName) |
Loads a entire file as a vector of bytes. | |
unsigned long MRPTDLLIMPEXP | getMemoryUsage () |
Returns the memory occupied by this process, in bytes. | |
std::string MRPTDLLIMPEXP | toUpperCase (const std::string &str) |
Returns a lower-case version of a string. | |
std::string MRPTDLLIMPEXP | toLowerCase (const std::string &str) |
Returns an upper-case version of a string. | |
std::string MRPTDLLIMPEXP | upperCase (const std::string &str) |
Returns a lower-case version of a string. | |
std::string MRPTDLLIMPEXP | lowerCase (const std::string &str) |
Returns an upper-case version of a string. | |
std::string MRPTDLLIMPEXP | MRPT_getCompilationDate () |
Returns the MRPT compilation date. | |
std::string MRPTDLLIMPEXP | MRPT_getVersion () |
Returns a string describing the MRPT version including the SVN number. | |
void MRPTDLLIMPEXP | registerFatalExceptionHandlers () |
Call this to register handlers for fatal erros (memory access,etc) that show useful debug information (It is called automatically normally, no need for the user to explicitly call this method. | |
void MRPTDLLIMPEXP | decodeUTF8 (const std::string &strUTF8, vector_word &out_uniStr) |
Decodes a UTF-8 string into an UNICODE string. | |
void MRPTDLLIMPEXP | encodeUTF8 (const vector_word &input, std::string &output) |
Encodes a 2-bytes UNICODE string into a UTF-8 string. | |
void MRPTDLLIMPEXP | encodeBase64 (const vector_byte &inputData, std::string &outString) |
Encode a sequence of bytes as a string in base-64. | |
bool MRPTDLLIMPEXP | decodeBase64 (const std::string &inString, vector_byte &outData) |
Decode a base-64 string into the original sequence of bytes. | |
bool MRPTDLLIMPEXP | launchProcess (const std::string &command) |
Executes the given command (which may contain a program + arguments), and waits until it finishes. | |
void MRPTDLLIMPEXP | setConsoleColor (TConsoleColor color, bool changeStdErr=false) |
Changes the text color in the console for the text written from now on. | |
std::string MRPTDLLIMPEXP | unitsFormat (const double val, int nDecimalDigits=2) |
This function implements formatting with the appropriate SI metric unit prefix: 1e-12->'p', 1e-9->'n', 1e-6->'u', 1e-3->'m', 1->'', 1e3->'K', 1e6->'M', 1e9->'G', 1e12->'T'. | |
Directories, files, and file names | |
std::string MRPTDLLIMPEXP | extractFileName (const std::string &filePath) |
Extract just the name (without extension) of a filename from a complete path plus name plus extension. | |
std::string MRPTDLLIMPEXP | getTempFileName () |
Returns the name of a proposed temporary file name. | |
std::string MRPTDLLIMPEXP | getcwd () |
Returns the current working directory. | |
bool MRPTDLLIMPEXP | createDirectory (const std::string &dirName) |
Creates a directory. | |
bool MRPTDLLIMPEXP | deleteFile (const std::string &fileName) |
Deletes a single file. | |
void MRPTDLLIMPEXP | deleteFiles (const std::string &s) |
Delete one or more files, especified by the (optional) path and the file name (including '?' or '*') - Use forward slash ('/') for directories for compatibility between Windows and Linux, since they will be internally traslated into backward slashes ('\') if MRPT is compiled under Windows. | |
bool MRPTDLLIMPEXP | renameFile (const std::string &oldFileName, const std::string &newFileName, std::string *error_msg=NULL) |
Renames a file - If the target path is different and the filesystem allows it, it will be moved to the new location. | |
bool MRPTDLLIMPEXP | deleteFilesInDirectory (const std::string &s, bool deleteDirectoryAsWell=false) |
Delete all the files in a given directory (nothing done if directory does not exists, or path is a file). | |
std::string MRPTDLLIMPEXP | extractFileExtension (const std::string &filePath, bool ignore_gz=false) |
Extract the extension of a filename. | |
std::string MRPTDLLIMPEXP | extractFileDirectory (const std::string &filePath) |
Extract the whole path (the directory) of a filename from a complete path plus name plus extension. | |
bool MRPTDLLIMPEXP | fileExists (const std::string &fileName) |
Test if a given file (or directory) exists. | |
bool MRPTDLLIMPEXP | directoryExists (const std::string &fileName) |
Test if a given directory exists (it fails if the given path refers to an existing file). | |
std::string MRPTDLLIMPEXP | fileNameStripInvalidChars (const std::string &filename) |
Replace invalid filename chars by underscores ('_'). |
typedef uint64_t mrpt::system::TTimeStamp |
A system independent time type, it holds the the number of 100-nanosecond intervals since January 1, 1601 (UTC).
mrpt::system::TTimeStamp MRPTDLLIMPEXP mrpt::system::buildTimestampFromParts | ( | const mrpt::system::TTimeParts & | p | ) |
mrpt::system::TTimeStamp MRPTDLLIMPEXP mrpt::system::buildTimestampFromPartsLocalTime | ( | const mrpt::system::TTimeParts & | p | ) |
Builds a timestamp from the parts (Parts are in local time).
void MRPTDLLIMPEXP mrpt::system::changeCurrentProcessPriority | ( | TProcessPriority | priority | ) |
Change the priority of the given process (it applies to all the threads, plus independent modifiers for each thread).
void MRPTDLLIMPEXP mrpt::system::changeThreadPriority | ( | const TThreadHandle & | threadHandle, | |
TThreadPriority | priority | |||
) |
void MRPTDLLIMPEXP mrpt::system::clearConsole | ( | ) |
Clears the console window.
bool MRPTDLLIMPEXP mrpt::system::createDirectory | ( | const std::string & | dirName | ) |
Creates a directory.
TThreadHandle MRPTDLLIMPEXP mrpt::system::createThread | ( | void(*)(void *) | func, | |
void * | param = NULL | |||
) |
Creates a new thread.
This function creates, and start, a new thread running some code given by a function. The thread function should end by returning as normal.
func | The function with the code to run in the thread. | |
param | The parameter to be passed to the new thread function. |
std::exception | If the operation fails |
std::string MRPTDLLIMPEXP mrpt::system::dateTimeLocalToString | ( | const mrpt::system::TTimeStamp & | t | ) |
Convert a timestamp into this textual form (in local time): YEAR/MONTH/DAY,HH:MM:SS.MMM.
Referenced by mrpt::math::saveMatrixToTextFile().
std::string MRPTDLLIMPEXP mrpt::system::dateTimeToString | ( | const mrpt::system::TTimeStamp & | t | ) |
Convert a timestamp into this textual form (UTC time): YEAR/MONTH/DAY,HH:MM:SS.MMM.
std::string MRPTDLLIMPEXP mrpt::system::dateToString | ( | const mrpt::system::TTimeStamp & | t | ) |
Convert a timestamp into this textual form: YEAR/MONTH/DAY.
bool MRPTDLLIMPEXP mrpt::system::decodeBase64 | ( | const std::string & | inString, | |
vector_byte & | outData | |||
) |
Decode a base-64 string into the original sequence of bytes.
void MRPTDLLIMPEXP mrpt::system::decodeUTF8 | ( | const std::string & | strUTF8, | |
vector_word & | out_uniStr | |||
) |
Decodes a UTF-8 string into an UNICODE string.
See http://en.wikipedia.org/wiki/UTF-8 and http://www.codeguru.com/cpp/misc/misc/multi-lingualsupport/article.php/c10451/.
bool MRPTDLLIMPEXP mrpt::system::deleteFile | ( | const std::string & | fileName | ) |
Deletes a single file.
For multiple files see deleteFiles
void MRPTDLLIMPEXP mrpt::system::deleteFiles | ( | const std::string & | s | ) |
Delete one or more files, especified by the (optional) path and the file name (including '?' or '*') - Use forward slash ('/') for directories for compatibility between Windows and Linux, since they will be internally traslated into backward slashes ('\') if MRPT is compiled under Windows.
bool MRPTDLLIMPEXP mrpt::system::deleteFilesInDirectory | ( | const std::string & | s, | |
bool | deleteDirectoryAsWell = false | |||
) |
Delete all the files in a given directory (nothing done if directory does not exists, or path is a file).
bool MRPTDLLIMPEXP mrpt::system::directoryExists | ( | const std::string & | fileName | ) |
Test if a given directory exists (it fails if the given path refers to an existing file).
void MRPTDLLIMPEXP mrpt::system::encodeBase64 | ( | const vector_byte & | inputData, | |
std::string & | outString | |||
) |
void MRPTDLLIMPEXP mrpt::system::encodeUTF8 | ( | const vector_word & | input, | |
std::string & | output | |||
) |
Encodes a 2-bytes UNICODE string into a UTF-8 string.
See http://en.wikipedia.org/wiki/UTF-8 and http://www.codeguru.com/cpp/misc/misc/multi-lingualsupport/article.php/c10451/.
double MRPTDLLIMPEXP mrpt::system::extractDayTimeFromTimestamp | ( | const mrpt::system::TTimeStamp & | t | ) |
Returns the number of seconds ellapsed from midnight in the given timestamp.
std::string MRPTDLLIMPEXP mrpt::system::extractFileDirectory | ( | const std::string & | filePath | ) |
Extract the whole path (the directory) of a filename from a complete path plus name plus extension.
This function works for either "/" or "\" directory separators.
std::string MRPTDLLIMPEXP mrpt::system::extractFileExtension | ( | const std::string & | filePath, | |
bool | ignore_gz = false | |||
) |
Extract the extension of a filename.
For example, for "dummy.cpp", it will return "cpp". If "ignore_gz" is true, the second extension will be returned if the file name ends in ".gz", for example, for "foo.map.gz", this will return "map".
std::string MRPTDLLIMPEXP mrpt::system::extractFileName | ( | const std::string & | filePath | ) |
Extract just the name (without extension) of a filename from a complete path plus name plus extension.
This function works for either "/" or "\" directory separators.
bool MRPTDLLIMPEXP mrpt::system::fileExists | ( | const std::string & | fileName | ) |
std::string MRPTDLLIMPEXP mrpt::system::fileNameStripInvalidChars | ( | const std::string & | filename | ) |
Replace invalid filename chars by underscores ('_').
Invalid chars are identified by those not being alphanumeric or: ".-#%$&()+[]{}"
std::string MRPTDLLIMPEXP mrpt::system::formatTimeInterval | ( | const double & | timeSeconds | ) |
Returns a formated string with the given time difference (passed as the number of seconds), as a string [H]H:MM:SS.MILISECS.
mrpt::system::TTimeStamp MRPTDLLIMPEXP mrpt::system::getCurrentLocalTime | ( | ) |
unsigned long MRPTDLLIMPEXP mrpt::system::getCurrentThreadId | ( | ) |
Returns the ID of the current thread.
void MRPTDLLIMPEXP mrpt::system::getCurrentThreadTimes | ( | time_t & | creationTime, | |
time_t & | exitTime, | |||
double & | cpuTime | |||
) |
Returns the creation and exit times of the current thread and its CPU time consumed.
creationTime | The creation time of the thread. | |
exitTime | The exit time of the thread, or undefined if it is still running. | |
cpuTime | The CPU time consumed by the thread, in seconds. |
std::exception | If the operation fails |
mrpt::system::TTimeStamp MRPTDLLIMPEXP mrpt::system::getCurrentTime | ( | ) |
std::string MRPTDLLIMPEXP mrpt::system::getcwd | ( | ) |
Returns the current working directory.
unsigned long MRPTDLLIMPEXP mrpt::system::getMemoryUsage | ( | ) |
Returns the memory occupied by this process, in bytes.
std::string MRPTDLLIMPEXP mrpt::system::getTempFileName | ( | ) |
Returns the name of a proposed temporary file name.
std::string MRPTDLLIMPEXP mrpt::system::intervalFormat | ( | const double | seconds | ) |
This function implements time interval formatting: Given a time in seconds, it will return a string describing the interval with the most appropriate unit.
E.g.: 1.23 year, 3.50 days, 9.3 hours, 5.3 minutes, 3.34 sec, 178.1 ms, 87.1 us.
bool MRPTDLLIMPEXP mrpt::system::isFinite | ( | double | f | ) |
Returns true if the number is non infinity.
bool MRPTDLLIMPEXP mrpt::system::isFinite | ( | float | f | ) |
Returns true if the number is non infinity.
bool MRPTDLLIMPEXP mrpt::system::isNaN | ( | double | f | ) |
Returns true if the number is NaN.
bool MRPTDLLIMPEXP mrpt::system::isNaN | ( | float | f | ) |
Returns true if the number is NaN.
void MRPTDLLIMPEXP mrpt::system::joinThread | ( | const TThreadHandle & | threadHandle | ) |
bool MRPTDLLIMPEXP mrpt::system::launchProcess | ( | const std::string & | command | ) |
Executes the given command (which may contain a program + arguments), and waits until it finishes.
bool MRPTDLLIMPEXP mrpt::system::loadBinaryFile | ( | vector_byte & | out_data, | |
const std::string & | fileName | |||
) |
Loads a entire file as a vector of bytes.
std::string MRPTDLLIMPEXP mrpt::system::lowerCase | ( | const std::string & | str | ) |
std::string MRPTDLLIMPEXP mrpt::system::MRPT_getCompilationDate | ( | ) |
Returns the MRPT compilation date.
std::string MRPTDLLIMPEXP mrpt::system::MRPT_getVersion | ( | ) |
Returns a string describing the MRPT version including the SVN number.
Referenced by mrpt::math::saveMatrixToTextFile().
mrpt::system::TTimeStamp MRPTDLLIMPEXP mrpt::system::now | ( | ) | [inline] |
A shortcut for system::getCurrentTime.
Definition at line 465 of file os.h.
References getCurrentTime().
Referenced by mrpt::math::saveMatrixToTextFile().
void MRPTDLLIMPEXP mrpt::system::pause | ( | const std::string & | msg = std::string("Press any key to continue...") |
) |
Shows the message "Press any key to continue" (or other custom message) to the current standard output and returns when a key is pressed.
void MRPTDLLIMPEXP mrpt::system::registerFatalExceptionHandlers | ( | ) |
Call this to register handlers for fatal erros (memory access,etc) that show useful debug information (It is called automatically normally, no need for the user to explicitly call this method.
).
bool MRPTDLLIMPEXP mrpt::system::renameFile | ( | const std::string & | oldFileName, | |
const std::string & | newFileName, | |||
std::string * | error_msg = NULL | |||
) |
Renames a file - If the target path is different and the filesystem allows it, it will be moved to the new location.
mrpt::system::TTimeStamp MRPTDLLIMPEXP mrpt::system::secondsToTimestamp | ( | const double & | nSeconds | ) |
Transform a time interval (in seconds) into TTimeStamp (e.g.
which can be added to an existing valid timestamp)
void MRPTDLLIMPEXP mrpt::system::setConsoleColor | ( | TConsoleColor | color, | |
bool | changeStdErr = false | |||
) |
Changes the text color in the console for the text written from now on.
The parameter "color" can be any value in TConsoleColor.
By default the color of "cout" is changed, unless changeStdErr=true, in which case "cerr" is changed.
void MRPTDLLIMPEXP mrpt::system::sleep | ( | int | time_ms | ) |
An OS-independent method for sending the current thread to "sleep" for a given period of time.
time_ms | The sleep period, in miliseconds. |
std::string MRPTDLLIMPEXP mrpt::system::stack_trace | ( | bool | calling_from_exception = false |
) |
Dumps the current program stack with detailed information of source files and lines.
This function requires MRPT linked against wxWidgets. Otherwise, an empty string is returned. File names and lines won't be available in release builds.
char MRPTDLLIMPEXP* mrpt::system::strtok | ( | char * | str, | |
const char * | strDelimit, | |||
char ** | context | |||
) |
An OS-independent method for tokenizing a string.
The extra parameter "context" must be a pointer to a "char*" variable, which needs no initialization and is used to save information between calls to strtok.
mrpt::system::TTimeStamp MRPTDLLIMPEXP mrpt::system::time_tToTimestamp | ( | const time_t & | t | ) |
mrpt::system::TTimeStamp MRPTDLLIMPEXP mrpt::system::time_tToTimestamp | ( | const double & | t | ) |
Transform from standard "time_t" (actually a double number, it can contain fractions of seconds) to TTimeStamp.
double MRPTDLLIMPEXP mrpt::system::timeDifference | ( | const mrpt::system::TTimeStamp & | t_first, | |
const mrpt::system::TTimeStamp & | t_later | |||
) |
Retuns the time difference from t1 to t2 (positive if t2 is posterior to t1), in seconds.
std::string MRPTDLLIMPEXP mrpt::system::timeLocalToString | ( | const mrpt::system::TTimeStamp & | t | ) |
Convert a timestamp into this textual form (in local time): HH:MM:SS.MMMMMM.
void MRPTDLLIMPEXP mrpt::system::timestampToParts | ( | TTimeStamp | t, | |
TTimeParts & | p | |||
) |
Gets the individual parts of a date/time (days, hours, minutes, seconds).
double MRPTDLLIMPEXP mrpt::system::timestampTotime_t | ( | const mrpt::system::TTimeStamp & | t | ) |
Transform from TTimeStamp to standard "time_t" (actually a double number, it can contain fractions of seconds).
std::string MRPTDLLIMPEXP mrpt::system::timeToString | ( | const mrpt::system::TTimeStamp & | t | ) |
Convert a timestamp into this textual form (UTC): HH:MM:SS.MMMMMM.
void MRPTDLLIMPEXP mrpt::system::tokenize | ( | const std::string & | inString, | |
const std::string & | inDelimiters, | |||
std::vector< std::string > & | outTokens | |||
) |
Tokenizes a string according to a set of delimiting characters.
Example:
std::vector<std::string> tokens; tokenize( " - Pepe-Er Muo"," -",tokens);
Will generate 3 tokens:
void MRPTDLLIMPEXP mrpt::system::tokenize | ( | const std::string & | inString, | |
const std::string & | inDelimiters, | |||
std::deque< std::string > & | outTokens | |||
) |
Tokenizes a string according to a set of delimiting characters.
Example:
std::vector<std::string> tokens; tokenize( " - Pepe-Er Muo"," -",tokens);
Will generate 3 tokens:
std::string MRPTDLLIMPEXP mrpt::system::toLowerCase | ( | const std::string & | str | ) |
std::string MRPTDLLIMPEXP mrpt::system::toUpperCase | ( | const std::string & | str | ) |
std::string MRPTDLLIMPEXP mrpt::system::trim | ( | const std::string & | str | ) |
Removes leading and trailing spaces:.
std::string MRPTDLLIMPEXP mrpt::system::unitsFormat | ( | const double | val, | |
int | nDecimalDigits = 2 | |||
) |
This function implements formatting with the appropriate SI metric unit prefix: 1e-12->'p', 1e-9->'n', 1e-6->'u', 1e-3->'m', 1->'', 1e3->'K', 1e6->'M', 1e9->'G', 1e12->'T'.
std::string MRPTDLLIMPEXP mrpt::system::upperCase | ( | const std::string & | str | ) |
bool MRPTDLLIMPEXP mrpt::system::vectorToBinaryFile | ( | const vector_byte & | vec, | |
const std::string & | fileName | |||
) |
Saves a vector directly as a binary dump to a file:.
bool MRPTDLLIMPEXP mrpt::system::vectorToTextFile | ( | const std::vector< size_t > & | vec, | |
const std::string & | fileName, | |||
bool | append = false , |
|||
bool | byRows = false | |||
) |
A useful function for debuging, which saves a std::vector into a text file (compat.
with MATLAB)
bool MRPTDLLIMPEXP mrpt::system::vectorToTextFile | ( | const std::vector< int > & | vec, | |
const std::string & | fileName, | |||
bool | append = false , |
|||
bool | byRows = false | |||
) |
A useful function for debuging, which saves a std::vector into a text file (compat.
with MATLAB)
bool MRPTDLLIMPEXP mrpt::system::vectorToTextFile | ( | const std::vector< double > & | vec, | |
const std::string & | fileName, | |||
bool | append = false , |
|||
bool | byRows = false | |||
) |
A useful function for debuging, which saves a std::vector into a text file (compat.
with MATLAB)
bool MRPTDLLIMPEXP mrpt::system::vectorToTextFile | ( | const std::vector< float > & | vec, | |
const std::string & | fileName, | |||
bool | append = false , |
|||
bool | byRows = false | |||
) |
A useful function for debuging, which saves a std::vector into a text file (compat.
with MATLAB)
Page generated by Doxygen 1.5.7.1 for MRPT 0.7.1 SVN: at Mon Aug 17 23:10:56 EDT 2009 |