/* -*- C++ -*- */ //============================================================================= /** * @file Service_Types.h * * $Id$ * * @author Douglas C. Schmidt */ //============================================================================= #ifndef ACE_SERVICE_TYPE_H #define ACE_SERVICE_TYPE_H #include "ace/pre.h" #include "ace/Service_Object.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Synch.h" /** * @class ACE_Service_Type_Impl * * @brief The abstract base class of the hierarchy that defines the * contents of the . The subclasses of * this class allow the configuration of , * , and . * * This class provides the root of the implementation hierarchy * of the "Bridge" pattern. It maintains a pointer to the * appropriate type of service implementation, i.e., * , , or . */ class ACE_Export ACE_Service_Type_Impl { public: // = Initialization and termination methods. ACE_Service_Type_Impl (void *object, const ACE_TCHAR *s_name, u_int flags = 0, ACE_Service_Object_Exterminator gobbler = 0); virtual ~ACE_Service_Type_Impl (void); // = Pure virtual interface (must be defined by the subclass). virtual int suspend (void) const = 0; virtual int resume (void) const = 0; virtual int init (int argc, ACE_TCHAR *argv[]) const = 0; virtual int fini (void) const; virtual int info (ACE_TCHAR **str, size_t len) const = 0; /// The pointer to the service. void *object (void) const; /// Get the name of the service. const ACE_TCHAR *name (void) const; /// Set the name of the service. void name (const ACE_TCHAR *); /// Dump the state of an object. void dump (void) const; /// Declare the dynamic allocation hooks. ACE_ALLOC_HOOK_DECLARE; protected: /// Name of the service. const ACE_TCHAR *name_; /// Pointer to object that implements the service. This actually /// points to an , , or . void *obj_; /// Destroy function to deallocate obj_. ACE_Service_Object_Exterminator gobbler_; /// Flags that control serivce behavior (particularly deletion). u_int flags_; }; /** * @class ACE_Service_Object_Type * * @brief Define the methods for handling the configuration of * . */ class ACE_Export ACE_Service_Object_Type : public ACE_Service_Type_Impl { public: // = Initialization method. ACE_Service_Object_Type (void *so, const ACE_TCHAR *name, u_int flags = 0, ACE_Service_Object_Exterminator gobbler = 0); ~ACE_Service_Object_Type (void); // = Implement the hooks for . virtual int suspend (void) const; virtual int resume (void) const; virtual int init (int argc, ACE_TCHAR *argv[]) const; virtual int fini (void) const; virtual int info (ACE_TCHAR **str, size_t len) const; }; /** * @class ACE_Module_Type * * @brief Define the methods for handling the configuration of * . */ class ACE_Export ACE_Module_Type : public ACE_Service_Type_Impl { public: // = Initialization method. ACE_Module_Type (void *m, // Really an *. const ACE_TCHAR *identifier, u_int flags = 0); ~ACE_Module_Type (void); // = Implement the hooks for . virtual int suspend (void) const; virtual int resume (void) const; virtual int init (int argc, ACE_TCHAR *argv[]) const; virtual int fini (void) const; virtual int info (ACE_TCHAR **str, size_t len) const; // Get/set the link pointer. ACE_Module_Type *link (void) const; void link (ACE_Module_Type *); /// Dump the state of an object. void dump (void) const; /// Declare the dynamic allocation hooks. ACE_ALLOC_HOOK_DECLARE; private: /// Pointer to the next in an . ACE_Module_Type *link_; }; /** * @class ACE_Stream_Type * * @brief Define the methods for handling the configuration of * . */ class ACE_Export ACE_Stream_Type : public ACE_Service_Type_Impl { public: // = Initialization method. ACE_Stream_Type (void *s, // Really an *. const ACE_TCHAR *identifier, u_int flags = 0); ~ACE_Stream_Type (void); // = Implement the hooks for . virtual int suspend (void) const; virtual int resume (void) const; virtual int init (int argc, ACE_TCHAR *argv[]) const; virtual int fini (void) const; virtual int info (ACE_TCHAR **str, size_t len) const; /// Add a new to the top of the . int push (ACE_Module_Type *new_module); /// Search for and remove it from the . int remove (ACE_Module_Type *module); /// Locate the with . ACE_Module_Type *find (const ACE_TCHAR *mod_name) const; /// Dump the state of an object. void dump (void) const; /// Declare the dynamic allocation hooks. ACE_ALLOC_HOOK_DECLARE; private: /// Pointer to the head of the list. ACE_Module_Type *head_; }; #if defined (__ACE_INLINE__) #include "ace/Service_Types.i" #endif /* __ACE_INLINE__ */ #include "ace/post.h" #endif /* _SERVICE_TYPE_H */