Move to automake 1.8/1.9
[yazpp-moved-to-github.git] / include / yaz++ / socket-observer.h
index 85bf841..fee5088 100644 (file)
@@ -1,65 +1,81 @@
 /*
- * Copyright (c) 1998-2000, Index Data.
+ * Copyright (c) 1998-2005, Index Data.
  * See the file LICENSE for details.
  * 
- * $Id: socket-observer.h,v 1.3 2005-05-20 21:28:55 adam Exp $
+ * $Id: socket-observer.h,v 1.8 2005-09-23 13:11:04 adam Exp $
  */
 
 #ifndef YAZ_SOCKET_OBSERVER_H
 #define YAZ_SOCKET_OBSERVER_H
 
-#define YAZ_SOCKET_OBSERVE_READ 1
-#define YAZ_SOCKET_OBSERVE_WRITE 2
-#define YAZ_SOCKET_OBSERVE_EXCEPT 4
-#define YAZ_SOCKET_OBSERVE_TIMEOUT 8
-
 #include <yaz/yconfig.h>
+
+namespace yazpp_1 {
+    
+    enum SocketObserve {
+        SOCKET_OBSERVE_READ=1,
+        SOCKET_OBSERVE_WRITE=2,
+        SOCKET_OBSERVE_EXCEPT=4,
+        SOCKET_OBSERVE_TIMEOUT=8
+    };
+
 /**
    Forward reference
- */
-class IYazSocketObserver;
-
+*/
+    class ISocketObserver;
+    
 /** Socket Observable.
-   This interface implements notification of socket events.
-   The module interested in (observing) the sockets
-   must implement the IYazSocketObserver interface. The
-   IYazSocketObserver only have to implement one function, so it's
-   quite simple to observe sockets change state.
-   The socket events below specifies read, write, exception,
-   and timeout respectively:
-   <pre>
-    YAZ_SOCKET_OBSERVE_READ
-    YAZ_SOCKET_OBSERVE_WRITE
-    YAZ_SOCKET_OBSERVE_EXCEPT
-    YAZ_SOCKET_OBSERVE_TIMEOUT
+    This interface implements notification of socket events.
+    The module interested in (observing) the sockets
+    must implement the ISocketObserver interface. The
+    ISocketObserver only have to implement one function, so it's
+    quite simple to observe sockets change state.
+    The socket events below specifies read, write, exception,
+    and timeout respectively:
+    <pre>
+    SOCKET_OBSERVE_READ
+    SOCKET_OBSERVE_WRITE
+    SOCKET_OBSERVE_EXCEPT
+    SOCKET_OBSERVE_TIMEOUT
     </pre>
     The maskObserver method specifies which of these events the
     observer is intertested in.
 */
-class YAZ_EXPORT IYazSocketObservable {
- public:
-    /// Add an observer interested in socket fd
-    virtual void addObserver(int fd, IYazSocketObserver *observer) = 0;
-    /// Delete an observer
-    virtual void deleteObserver(IYazSocketObserver *observer) = 0;
-    /// Delete all observers
-    virtual void deleteObservers() = 0;
-    /// Specify the events that the observer is intersted in.
-    virtual void maskObserver(IYazSocketObserver *observer, int mask) = 0;
-    /// Specify timeout
-    virtual void timeoutObserver(IYazSocketObserver *observer,
-                                int timeout)=0;
-};
-
+    class YAZ_EXPORT ISocketObservable {
+    public:
+        /// Add an observer interested in socket fd
+        virtual void addObserver(int fd, ISocketObserver *observer) = 0;
+        /// Delete an observer
+        virtual void deleteObserver(ISocketObserver *observer) = 0;
+        /// Delete all observers
+        virtual void deleteObservers() = 0;
+        /// Specify the events that the observer is intersted in.
+        virtual void maskObserver(ISocketObserver *observer, int mask) = 0;
+        /// Specify timeout
+        virtual void timeoutObserver(ISocketObserver *observer,
+                                     int timeout)=0;
+        virtual ~ISocketObservable();
+    };
+    
 /** Socket Observer.
-   The IYazSocketObserver interface implements a module interested
-   socket events. Look for objects that implements the
-   IYazSocketObservable interface!
+    The ISocketObserver interface implements a module interested
+    socket events. Look for objects that implements the
+    ISocketObservable interface!
 */
-class YAZ_EXPORT IYazSocketObserver {
- public:
-    /// Notify the observer that something happened to socket
-    virtual void socketNotify(int event) = 0;
+    class YAZ_EXPORT ISocketObserver {
+    public:
+        /// Notify the observer that something happened to socket
+        virtual void socketNotify(int event) = 0;
+        virtual ~ISocketObserver();
+    };
+    
 };
-
 #endif
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+