Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

Defines.h

Go to the documentation of this file.
00001 
00042 #ifndef _AMIRE_COMMON_DEFINES_H
00043 #define _AMIRE_COMMON_DEFINES_H
00044 
00045 #define USE_OSG
00046 
00047 #include <string>
00048 #include <iostream>
00049 #include <vector>
00050 #include <math.h>
00051 #include <hash_map>
00052 #ifdef WIN32
00053 #include <windows.h>
00054 #else
00055 #include <sys/types.h>
00056 #endif
00057 #include <GL/gl.h>
00058 #include <GL/glu.h>
00059 
00060 #include <amire/common/DllSupport.h>
00061 #include <amire/common/Assert.h>
00062 #include <osg/Referenced>
00063 #include <osg/ref_ptr>
00064 
00068 #ifdef WIN32
00069   #define STD_HASH_MULTIMAP(keyType, valueType, hashAndCompareClass) std::hash_multimap<keyType, valueType, hashAndCompareClass >
00070 #else
00071   #define STD_HASH_MULTIMAP(keyType, valueType, hashAndCompareClass) std::hash_multimap<keyType, valueType, hashAndCompareClass, hashAndCompareClass >
00072 #endif
00073 
00077 #ifdef WIN32
00078   #define STD_HASH_MAP(keyType, valueType, hashAndCompareClass) std::hash_map<keyType, valueType, hashAndCompareClass >
00079 #else
00080   #define STD_HASH_MAP(keyType, valueType, hashAndCompareClass) std::hash_map<keyType, valueType, hashAndCompareClass, hashAndCompareClass >
00081 #endif
00082 
00086 #ifdef WIN32
00087   #define STD_HASH_SET(keyType, hashAndCompareClass) std::hash_set<keyType, hashAndCompareClass >
00088 #else
00089   #define STD_HASH_SET(keyType, hashAndCompareClass) std::hash_set<keyType, hashAndCompareClass, hashAndCompareClass >
00090 #endif
00091 
00092 #ifdef WIN32
00093   #define S_ISBLK(m)      (((m)&_S_IFMT) == _S_IFBLK)
00094   #define S_ISCHR(m)      (((m)&_S_IFMT) == _S_IFCHR)
00095   #define S_ISDIR(m)      (((m)&_S_IFMT) == _S_IFDIR)
00096   #define S_ISFIFO(m)     (((m)&_S_IFMT) == _S_IFIFO)
00097   #define S_ISREG(m)      (((m)&_S_IFMT) == _S_IFREG)
00098   #define S_ISLNK(m)      (((m)&_S_IFMT) == _S_IFLNK)
00099   #define S_ISSOCK(m)     (((m)&_S_IFMT) == _S_IFSOCK)
00100 #endif
00101 
00102 #ifndef M_PI
00103 #define M_PI            3.14159265358979323846
00104 #endif
00105 
00106 namespace amire {
00107   namespace common {
00111     class AMIRE_EXPORT_API HashCompareString {
00112     public:
00113       enum {
00114         bucket_size = 4,
00115         min_buckets = 8
00116       };
00117 
00121       size_t operator()(const std::string &str) const {
00122         unsigned long hashCode = 0; 
00123         for (const char *data = str.data(); *data; ++data) {
00124           hashCode = 5 * hashCode + *data;
00125         }
00126         return size_t(hashCode);
00127       }
00128 
00132       int operator()(const std::string &str1, const std::string &str2) const {
00133         return str1.compare(str2);
00134       }
00135     };
00136 
00140     template <class destType, class sourceType> inline destType *guarded_cast(sourceType *pointer) {
00141       destType *result = dynamic_cast<destType*>(pointer);
00142       ASSERT1(result != NULL, "typecast failed!");
00143       return result;
00144     }
00145   }
00146 }
00147 #endif

Generated on Tue May 20 17:23:52 2003 for AMIRE-Framework by doxygen1.3