diff options
author | nobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-10-23 04:30:06 +0000 |
---|---|---|
committer | nobody <nobody@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-10-23 04:30:06 +0000 |
commit | 615c6979c0b339c7e2c89477899d63bf87e1dd93 (patch) | |
tree | 7e633c5be1c568b2e00f6ec8a2b6b3e6dbf3bd58 /docs/tutorials/015/page08.html | |
parent | 34cd7dceb74cbcc62c09c388504bec353bed4881 (diff) | |
download | ATCD-TAO-0_2_32.tar.gz |
This commit was manufactured by cvs2svn to create tag 'TAO-0_2_32'.TAO-0_2_32
Diffstat (limited to 'docs/tutorials/015/page08.html')
-rw-r--r-- | docs/tutorials/015/page08.html | 94 |
1 files changed, 0 insertions, 94 deletions
diff --git a/docs/tutorials/015/page08.html b/docs/tutorials/015/page08.html deleted file mode 100644 index 951662c0191..00000000000 --- a/docs/tutorials/015/page08.html +++ /dev/null @@ -1,94 +0,0 @@ -<HTML> -<HEAD> - <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> - <META NAME="Author" CONTENT="James CE Johnson"> - <TITLE>ACE Tutorial 015</TITLE> -</HEAD> -<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#000FFF" VLINK="#FF0F0F"> - -<CENTER><B><FONT SIZE=+2>ACE Tutorial 015</FONT></B></CENTER> - -<CENTER><B><FONT SIZE=+2>Building a protocol stream</FONT></B></CENTER> - -<P> -<HR WIDTH="100%"> -The Handler object is our event handler. You can use either -ACE_Event_Handler or ACE_Svc_Handler<> for the baseclass. I generally -prefer the latter since it takes care of some housekeeping that I -would otherwise be responsible for. -<P> -The class declaration is taken almost exactly from a previous -tutorial. A good design will have a simple handler object that will -collect data from the peer and pass it along to another object for -processing. Again, keep it simple and delegate authority. -<HR> -<PRE> - -<font color=red>// $Id$</font> - -<font color=blue>#ifndef</font> <font color=purple>HANDLER_H</font> -<font color=blue>#define</font> <font color=purple>HANDLER_H</font> - -<font color=blue>#include</font> "<font color=green>ace/Svc_Handler.h</font>" - -<font color=blue>#if !defined</font> (<font color=purple>ACE_LACKS_PRAGMA_ONCE</font>) -# pragma once -<font color=blue>#endif</font> <font color=red>/* ACE_LACKS_PRAGMA_ONCE */</font> - -<font color=blue>#include</font> "<font color=green>ace/SOCK_Stream.h</font>" -<font color=blue>#include</font> "<font color=green>Protocol_Stream.h</font>" - -<font color=red>/* Just your basic event handler. We use ACE_Svc_Handler<> as a - baseclass so that it can maintain the peer() and other details for - us. We're not going to activate() this object, so we can get away - with the NULL synch choice. -*/</font> -class Handler : public ACE_Svc_Handler < ACE_SOCK_STREAM, ACE_NULL_SYNCH > -{ -public: - - Handler(void); - ~Handler(void); - - <font color=red>// Called by the acceptor when we're created in response to a</font> - <font color=red>// client connection.</font> - int open (void *); - - <font color=red>// Called when it's time for us to be deleted. We take care</font> - <font color=red>// of removing ourselves from the reactor and shutting down</font> - <font color=red>// the peer() connectin.</font> - void destroy (void); - - <font color=red>// Called when it's time for us to go away. There are subtle</font> - <font color=red>// differences between destroy() and close() so don't try to</font> - <font color=red>// use either for all cases.</font> - int close (u_long); - -protected: - - <font color=red>// Respond to peer() activity.</font> - int handle_input (ACE_HANDLE); - - <font color=red>// This will be called when handle_input() returns a failure</font> - <font color=red>// code. That's our signal that it's time to begin the</font> - <font color=red>// shutdown process.</font> - int handle_close(ACE_HANDLE, ACE_Reactor_Mask _mask); - -private: - - <font color=red>// Like the Client, we have to abide by the protocol</font> - <font color=red>// requirements. We use a local Protocol_Stream object to</font> - <font color=red>// take care of those details. For us, I/O then just becomes</font> - <font color=red>// a matter of interacting with the stream.</font> - Protocol_Stream stream_; - - Protocol_Stream & stream(void) - { - return this->stream_; - } -}; - -<font color=blue>#endif</font> <font color=red>// HANDLER_H</font> -</PRE> -<P><HR WIDTH="100%"> -<CENTER>[<A HREF="..">Tutorial Index</A>] [<A HREF="page09.html">Continue This Tutorial</A>]</CENTER> |