rtcBase.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2009
00003  * Robert Bosch LLC
00004  * Research and Technology Center North America
00005  * Palo Alto, California
00006  *
00007  * All rights reserved.
00008  *
00009  *------------------------------------------------------------------------------
00010  * project ....: Autonomous Technologies
00011  * file .......: rtcBase.h
00012  * authors ....: Benjamin Pitzer, Soeren Kammel
00013  * organization: Robert Bosch LLC
00014  * creation ...: 01/21/2009
00015  * modified ...: $Date: 2009-03-20 11:36:51 -0700 (Fri, 20 Mar 2009) $
00016  * changed by .: $Author: wg75pal $
00017  * revision ...: $Revision: 105 $
00018  */
00019 #ifndef RTC_BASE_H_
00020 #define RTC_BASE_H_
00021 
00022 //== C Language Library Includes ===============================================
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 //# include <windows.h>
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>            // Use the C99 official header
00053 #endif
00054 
00055 //== RTC Library Includes ======================================================
00056 #include "rtc/rtcTime.h"
00057 #include "rtc/rtcMisc.h"
00058 
00059 #include "rtc/rtcException.h"
00060 #include "rtc/rtcStringTools.h"
00061 
00062 //== NAMESPACES ================================================================
00063 namespace rtc {
00064 
00065 // error, warning and verbose functions
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 // commandline parameters
00086 
00087 // checks argv for occurence of "-param"
00088 bool rtc_find_commandline_parameter(int argc, char **argv, const char* param);
00089 // checks argv for occurence of "-param param_value" and returns param_value
00090 bool rtc_find_commandline_parameter(int argc, char **argv, const char* param, char* param_value);
00091 // displays a progress bar
00092 void rtc_progress_bar_print(double current, double total);
00093 
00094 // A macro to disallow the copy constructor and operator= functions
00095 // This should be used in the private: declarations for a class
00096 #define DISALLOW_COPY_AND_ASSIGN(TypeName) \
00097   TypeName(const TypeName&);               \
00098   void operator=(const TypeName&)
00099 
00100 // math
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 } // namespace rtc
00115 //==============================================================================
00116 #endif // RTC_BASE_H_ defined
00117 //==============================================================================


rtc
Author(s): Benjamin Pitzer
autogenerated on Thu Jan 2 2014 11:04:53