00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __GZ_DIST_SERVER_H__
00022 #define __GZ_DIST_SERVER_H__
00023
00031
00032 #include "gzDistBase.h"
00033
00034
00035 class gzDistServerImpl;
00036 class gzDistServerMessage;
00037 class gzDistRemoteChannelInterface;
00038
00039
00041 enum gzDistServerPriority
00042 {
00043 GZ_DIST_SERVER_PRIO_NEVER = 0,
00044 GZ_DIST_SERVER_PRIO_VERY_LOW,
00045 GZ_DIST_SERVER_PRIO_LOW,
00046 GZ_DIST_SERVER_PRIO_NORMAL,
00047 GZ_DIST_SERVER_PRIO_HIGH,
00048 GZ_DIST_SERVER_PRIO_VERY_HIGH,
00049 GZ_DIST_SERVER_PRIO_MAX
00050 };
00051
00052
00054 enum gzDistServerStatus
00055 {
00056 GZ_DIST_SERVER_STATUS_UNKNOWN = 0,
00057 GZ_DIST_SERVER_STATUS_IDLE,
00058 GZ_DIST_SERVER_STATUS_STARTUP,
00059 GZ_DIST_SERVER_STATUS_PASSIVE,
00060 GZ_DIST_SERVER_STATUS_ACTIVE,
00061 GZ_DIST_SERVER_STATUS_SHUTDOWN,
00062 GZ_DIST_SERVER_STATUS_ERROR
00063 };
00064
00065
00067 enum gzDistServerRemoveReason
00068 {
00069 GZ_DIST_SERVER_REMOVE_SHUTDOWN = 0,
00070 GZ_DIST_SERVER_REMOVE_TIMEOUT
00071 };
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00089
00108 class gzDistServerInterface : protected gzThreadTicker
00109 {
00110 public:
00111
00113
00117 GZ_DIST_EXPORT gzDistServerInterface(const gzString& functionID, gzDistServerPriority priority = GZ_DIST_SERVER_PRIO_NORMAL, gzBool customNotificationThread = FALSE);
00118
00120 GZ_DIST_EXPORT virtual ~gzDistServerInterface();
00121
00123
00124 GZ_DIST_EXPORT gzVoid install();
00125
00127
00130 GZ_DIST_EXPORT gzVoid uninstall(gzBool wait = TRUE);
00131
00133
00136 GZ_DIST_EXPORT gzBool isInstalled() const;
00137
00139
00141 GZ_DIST_EXPORT gzString getFunctionID() const;
00142
00144 GZ_DIST_EXPORT gzDistServerPriority getPriority() const;
00145
00147
00153 GZ_DIST_EXPORT gzVoid triggerNotifications();
00154
00155
00156 protected:
00157
00158
00159
00161
00165 GZ_DIST_EXPORT virtual gzVoid onStatus(gzDistServerStatus status);
00166
00168
00173 GZ_DIST_EXPORT virtual gzVoid onNewInstance(const gzDistInstanceID& id);
00174
00176
00182 GZ_DIST_EXPORT virtual gzVoid onRemoveInstance(const gzDistInstanceID& id, gzDistServerRemoveReason reason);
00183
00185
00188 GZ_DIST_EXPORT virtual gzVoid onActiveInstance(const gzDistInstanceID& id);
00189
00190
00191 protected:
00192
00193
00194 GZ_DIST_EXPORT gzVoid onInitialize();
00195 GZ_DIST_EXPORT gzVoid onTick();
00196 GZ_DIST_EXPORT gzVoid onTerminate();
00197
00198
00199 gzVoid processNotifications();
00200
00201
00202 private:
00203
00204
00205 gzDistServerImpl * m_impl;
00206
00207
00208 gzList<gzDistServerMessage>* m_messageList;
00209
00210
00211 gzBool m_customThread;
00212
00213
00214 gzBool m_running;
00215
00216 };
00217
00218
00219 #endif