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
00020
00021
00022
00023
00030 #ifndef GENAPI_GENAPIUTILITIES_DEF_H_
00031 #define GENAPI_GENAPIUTILITIES_DEF_H_
00032
00033 #if defined (_WIN32)
00034 # include <windows.h>
00035 #endif
00036
00037 #include <GenICamVersion.h>
00038
00039 #include <Base/GCTypes.h>
00040 #include <Base/GCString.h>
00041 #include <Base/GCStringVector.h>
00042 #include <Base/GCException.h>
00043 #include <Base/GCLinkage.h>
00044
00045 #if defined(UNDER_RTSS)
00046 #include <Base/GCRTSSUtilities.h>
00047 #endif // defined(UNDER_RTSS)
00048
00049 #if defined(UNDER_RTSS)
00050 #define USE_TEMP_CACHE_FILE 0
00051 #else
00052 #define USE_TEMP_CACHE_FILE 1
00053 #endif // defined(UNDER_RTSS)
00054
00055 #if defined(UNDER_RTSS)
00056 #define USE_TEMP_CACHE_FILE 0
00057 #else
00058 #define USE_TEMP_CACHE_FILE 1
00059 #endif // defined(UNDER_RTSS)
00060
00061 #if defined (_MSC_VER)
00062 # if defined (_WIN64)
00063 # define PLATFORM_NAME "Win64_x64"
00064 # else
00065 # define PLATFORM_NAME "Win32_i86"
00066 # endif
00067 #elif defined (__GNUC__)
00068 # define GENICAM_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
00069 # if defined (__LP64__)
00070 # if defined (__linux__)
00071 # define PLATFORM_NAME "Linux64_x64"
00072 # elif defined (__APPLE__)
00073 # define PLATFORM_NAME "Maci64_x64"
00074 # else
00075 # error Unknown Platform
00076 # endif
00077 # else
00078 # if defined (__linux__)
00079 # define PLATFORM_NAME "Linux32_i86"
00080 # elif defined (__APPLE__)
00081 # error Unsupported Platform
00082 # elif defined (VXWORKS)
00083 # define PLATFORM_NAME "VxWorks_PPC"
00084 # else
00085 # error Unknown Platform
00086 # endif
00087 # endif
00088 #else
00089 # error Unknown Platform
00090 #endif
00091
00092 #ifndef GC_COUNTOF
00093 # define GC_COUNTOF(arr) (sizeof (arr) / sizeof (arr)[0] )
00094 #endif
00095
00096 namespace GENICAM_NAMESPACE
00097 {
00100 template<typename Td, typename Ts>
00101 inline Td INTEGRAL_CAST2( Ts s )
00102 {
00103 const Td d = static_cast<Td>( s );
00104 if ( static_cast<Ts>( d ) != s ){
00105 throw RUNTIME_EXCEPTION("INTEGRAL_CAST failed");
00106 }
00107 return d;
00108 }
00109
00112 template<typename T>
00113 inline T INTEGRAL_CAST( int64_t ll )
00114 {
00115 return INTEGRAL_CAST2<T, int64_t>( ll );
00116 }
00117
00119 GCBASE_API bool DoesEnvironmentVariableExist( const gcstring &VariableName );
00120
00123 GCBASE_API gcstring GetValueOfEnvironmentVariable( const gcstring &VariableName );
00124
00127 GCBASE_API bool GetValueOfEnvironmentVariable(const gcstring &VariableName, gcstring &VariableContent );
00128
00129 #if defined(UNDER_RTSS)
00130
00131 GCBASE_API bool DoesFileExist( const gcstring &FilePath );
00132 #endif // defined(UNDER_RTSS)
00133
00136 GCBASE_API gcstring UrlEncode(const GENICAM_NAMESPACE::gcstring& Input);
00137
00140 GCBASE_API GENICAM_NAMESPACE::gcstring UrlDecode(const GENICAM_NAMESPACE::gcstring& Input);
00141
00144 GCBASE_API void ReplaceEnvironmentVariables(gcstring &Buffer, bool ReplaceBlankBy20 = false);
00145
00146
00148
00153 GCBASE_API gcstring GetGenICamCacheFolder(void);
00154
00156
00161 GCBASE_API gcstring GetGenICamLogConfig(void);
00162
00164
00169 GCBASE_API gcstring GetGenICamCLProtocolFolder(void);
00170
00172 GCBASE_API void SetGenICamCacheFolder(const gcstring& path);
00173
00175 GCBASE_API void SetGenICamLogConfig(const gcstring& path);
00176
00178 GCBASE_API void SetGenICamCLProtocolFolder(const gcstring& path);
00179
00181 GCBASE_API void Tokenize(
00182 const gcstring& str,
00183 gcstring_vector& tokens,
00184 const gcstring& delimiters = " "
00185 );
00186
00188 GCBASE_API void GetFiles(
00189 const gcstring &FileTemplate,
00190 gcstring_vector &FileNames,
00191 const bool DirectoriesOnly = false );
00192
00194 GCBASE_API gcstring GetModulePathFromFunction(void *pFunction);
00195 }
00196
00197 #define GENICAM_UNUSED(unused_var) ((void)(unused_var))
00198
00199 #if !defined(GENICAM_DEPRECATED)
00200 # if defined(__GNUC__) && (__GNUC__ >= 3) && defined(__GNUC_MINOR__) && (__GNUC_MINOR__ >= 1) // is at least GCC 3.1 compiler?
00201 # define GENICAM_DEPRECATED(FUNCTION) FUNCTION __attribute__ ((deprecated))
00202 # elif defined(_MSC_VER) && (_MSC_VER >= 1300) // is at least VC 2003 compiler?
00203 # define GENICAM_DEPRECATED(FUNCTION) __declspec(deprecated) FUNCTION
00204 # else
00205 # define GENICAM_DEPRECATED(FUNCTION) FUNCTION
00206 # endif // compiler check
00207 #endif // #if !defined(GENICAM_DEPRECATED)
00208
00209
00211
00212
00213
00214
00215
00216
00218
00219 #define _TO_STRING( __stN ) #__stN
00220 #define EXPAND_TO_STRINGISE( __stN ) _TO_STRING( __stN )
00221 #define __LINE_STR__ EXPAND_TO_STRINGISE(__LINE__)
00222 #define __LOCATION__ __FILE__ "(" __LINE_STR__ ")"
00223 #define __OUTPUT_FORMATER__(_type) __LOCATION__ " : " _type " : "
00224
00225
00226 #define __WARN__ __OUTPUT_FORMATER__("WARNING")
00227 #define __ERR__ __OUTPUT_FORMATER__("ERROR")
00228 #define __TODO__ __OUTPUT_FORMATER__("TBD")
00229
00230 #endif // GENAPI_GENAPIUTILITIES_DEF_H_