![]() |
![]() |
00001 /****************************************************************************** 00002 * GX Watchdog header file - V7.2.12 00003 * 00004 * 2004-2015 (c) Adaptive Recognition (https://adaptiverecognition.com) 00005 ******************************************************************************/ 00021 /******************************************************************************/ 00022 #ifndef GX_WATCHDOG_INCL 00023 #define GX_WATCHDOG_INCL 00024 /******************************************************************************/ 00025 #include "gxsd.h" 00026 /******************************************************************************/ 00027 #ifdef GX_NAMESPACES 00028 namespace gx { 00029 #endif 00030 /******************************************************************************/ 00031 #ifdef GX_DOTNET 00032 #pragma unmanaged 00033 #endif 00034 /******************************************************************************/ 00035 #if !defined(GX_SWIGIF) && !defined(GX_MANUAL) /*(*/ 00036 /******************************************************************************/ 00038 enum { 00039 GX_CALL_WATCHDOG = GX_CALL_GROUP_GX_WATCHDOG | 0x0000 00040 }; 00041 /******************************************************************************/ 00043 struct GX_PARM_WATCHDOG { 00044 int timersec; 00045 }; 00046 #endif /* GX_SWIGIF GX_MANUAL )*/ 00047 00048 /******************************************************************************/ 00049 #if !defined(NO_GX_FUNCTIONS) && !defined(GX_SWIGIF) 00050 /******************************************************************************/ 00051 00052 /******************************************************************************/ 00056 /******************************************************************************/ 00057 00058 /******************************************************************************/ 00066 inline int gx_watchdog(gxHANDLE handle, int timersec) { 00067 struct GX_PARM_WATCHDOG p; 00068 p.timersec = timersec; 00069 return gx_call(handle, GX_CALL_WATCHDOG, &p); 00070 } 00071 00072 #ifdef __cplusplus 00073 /******************************************************************************/ 00080 inline int gx_watchdog(int timersec) { 00081 return gx_watchdog(gx_direct(GX_CALL_GROUP_GX_WATCHDOG), timersec); 00082 } 00083 #endif 00084 00085 /******************************************************************************/ 00087 /******************************************************************************/ 00088 00089 #endif 00090 /******************************************************************************/ 00091 #ifdef GX_DOTNET 00092 #pragma managed 00093 #endif 00094 /******************************************************************************/ 00095 #ifndef NO_GX_CLASSES 00096 /******************************************************************************/ 00098 GX_CLASS gxWatchdog : public gxHandle { 00099 public: 00101 inline gxWatchdog() gxFuncThrowsError { 00102 #ifndef GX_DOTNET 00103 if(!gx_openmodule(this, L"gxwatchdog", L"default")) gxthrow; 00104 #else 00105 GX_GETHANDLE(h); 00106 if(!gx_openmodule(&h, L"gxwatchdog", L"default")) gxthrow; 00107 _set_handle(h.handle); 00108 #endif 00109 } 00110 00111 #if !defined(GX_SWIGIF) && !defined(GX_DOTNET) 00112 00116 inline gxWatchdog(const wchar_t *propname, const wchar_t *modname = (const wchar_t *)0) gxFuncThrowsError { 00117 if(!gx_openmodule(this, modname ? modname : L"gxwatchdog", propname)) gxthrow; 00118 } 00119 00124 inline gxWatchdog(const char *propname, const char *modname = (const char *)0) gxFuncThrowsError { 00125 if(!gx_openmodulea(this, modname ? modname : "gxwatchdog", propname)) gxthrow; 00126 } 00127 #endif // !GX_SWIGIF && !GX_DOTNET 00128 00129 #ifdef GX_UNICODE 00130 00134 inline gxWatchdog(gxInStr propname, gxInStr modname) gxFuncThrowsError { 00135 GX_GETSTRING(_propname, propname); 00136 GX_GETSTRING(_modname, modname); 00137 #ifndef GX_DOTNET 00138 if(!gx_openmodule(this, _modname, _propname)) gxthrow; 00139 #else 00140 GX_GETHANDLE(h); 00141 if(!gx_openmodule(&h, _modname, _propname)) gxthrow; 00142 _set_handle(h.handle); 00143 #endif 00144 } 00148 inline gxWatchdog(gxInStr propname) gxFuncThrowsError { 00149 GX_GETSTRING(_propname, propname); 00150 #ifndef GX_DOTNET 00151 if(!gx_openmodule(this, L"gxwatchdog", _propname)) gxthrow; 00152 #else 00153 GX_GETHANDLE(h); 00154 if(!gx_openmodule(&h, L"gxwatchdog", _propname)) gxthrow; 00155 _set_handle(h.handle); 00156 #endif 00157 } 00158 #endif 00159 #ifdef GX_ASCII 00160 00164 inline gxWatchdog(gxInAStr propname, gxInAStr modname) gxFuncThrowsError { 00165 GX_GETASTRING(_propname, propname); 00166 GX_GETASTRING(_modname, modname); 00167 if(!gx_openmodulea(this, _modname, _propname)) gxthrow; 00168 } 00172 inline gxWatchdog(gxInAStr propname) gxFuncThrowsError { 00173 GX_GETASTRING(_propname, propname); 00174 if(!gx_openmodulea(this, "gxwatchdog", _propname)) gxthrow; 00175 } 00176 #endif 00177 00183 inline bool Set(int timersec) gxFuncThrowsError { 00184 GX_GETHANDLE(h); 00185 bool st = gx_watchdog(h, timersec) ? true : false; 00186 gxcondthrow(!st); 00187 return st; 00188 } 00189 }; 00190 /******************************************************************************/ 00191 #endif // NO_GX_CLASSES 00192 /******************************************************************************/ 00193 #ifdef GX_NAMESPACES 00194 } 00195 #endif 00196 /******************************************************************************/ 00197 #endif // GX_WATCHDOG_INCL 00198 /******************************************************************************/