Main Page   Class Hierarchy   Compound List   File List   Compound Members  

CAlarmServer.h

00001 // Author:
00002 //   Jason Venema
00003 //   NSCL
00004 //   Michigan State University
00005 //   East Lansing, MI 48824-1321
00006 //   mailto: venemaja@msu.edu
00007 //
00008 // Copyright
00009 //   NSCL All rights reserved.
00010 //
00011 // CAlarmServer encapsulates a database server for alarms.  Alarms can be 
00012 // created by DAQ (or any other) software entities, which notify alarm
00013 // displayers, which log the alarm with this server.  The server is implemented
00014 // using the gdbm UNIX database to store alarm content.  There are two database
00015 // files:
00016 //    (1) .alarmdb contains all of the alarm information fields, such as 
00017 //        the logging faclity, the alarm status, the alarm message and date.
00018 //    (2) .alarmcount contains experiment ID and alarm count information to be
00019 //        used in generating count numbers for alarm displayers.
00020 //
00021 
00022 #ifndef __CALARMSERVER_H
00023 #define __CALARMSERVER_H
00024 
00025 //
00026 // Include files
00027 //
00028 
00029 #ifndef __CSOCKET_H
00030 #include <CSocket.h>
00031 #endif
00032 
00033 #ifndef __STL_STRING
00034 #define __STL_STRING
00035 #include <string>
00036 #endif
00037 
00038 #ifndef __STL_MAP
00039 #define __STL_MAP
00040 #include <map>
00041 #endif
00042 
00043 #ifndef __SPECTRODAQ_H
00044 #include <spectrodaq.h>
00045 #endif
00046 
00047 #ifndef __SPECTROFRAMEWORK_H
00048 #include <SpectroFramework.h>
00049 #endif
00050 
00051 #ifndef __GDBM_H
00052 #include <gdbm.h>
00053 #endif
00054 
00055 #ifndef __GDBMEXCEPTION_H
00056 #include <CGDBMException.h>
00057 #endif
00058 
00059 #ifndef __CALARMSERVEREXCEPTION_H
00060 #include <CAlarmServerException.h>
00061 #endif
00062 
00063 using namespace std;
00064 
00065 class CAlarmServer
00066 {
00067   string m_sPort;             
00068   string m_sExpId;            
00069   string m_sAlarmId;          
00070 
00071  public:
00072   enum ClientReason {
00073     LOG,
00074     ACKNOWLEDGE,
00075     DISMISS,
00076     UPDATE,
00077     INIT,
00078     CREATE,
00079     HISTORY
00080   };
00081 
00082  public:
00083   // Default constructor
00084   CAlarmServer();
00085 
00086   // Copy constructor
00087   CAlarmServer(const CAlarmServer& aCAlarmServer);
00088 
00089   // Destructor
00090   ~CAlarmServer() { }
00091 
00092   // The following functions are disabled
00093  private:
00094   // Operator= assignment operator
00095   CAlarmServer operator=(const CAlarmServer& aCAlarmServer);
00096   // Operator== equality operator
00097   int operator== (const CAlarmServer& aCAlarmServer);
00098 
00099   // Public selectors
00100  public:
00101   string getExpId() { return m_sExpId; }
00102   string getAlarmId() { return m_sAlarmId; }
00103 
00104   // Protected mutators
00105  protected:
00106   void setExpId(const string& aExpId) { m_sExpId = aExpId; }
00107   void setAlarmId(const string& aAlarmId) { m_sAlarmId = aAlarmId; }
00108 
00109   // Public member functions
00110  public:
00111   bool operator()();
00112 
00113   // Protected member fuctions
00114  protected:
00115   void Log(string& sFacility, string& sMessage, string& sDate);
00116   void EditAlarm(Int_t nReason);
00117   void Init(CSocket* newSock, CSocket* sock);
00118   void CreateExperiment();
00119   string GetExperimentHistory();
00120 };
00121 
00122 #endif

Generated at Tue May 21 12:10:50 2002 for CAlarmLogger by doxygen1.2.9.1 written by Dimitri van Heesch, © 1997-2001