Class Hierarchy   Class Index   Method Index  

CHMhl7ClientSocket.h

00001 #ifndef __CHM_HL7_CLIENT_SOCKET_H__
00002 #define __CHM_HL7_CLIENT_SOCKET_H__
00003 
00004 #include <CHM/CHMminimumInclude.h>
00005 
00006 // THIS CLASS IS DEPRECATED.  IT IS ONLY HERE FOR THE PURPOSES OF SOME CUSTOMERS NEEDING TO MIGRATE
00007 // THERE EXISTING CODE.  IT IS NOT SUPPORTED.
00008 
00009 class CHMhl7ClientSocket;
00010 struct CHMconnectionEvents
00011 {
00018    virtual void onClose( CHMhl7ClientSocket& Client ){}
00019    
00029    virtual void onMessage( CHMhl7ClientSocket& Client, const char* Message ){}
00030 
00040    virtual void onTransportError( CHMhl7ClientSocket& Client, int ErrorId, const char* ErrorMessage ){}
00041 };
00042 
00043 struct CHMhl7ClientSocketPrivate;
00044 
00054 class CHMhl7ClientSocket : public CHMconnectionEvents
00055 {
00056 public:
00066    CHMhl7ClientSocket( CHMboolean Dynamic = false );
00067 
00081    CHMhl7ClientSocket( int ClientId, CHMboolean Dynamic = true );
00082    
00084    virtual ~CHMhl7ClientSocket();
00085 
00095    void connect( const char* Host, short Port );
00096 
00102    void sendMessage( const char* Message );
00103 
00107    CHMuint32 getIpAddress();
00108 
00112    const char* getIpAddressString();
00113 
00119    const char* getHostName();
00120 
00125    void closeConnection();
00126 
00132    virtual void onConnect(){}
00133 
00136    CHMboolean isConnected() const;
00137 
00144    virtual void onClose( CHMhl7ClientSocket& Client );
00145 
00149    int id();
00150 private:
00151    CHMhl7ClientSocketPrivate* pMember;
00152 
00153    // not allowed
00154    CHMhl7ClientSocket(const CHMhl7ClientSocket& Orig);
00155    CHMhl7ClientSocket& operator=(const CHMhl7ClientSocket& Orig);
00156 };
00157 
00158 #endif // end of defensive include