GizmoDistribution

gzDistServer.h

Go to the documentation of this file.
00001 //*****************************************************************************
00002 // File         : gzDistServer.h
00003 // Module       : gzDistribution
00004 // Description  : Definition of gzDistServerInterface
00005 // Author       : Anders Sandblad       
00006 // Product      : GizmoDistribution 2.1.1
00007 //      
00008 // Copyright © 2004 - Saab Training Systems AB, Sweden
00009 //          
00010 // NOTE:    GizmoDistribution is a toolkit used for implementing distributed 
00011 //          objects and events in C++
00012 //
00013 //
00014 // Revision History...                          
00015 //                                  
00016 // Who  Date    Description                     
00017 //                                  
00018 // XAA  031030  Created file    
00019 //
00020 //******************************************************************************
00021 #ifndef __GZ_DIST_SERVER_H__
00022 #define __GZ_DIST_SERVER_H__
00023 
00031 // Includes
00032 #include "gzDistBase.h"
00033 
00034 // Forward declarations
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 // Class    : gzDistServerInterface
00076 //                                  
00077 // Purpose  : Priority based distributed server support
00078 //                                  
00079 // Notes    : - 
00080 //                                  
00081 // Revision History...                          
00082 //                                  
00083 // Who  Date    Description                     
00084 //                                  
00085 // XAA  031030  Created 
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         //------------ callbacks ------------
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         // Notification thread ticker 
00194         GZ_DIST_EXPORT gzVoid onInitialize();
00195         GZ_DIST_EXPORT gzVoid onTick();
00196         GZ_DIST_EXPORT gzVoid onTerminate();
00197 
00198         // Process notifications
00199         gzVoid processNotifications();
00200 
00201 
00202     private:
00203 
00204         // Server implementation
00205         gzDistServerImpl * m_impl;
00206 
00207         // Messages from server implementation
00208         gzList<gzDistServerMessage>* m_messageList;
00209 
00210         // True whan a custom notification thread is used.
00211         gzBool m_customThread;
00212 
00213         // True while the ticker is running
00214         gzBool m_running;
00215 
00216 };
00217 
00218 
00219 #endif 

Documentation for GizmoDistribution generated at Wed Feb 20 11:59:21 2008 by   Saab Training Systems AB, ¸ (c) 2003-and beyond