diff options
Diffstat (limited to 'docs/tutorials/022/page03.html')
-rw-r--r-- | docs/tutorials/022/page03.html | 123 |
1 files changed, 0 insertions, 123 deletions
diff --git a/docs/tutorials/022/page03.html b/docs/tutorials/022/page03.html deleted file mode 100644 index 4a095ae9a8f..00000000000 --- a/docs/tutorials/022/page03.html +++ /dev/null @@ -1,123 +0,0 @@ -<!-- $Id$ --> -<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> -<html> - <head> - <title>ACE Tutorial 022</title> - </head> - - <BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#000FFF" VLINK="#FF0F0F"> - -<CENTER><B><FONT SIZE=+2>ACE Tutorial 022</FONT></B></CENTER> - Now, lets implement the Acceptor Service. As the first step, let - us take a look at <I><A HREF="Acceptor_Service.h">Acceptor_Service.h</A></I>. - -<P> -<HR WIDTH="100%"> -<PRE> -<font color=red>// $Id$</font> - -<font color=blue>#ifndef</font> <font color=purple>ACCEPTOR_SERVICE_H</font> -<font color=blue>#define</font> <font color=purple>ACCEPTOR_SERVICE_H</font> - -<font color=red>/* The ACE_Acceptor<> template lives in the ace/Acceptor.h header - file. */</font> - -<font color=blue>#include</font> "<A HREF="../../../ace/Acceptor.h">ace/Acceptor.h</A>" - -<font color=blue>#if !defined</font> (<font color=purple>ACE_LACKS_PRAGMA_ONCE</font>) -<font color=blue># pragma</font> <font color=purple>once</font> -<font color=blue>#endif</font> <font color=red>/* ACE_LACKS_PRAGMA_ONCE */</font> - -<font color=red>/* Since we want to work with sockets, we'll need a SOCK_Acceptor to - allow the clients to connect to us. */</font> -<font color=blue>#include</font> "<A HREF="../../../ace/SOCK_Acceptor.h">ace/SOCK_Acceptor.h</A>" - -<font color=red>/* The Client_Handler object we develop will be used to handle clients - once they're connected. The ACE_Acceptor<> template's first - parameter requires such an object. In some cases, you can get by - with just a forward declaration on the class, in others you have to - have the whole thing. */</font> -<font color=blue>#include</font> "<font color=green>client_handler.h</font>" - -<font color=red>/* In our original simple server, we instantiated a - ACE_Acceptor <Client_Handler, ACE_SOCK_ACCEPTOR> object. We can - make it much simpler and efficient by inheriting our - Acceptor_Service from ACE_Acceptor itself. - - Our Acceptor_Service class also needs to inherit from - ACE_Service_Object. ACE_Service_Object is an abstract class which - includes methods called by the Service Configurator framework to - start, remove, suspend or resume our service. - - You might have noticed that we didnt explicitly inherit from - ACE_Service_Object here. That is because, ACE_Acceptor derives from - ACE_Service_Object and hence there is no explicitly specify it. */ - - /* TO Do: Describe what/why ACE_Svc_Export */ - We use the ACE_Svc_Export macro to export the symbols from the -library on Win.</font> -class ACE_Svc_Export Acceptor_Service : public ACE_Acceptor <Client_Handler, ACE_SOCK_ACCEPTOR> -{ - public: - <font color=red> // Constructor </font> - Acceptor_Service (void); - - <font color=red> // Destructor </font> - ~Acceptor_Service (void); - - <font color=red>/* This method is the one which is called by the Service - Configurator Framework to initialize or start the service. */ </font> - virtual int init (int argc, char *argv[]); - - <font color=red>/* Called by the Service Configurator framework to remove this - Service. */ </font> - virtual int fini (void); - - <font color=red>/* You could easily guess that this method is called to suspend the - service by the same Service Configurator Framework. When in the - suspend mode, the service is not removed completely and is *still - there*. The difference is that the service is not in a active - state and doesnot accept requests.*/ </font> - virtual int suspend (void); - - <font color=red> /* And your guess that this method is called to resume the service - is also right. This call brings the service back to the - active state and the service is all ready to accept requests */ </font> - virtual int resume (void); - -}; - -<font color=red>/* The following macros and similar macros which we - will use in the implementation file later are used to define helper - functions for the Service Configurator. As we can easily guess, these - macros are intended to dynamically load ancd configure services using - the svc.conf file. These macros will also help to dynamically configure - even the statically linked services. */</font> - -<font color=red>/* This macro is used to declare a data structure - required to register a statically linked service into the service - configurator. As you can see it has only one argument which is the - name of the class that implements this service... so - Acceptor_Service in our case. */</font> -ACE_STATIC_SVC_DECLARE (Acceptor_Service) - -<font color=red>/* Once the service implementation is dynamically loaded, the Service - Configurator uses a factory method to create the object. This - macro declares such a factory function with the proper interface - and export macros. */</font> -ACE_SVC_FACTORY_DECLARE (Acceptor_Service) - -#include "ace/post.h" -<font color=blue>#endif</font> <<font color=red> /* ACCEPTOR_SERVICE_H */</font> -</PRE> -<P><HR WIDTH="100%"> -<CENTER>[<A HREF="../online-tutorials.html">Tutorial Index</A>] [<A HREF="page04.html">Continue This Tutorial</A>]</CENTER> - - <hr> - <address><a href="mailto:pgontla@ece.uci.edu">Priyanka Gontla</a></address> -<!-- Created: Thu Jan 18 17:46:58 PST 2001 --> -<!-- hhmts start --> -Last modified: Fri Jan 19 11:38:39 PST 2001 -<!-- hhmts end --> - </body> -</html> |