it_bus/servant.h

00001 #ifndef _IT_BUS_SERVANT_H_
00002 #define _IT_BUS_SERVANT_H_
00003 
00004 // @Copyright 2002 IONA Technologies, Plc. All Rights Reserved.
00005 //
00006 
00007 #ifndef IT_MINIMISE_INCLUDES
00008 #include <it_bus/bus.h>
00009 #endif
00010 #include <it_bus/api_defines.h>
00011 #include <it_bus/operation.h>
00012 #include <it_bus/port.h>
00013 #include <it_bus/bus_type_alias.h>
00014 #include <it_bus/string_map.h>
00015 #include <it_ts/mutex.h>
00016 #include <it_bus/logging_defs.h>
00017 
00018 namespace IT_Bus
00019 {
00026     class IT_BUS_API Servant
00027     {
00028       public:
00034         IT_EXPLICIT Servant(
00035             Bus_ptr bus
00036         );
00037 
00041         virtual ~Servant();
00042 
00056         virtual void dispatch(
00057             ServerOperation & server_operation
00058         ) = 0;
00059 
00083         virtual void 
00084         asynchronous_exception(
00085             IT_Bus::Exception& e
00086         );
00087         
00094         virtual Bus_ptr 
00095         get_bus() const;
00096         
00107         virtual void 
00108         activated(
00109             Port&
00110         );
00111         
00122         virtual void 
00123         deactivated(
00124             Port&
00125         );
00126         
00135         virtual Servant*
00136         clone() const;
00137 
00146         virtual void
00147         destroy(
00148             Servant* servant
00149         ) const ;
00150         
00151       protected:
00152         Bus_var m_bus;          
00153         IT_DECLARE_BUS_LOGGER_MEM
00154         
00155       private:
00156         Servant();
00157     };
00158     
00172     class IT_BUS_API WrapperServant : public IT_Bus::Servant
00173     {
00174       public:
00175         IT_EXPLICIT WrapperServant(
00176             IT_Bus::Servant& servant
00177         );
00178         
00179         virtual void 
00180         activated(
00181             Port&
00182         );
00183         
00184         virtual void 
00185         deactivated(
00186             Port&
00187         );
00188         
00189       protected:
00190         IT_Bus::Servant& m_servant;
00191     };
00192 
00193     class PerThreadServantImpl;
00194 
00199     class IT_BUS_API PerThreadServant : public IT_Bus::WrapperServant
00200     {
00201       public:
00207         IT_EXPLICIT PerThreadServant(
00208             IT_Bus::Servant& servant
00209         );
00210 
00214         virtual ~PerThreadServant();
00215 
00216         virtual void dispatch(
00217             ServerOperation & server_operation
00218         );
00219 
00220       private:
00221         PerThreadServantImpl* m_impl;
00222     };
00223 
00230     class IT_BUS_API PerInvocationServant : public IT_Bus::WrapperServant
00231     {
00232       public:
00238         PerInvocationServant(
00239             IT_Bus::Servant& servant
00240         );
00241         
00242         virtual void dispatch(
00243             ServerOperation & server_operation
00244         );
00245     };
00246 
00251     class IT_BUS_API SerializedServant : public IT_Bus::WrapperServant
00252     {
00253       public:
00259         SerializedServant(
00260             IT_Bus::Servant& servant
00261         );
00262         
00263         virtual void dispatch(
00264             ServerOperation & server_operation
00265         );
00266         
00267       private:
00268         IT_Mutex m_mutex;
00269     };   
00270 }
00271 
00272 #endif  

Generated on Tue Mar 20 15:27:43 2007 for Artix by  doxygen 1.5.1-p1