macros.h
Go to the documentation of this file.
00001 // g2o - General Graph Optimization
00002 // Copyright (C) 2011 R. Kuemmerle, G. Grisetti, W. Burgard
00003 //
00004 // g2o is free software: you can redistribute it and/or modify
00005 // it under the terms of the GNU Lesser General Public License as published
00006 // by the Free Software Foundation, either version 3 of the License, or
00007 // (at your option) any later version.
00008 //
00009 // g2o is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 // GNU Lesser General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU Lesser General Public License
00015 // along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016 
00017 #include <limits>
00018 #include <cmath>
00019 
00020 #ifndef G2O_MACROS_H
00021 #define G2O_MACROS_H
00022 
00023 #ifndef DEG2RAD
00024 #define DEG2RAD(x) ((x) * 0.01745329251994329575)
00025 #endif
00026 
00027 #ifndef RAD2DEG
00028 #define RAD2DEG(x) ((x) * 57.29577951308232087721)
00029 #endif
00030 
00031 #if defined(__GNUC__)
00032 #  define G2O_ATTRIBUTE_CONSTRUCTOR __attribute__ ((constructor))
00033 #  define G2O_ATTRIBUTE_UNUSED __attribute__((unused))
00034 #  define G2O_ATTRIBUTE_FORMAT12 __attribute__ ((format (printf, 1, 2)))
00035 #  define G2O_ATTRIBUTE_FORMAT23 __attribute__ ((format (printf, 2, 3)))
00036 #else
00037 #  ifndef __PRETTY_FUNCTION__
00038 #    define __PRETTY_FUNCTION__ ""
00039 #  endif
00040 #  define G2O_ATTRIBUTE_CONSTRUCTOR
00041 #  define G2O_ATTRIBUTE_UNUSED
00042 #  define G2O_ATTRIBUTE_FORMAT12
00043 #  define G2O_ATTRIBUTE_FORMAT23
00044 #endif
00045 
00046 inline bool g2o_isnan(double x)
00047 {
00048 #if defined(__GNUC__)
00049   return std::isnan(x);
00050 #else
00051   return x != x;
00052 #endif
00053 }
00054 
00055 // some macros that are only useful for c++
00056 #ifdef __cplusplus
00057 
00058 #define G2O_FSKIP_LINE(f) \
00059    {char c=' ';while(c != '\n' && f.good() && !(f).eof()) (f).get(c);}
00060 
00061 #ifndef PVAR
00062   #define PVAR(s) \
00063     #s << " = " << (s) << std::flush
00064 #endif
00065 
00066 #ifndef FIXED
00067 #define FIXED(s) \
00068   std::fixed << s << std::resetiosflags(std::ios_base::fixed)
00069 #endif
00070 
00071 #endif // __cplusplus
00072 
00073 #endif


re_vision
Author(s): Dorian Galvez-Lopez
autogenerated on Sun Jan 5 2014 11:31:43