00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 #ifndef ACE_SERVICE_OBJECT_H
00014 #define ACE_SERVICE_OBJECT_H
00015 #include  "ace/pre.h"
00016 
00017 #include "ace/Shared_Object.h"
00018 #include "ace/Svc_Conf_Tokens.h"
00019 
00020 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00021 # pragma once
00022 #endif 
00023 
00024 #include "ace/Event_Handler.h"
00025 #include "ace/DLL.h"
00026 
00027 #include "ace/Service_Gestalt.h"
00028 
00029 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00030 
00031 #define ACE_Component ACE_Service_Object
00032 
00033 
00034 
00035 
00036 
00037 
00038 
00039 
00040 
00041 
00042 
00043 
00044 class ACE_Export ACE_Service_Object
00045   : public ACE_Event_Handler,
00046     public ACE_Shared_Object
00047 {
00048 public:
00049   
00050 
00051   ACE_Service_Object (ACE_Reactor * = 0);
00052 
00053 
00054   virtual ~ACE_Service_Object (void);
00055 
00056 
00057   virtual int suspend (void);
00058 
00059 
00060   virtual int resume (void);
00061 };
00062 
00063 
00064 class ACE_Service_Type_Impl;
00065 
00066 
00067 
00068 
00069 
00070 
00071 
00072 
00073 
00074 class ACE_Export ACE_Service_Type
00075 {
00076 public:
00077   enum
00078   {
00079 
00080     DELETE_OBJ = 1,
00081 
00082 
00083     DELETE_THIS = 2
00084   };
00085 
00086   enum
00087     {
00088       SERVICE_OBJECT = ACE_SVC_OBJ_T,
00089       MODULE = ACE_MODULE_T,
00090       STREAM = ACE_STREAM_T,
00091       INVALID_TYPE = -1
00092     };
00093 
00094   
00095   ACE_Service_Type (const ACE_TCHAR *n,
00096                     ACE_Service_Type_Impl *o,
00097                     const ACE_DLL &dll,
00098                     int active);
00099   ACE_Service_Type (const ACE_TCHAR *n,
00100                     ACE_Service_Type_Impl *o,
00101                     ACE_SHLIB_HANDLE handle,
00102                     int active);
00103   ~ACE_Service_Type (void);
00104 
00105   const ACE_TCHAR *name (void) const;
00106   void name (const ACE_TCHAR *);
00107 
00108   const ACE_Service_Type_Impl *type (void) const;
00109   void type (const ACE_Service_Type_Impl *, int active = 1);
00110 
00111   
00112   bool is_forward_declaration (void) const;
00113 
00114   int suspend (void) const;
00115   int resume (void) const;
00116   int  active (void) const;
00117   void active (int);
00118 
00119 
00120   int fini (void);
00121 
00122 
00123   int fini_called (void) const;
00124 
00125 
00126   void dump (void) const;
00127 
00128 
00129   const ACE_DLL & dll (void) const;
00130 
00131 
00132   void dll (const ACE_DLL&);
00133 
00134 
00135   ACE_ALLOC_HOOK_DECLARE;
00136 
00137 private:
00138 
00139   const ACE_TCHAR *name_;
00140 
00141 
00142   const ACE_Service_Type_Impl *type_;
00143 
00144 
00145 
00146   mutable ACE_DLL dll_;
00147 
00148 
00149   int active_;
00150 
00151 
00152   int fini_already_called_;
00153 };
00154 
00155 
00156 
00157 
00158 
00159 
00160 
00161 
00162 
00163 
00164 
00165 
00166 
00167 
00168 class ACE_Export ACE_Service_Object_Ptr
00169 {
00170 public:
00171   
00172 
00173   ACE_Service_Object_Ptr (ACE_Service_Object *so);
00174 
00175 
00176   ~ACE_Service_Object_Ptr (void);
00177 
00178 
00179   ACE_Service_Object *operator-> ();
00180 
00181 private:
00182 
00183   ACE_Service_Object *service_object_;
00184 };
00185 
00186 #if defined (ACE_OPENVMS)
00187 
00188 
00189 
00190 
00191 
00192 class ACE_Dynamic_Svc_Registrar
00193 {
00194 public:
00195   ACE_Dynamic_Svc_Registrar (const ACE_TCHAR* alloc_name,
00196                              void* svc_allocator);
00197 };
00198 #endif
00199 
00200 ACE_END_VERSIONED_NAMESPACE_DECL
00201 
00202 #if defined (__ACE_INLINE__)
00203 #include "ace/Service_Object.inl"
00204 #endif 
00205 
00206 #include  "ace/post.h"
00207 #endif