Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef RTC_BASE_H_
00020 #define RTC_BASE_H_
00021
00022
00023 #include <cstdio>
00024 #include <cstdlib>
00025 #include <cstdarg>
00026 #include <cctype>
00027 #include <cstring>
00028 #include <csignal>
00029 #include <cmath>
00030 #include <ctime>
00031 #include <cerrno>
00032 #include <climits>
00033 #include <cfloat>
00034 #include <assert.h>
00035
00036 #ifdef _MSC_VER
00037
00038 # pragma warning(disable: 4100 4267 4311 4305)
00039 typedef signed __int8 int8_t;
00040 typedef signed __int16 int16_t;
00041 typedef signed __int32 int32_t;
00042 typedef signed __int64 int64_t;
00043 typedef unsigned __int8 uint8_t;
00044 typedef unsigned __int16 uint16_t;
00045 typedef unsigned __int32 uint32_t;
00046 typedef unsigned __int64 uint64_t;
00047 #else
00048 # include <unistd.h>
00049 # include <sys/time.h>
00050 # include <sys/types.h>
00051 # include <sys/stat.h>
00052 # include <stdint.h>
00053 #endif
00054
00055
00056 #include "rtc/rtcTime.h"
00057 #include "rtc/rtcMisc.h"
00058
00059 #include "rtc/rtcException.h"
00060 #include "rtc/rtcStringTools.h"
00061
00062
00063 namespace rtc {
00064
00065
00066 #ifdef _MSC_VER
00067 void rtc_perror(const char* fmt, ...);
00068 void rtc_verbose(const char *fmt, ...);
00069 void rtc_warn(const char* fmt, ...);
00070 void rtc_die(const char* fmt, ...);
00071 void rtc_die_syserror(const char* fmt, ...);
00072 #else
00073 void rtc_perror(const char* fmt, ...) __attribute__ ((format (printf, 1, 2)));
00074 void rtc_verbose(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
00075 void rtc_warn(const char* fmt, ...) __attribute__ ((format (printf, 1, 2)));
00076 void rtc_die(const char* fmt, ...) __attribute__ ((format (printf, 1, 2)));
00077 void rtc_die_syserror(const char* fmt, ...) __attribute__ ((format (printf, 1, 2)));
00078 #endif
00079 void rtc_carp_set_verbose(int verbosity);
00080 int rtc_carp_get_verbose(void);
00081 void rtc_carp_set_output(FILE *output);
00082
00083 #define rtc_test_alloc(X) do {if ((void *)(X) == NULL) rtc_die("Out of memory in %s, (%s, line %d).\n", __FUNCTION__, __FILE__, __LINE__); } while (0)
00084
00085
00086
00087
00088 bool rtc_find_commandline_parameter(int argc, char **argv, const char* param);
00089
00090 bool rtc_find_commandline_parameter(int argc, char **argv, const char* param, char* param_value);
00091
00092 void rtc_progress_bar_print(double current, double total);
00093
00094
00095
00096 #define DISALLOW_COPY_AND_ASSIGN(TypeName) \
00097 TypeName(const TypeName&); \
00098 void operator=(const TypeName&)
00099
00100
00101 #ifdef _MSC_VER
00102 template <class T> inline bool isnan(T x) {
00103 return _isnan(x);
00104 }
00105 template <class T> inline bool isinf(T x) {
00106 return _isinf(x);
00107 }
00108 template <class T> inline T round(T x) {
00109 return floor(x+0.5);
00110 }
00111 #endif
00112
00113
00114 }
00115
00116 #endif // RTC_BASE_H_ defined
00117