Main MRPT website > C++ reference for MRPT 1.4.0
Namespaces | Enumerations | Functions
OS and compiler abstraction (in #include <mrpt/system/os.h>)

Detailed Description

Collaboration diagram for OS and compiler abstraction (in #include <mrpt/system/os.h>):

Namespaces

namespace  mrpt::system::os
 This namespace provides a OS-independent interface to low-level functions.
 

Enumerations

enum  mrpt::system::TConsoleColor { mrpt::system::CONCOL_NORMAL = 0 , mrpt::system::CONCOL_BLUE = 1 , mrpt::system::CONCOL_GREEN = 2 , mrpt::system::CONCOL_RED = 4 }
 For use in setConsoleColor. More...
 

Functions

int BASE_IMPEXP mrpt::system::os::sprintf (char *buf, size_t bufSize, const char *format,...) MRPT_NO_THROWS MRPT_printf_format_check(3
 An OS-independent version of sprintf (Notice the bufSize param, which may be ignored in some compilers)
 
int BASE_IMPEXP int BASE_IMPEXP mrpt::system::os::vsprintf (char *buf, size_t bufSize, const char *format, va_list args) MRPT_NO_THROWS
 An OS-independent version of vsprintf (Notice the bufSize param, which may be ignored in some compilers)
 
int BASE_IMPEXP mrpt::system::os::vsnprintf (char *buf, size_t bufSize, const char *format, va_list args) MRPT_NO_THROWS
 An OS-independent version of vsnprintf (Notice the bufSize param, which may be ignored in some compilers)
 
FILE BASE_IMPEXPmrpt::system::os::fopen (const char *fileName, const char *mode) MRPT_NO_THROWS
 An OS-independent version of fopen.
 
FILE BASE_IMPEXPmrpt::system::os::fopen (const std::string &fileName, const char *mode) MRPT_NO_THROWS
 An OS-independent version of fopen (std::string version)
 
int BASE_IMPEXP mrpt::system::os::fprintf (FILE *fil, const char *format,...) MRPT_NO_THROWS MRPT_printf_format_check(2
 An OS-independent version of fprintf.
 
int BASE_IMPEXP void BASE_IMPEXP mrpt::system::os::fclose (FILE *f)
 An OS-independent version of fscanf.
 
char BASE_IMPEXPmrpt::system::os::strcat (char *dest, size_t destSize, const char *source) MRPT_NO_THROWS
 An OS-independent version of strcat.
 
char BASE_IMPEXPmrpt::system::os::strcpy (char *dest, size_t destSize, const char *source) MRPT_NO_THROWS
 An OS-independent version of strcpy.
 
int BASE_IMPEXP mrpt::system::os::_strcmp (const char *str1, const char *str2) MRPT_NO_THROWS
 An OS-independent version of strcmp.
 
int BASE_IMPEXP mrpt::system::os::_strcmpi (const char *str1, const char *str2) MRPT_NO_THROWS
 An OS-independent version of strcmpi.
 
int BASE_IMPEXP mrpt::system::os::_strncmp (const char *str, const char *subStr, size_t count) MRPT_NO_THROWS
 An OS-independent version of strncmp.
 
int BASE_IMPEXP mrpt::system::os::_strnicmp (const char *str, const char *subStr, size_t count) MRPT_NO_THROWS
 An OS-independent version of strnicmp.
 
int64_t BASE_IMPEXP mrpt::system::os::_strtoll (const char *nptr, char **endptr, int base)
 An OS-independent version of strtoll.
 
uint64_t BASE_IMPEXP mrpt::system::os::_strtoull (const char *nptr, char **endptr, int base)
 An OS-independent version of strtoull.
 
time_t BASE_IMPEXP mrpt::system::os::timegm (struct tm *tm)
 An OS-independent version of timegm (which is not present in all compilers): converts a time structure into an UTM time_t.
 
void BASE_IMPEXP mrpt::system::os::memcpy (void *dest, size_t destSize, const void *src, size_t copyCount) MRPT_NO_THROWS
 An OS and compiler independent version of "memcpy".
 
int BASE_IMPEXP mrpt::system::os::getch () MRPT_NO_THROWS
 An OS-independent version of getch, which waits until a key is pushed.
 
bool BASE_IMPEXP mrpt::system::os::kbhit () MRPT_NO_THROWS
 An OS-independent version of kbhit, which returns true if a key has been pushed.
 
void BASE_IMPEXP mrpt::system::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 BASE_IMPEXP mrpt::system::clearConsole ()
 Clears the console window.
 
std::string BASE_IMPEXP mrpt::system::MRPT_getCompilationDate ()
 Returns the MRPT source code timestamp, according to the Reproducible-Builds specifications: https://reproducible-builds.org/specs/source-date-epoch/

 
std::string BASE_IMPEXP mrpt::system::MRPT_getVersion ()
 Returns a string describing the MRPT version.
 
const std::string BASE_IMPEXPmrpt::system::getMRPTLicense ()
 Returns a const ref to a text with the same text that appears at the beginning of each MRPT file (useful for displaying the License text in GUIs)
 
void BASE_IMPEXP mrpt::system::registerFatalExceptionHandlers ()
 Since MRPT 1.3.0 this function does nothing.
 
void BASE_IMPEXP mrpt::system::setConsoleColor (TConsoleColor color, bool changeStdErr=false)
 Changes the text color in the console for the text written from now on.
 

Enumeration Type Documentation

◆ TConsoleColor

For use in setConsoleColor.

Enumerator
CONCOL_NORMAL 
CONCOL_BLUE 
CONCOL_GREEN 
CONCOL_RED 

Definition at line 165 of file os.h.

Function Documentation

◆ _strcmp()

int BASE_IMPEXP mrpt::system::os::_strcmp ( const char *  str1,
const char *  str2 
)

An OS-independent version of strcmp.

Returns
It will return 0 when both strings are equal, casi sensitive.

◆ _strcmpi()

int BASE_IMPEXP mrpt::system::os::_strcmpi ( const char *  str1,
const char *  str2 
)

An OS-independent version of strcmpi.

Returns
It will return 0 when both strings are equal, casi insensitive.

◆ _strncmp()

int BASE_IMPEXP mrpt::system::os::_strncmp ( const char *  str,
const char *  subStr,
size_t  count 
)

An OS-independent version of strncmp.

Returns
It will return 0 when both strings are equal, casi sensitive.

◆ _strnicmp()

int BASE_IMPEXP mrpt::system::os::_strnicmp ( const char *  str,
const char *  subStr,
size_t  count 
)

An OS-independent version of strnicmp.

Returns
It will return 0 when both strings are equal, casi insensitive.

◆ _strtoll()

int64_t BASE_IMPEXP mrpt::system::os::_strtoll ( const char *  nptr,
char **  endptr,
int  base 
)

An OS-independent version of strtoll.

◆ _strtoull()

uint64_t BASE_IMPEXP mrpt::system::os::_strtoull ( const char *  nptr,
char **  endptr,
int  base 
)

An OS-independent version of strtoull.

◆ clearConsole()

void BASE_IMPEXP mrpt::system::clearConsole ( )

Clears the console window.

◆ fclose()

int BASE_IMPEXP void BASE_IMPEXP mrpt::system::os::fclose ( FILE *  f)

An OS-independent version of fscanf.

Returns
The number of fields correctly assigned An OS-independent version of fclose.
Exceptions
std::exceptionOn trying to close a NULL file descriptor.

◆ fopen() [1/2]

FILE BASE_IMPEXP * mrpt::system::os::fopen ( const char *  fileName,
const char *  mode 
)

An OS-independent version of fopen.

Returns
It will always return NULL on any error.

◆ fopen() [2/2]

FILE BASE_IMPEXP * mrpt::system::os::fopen ( const std::string &  fileName,
const char *  mode 
)

An OS-independent version of fopen (std::string version)

Returns
It will always return NULL on any error.

◆ fprintf()

int BASE_IMPEXP mrpt::system::os::fprintf ( FILE *  fil,
const char *  format,
  ... 
)

An OS-independent version of fprintf.

◆ getch()

int BASE_IMPEXP mrpt::system::os::getch ( )

An OS-independent version of getch, which waits until a key is pushed.

Returns
The pushed key code

◆ getMRPTLicense()

const std::string BASE_IMPEXP & mrpt::system::getMRPTLicense ( )

Returns a const ref to a text with the same text that appears at the beginning of each MRPT file (useful for displaying the License text in GUIs)

◆ kbhit()

bool BASE_IMPEXP mrpt::system::os::kbhit ( )

An OS-independent version of kbhit, which returns true if a key has been pushed.

◆ memcpy()

void BASE_IMPEXP mrpt::system::os::memcpy ( void *  dest,
size_t  destSize,
const void *  src,
size_t  copyCount 
)

An OS and compiler independent version of "memcpy".

◆ MRPT_getCompilationDate()

std::string BASE_IMPEXP mrpt::system::MRPT_getCompilationDate ( )

Returns the MRPT source code timestamp, according to the Reproducible-Builds specifications: https://reproducible-builds.org/specs/source-date-epoch/

◆ MRPT_getVersion()

std::string BASE_IMPEXP mrpt::system::MRPT_getVersion ( )

Returns a string describing the MRPT version.

◆ pause()

void BASE_IMPEXP 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.

◆ registerFatalExceptionHandlers()

void BASE_IMPEXP mrpt::system::registerFatalExceptionHandlers ( )

Since MRPT 1.3.0 this function does nothing.

◆ setConsoleColor()

void BASE_IMPEXP 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.

◆ sprintf()

int BASE_IMPEXP mrpt::system::os::sprintf ( char *  buf,
size_t  bufSize,
const char *  format,
  ... 
)

An OS-independent version of sprintf (Notice the bufSize param, which may be ignored in some compilers)

See also
utils::format

Referenced by mrpt::gui::CDisplayWindow::showImagesAndMatchedPoints().

◆ strcat()

char BASE_IMPEXP * mrpt::system::os::strcat ( char *  dest,
size_t  destSize,
const char *  source 
)

An OS-independent version of strcat.

Returns
It will always return the "dest" pointer.

◆ strcpy()

char BASE_IMPEXP * mrpt::system::os::strcpy ( char *  dest,
size_t  destSize,
const char *  source 
)

An OS-independent version of strcpy.

Returns
It will always return the "dest" pointer.

◆ timegm()

time_t BASE_IMPEXP mrpt::system::os::timegm ( struct tm *  tm)

An OS-independent version of timegm (which is not present in all compilers): converts a time structure into an UTM time_t.

◆ vsnprintf()

int BASE_IMPEXP mrpt::system::os::vsnprintf ( char *  buf,
size_t  bufSize,
const char *  format,
va_list  args 
)

An OS-independent version of vsnprintf (Notice the bufSize param, which may be ignored in some compilers)

◆ vsprintf()

int BASE_IMPEXP int BASE_IMPEXP mrpt::system::os::vsprintf ( char *  buf,
size_t  bufSize,
const char *  format,
va_list  args 
)

An OS-independent version of vsprintf (Notice the bufSize param, which may be ignored in some compilers)




Page generated by Doxygen 1.9.6 for MRPT 1.4.0 SVN: at Fri Jan 20 00:13:14 UTC 2023