Public Types | Public Member Functions | Public Attributes | Protected Attributes

ACE_Creation_Strategy< SVC_HANDLER > Class Template Reference

Defines the interface for specifying a creation strategy for a SVC_HANDLER. More...

#include <Strategies_T.h>

Inheritance diagram for ACE_Creation_Strategy< SVC_HANDLER >:
Inheritance graph
[legend]
Collaboration diagram for ACE_Creation_Strategy< SVC_HANDLER >:
Collaboration graph
[legend]

List of all members.

Public Types

typedef SVC_HANDLER::addr_type addr_type
typedef SVC_HANDLER handler_type
typedef SVC_HANDLER::stream_type stream_type

Public Member Functions

 ACE_Creation_Strategy (ACE_Thread_Manager *=0, ACE_Reactor *=ACE_Reactor::instance())
 Default constructor.
int open (ACE_Thread_Manager *=0, ACE_Reactor *=ACE_Reactor::instance())
virtual ~ACE_Creation_Strategy (void)
virtual int make_svc_handler (SVC_HANDLER *&sh)
void dump (void) const
 Dump the state of an object.

Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks.

Protected Attributes

ACE_Thread_Managerthr_mgr_
 Pointer to a thread manager.
ACE_Reactorreactor_
 Pointer to an ACE_Reactor.

Detailed Description

template<class SVC_HANDLER>
class ACE_Creation_Strategy< SVC_HANDLER >

Defines the interface for specifying a creation strategy for a SVC_HANDLER.

The default behavior is to make a new SVC_HANDLER. However, subclasses can override this strategy to perform SVC_HANDLER creation in any way that they like (such as creating subclass instances of SVC_HANDLER, using a singleton, dynamically linking the handler, etc.).

Definition at line 84 of file Strategies_T.h.


Member Typedef Documentation

template<class SVC_HANDLER>
typedef SVC_HANDLER::addr_type ACE_Creation_Strategy< SVC_HANDLER >::addr_type

Definition at line 89 of file Strategies_T.h.

template<class SVC_HANDLER>
typedef SVC_HANDLER ACE_Creation_Strategy< SVC_HANDLER >::handler_type

Definition at line 90 of file Strategies_T.h.

template<class SVC_HANDLER>
typedef SVC_HANDLER::stream_type ACE_Creation_Strategy< SVC_HANDLER >::stream_type

Definition at line 91 of file Strategies_T.h.


Constructor & Destructor Documentation

template<class SVC_HANDLER >
ACE_Creation_Strategy< SVC_HANDLER >::ACE_Creation_Strategy ( ACE_Thread_Manager thr_mgr = 0,
ACE_Reactor reactor = ACE_Reactor::instance () 
)

Default constructor.

Definition at line 31 of file Strategies_T.inl.

{
  ACE_TRACE ("ACE_Creation_Strategy<SVC_HANDLER>::ACE_Creation_Strategy");
  if (this->open (thr_mgr, reactor) == -1)
    ACE_ERROR ((LM_ERROR,
                ACE_TEXT ("%p\n"),
                ACE_TEXT ("ACE_Creation_Strategy")));
}

template<class SVC_HANDLER >
ACE_Creation_Strategy< SVC_HANDLER >::~ACE_Creation_Strategy ( void   )  [virtual]

Definition at line 1447 of file Strategies_T.cpp.

{
  ACE_TRACE ("ACE_Creation_Strategy<SVC_HANDLER>::~ACE_Creation_Strategy");
}


Member Function Documentation

template<class SVC_HANDLER >
void ACE_Creation_Strategy< SVC_HANDLER >::dump ( void   )  const

Dump the state of an object.

Reimplemented in ACE_Singleton_Strategy< SVC_HANDLER >, and ACE_DLL_Strategy< SVC_HANDLER >.

Definition at line 1467 of file Strategies_T.cpp.

{
#if defined (ACE_HAS_DUMP)
  ACE_TRACE ("ACE_Creation_Strategy<SVC_HANDLER>::dump");
#endif /* ACE_HAS_DUMP */
}

template<class SVC_HANDLER >
int ACE_Creation_Strategy< SVC_HANDLER >::make_svc_handler ( SVC_HANDLER *&  sh  )  [virtual]

Create a SVC_HANDLER with the appropriate creation strategy. The default behavior of this method is to make a new SVC_HANDLER if sh == 0 (passing in the Thread_Manager), else sh is unchanged. Returns -1 on failure, else 0.

Reimplemented in ACE_Singleton_Strategy< SVC_HANDLER >, ACE_DLL_Strategy< SVC_HANDLER >, and ACE_NOOP_Creation_Strategy< SVC_HANDLER >.

Definition at line 1456 of file Strategies_T.cpp.

{
  ACE_TRACE ("ACE_Creation_Strategy<SVC_HANDLER>::make_svc_handler");

  if (sh == 0)
    ACE_NEW_RETURN (sh, SVC_HANDLER (this->thr_mgr_), -1);
  sh->reactor (this->reactor_);
  return 0;
}

template<class SVC_HANDLER >
int ACE_Creation_Strategy< SVC_HANDLER >::open ( ACE_Thread_Manager thr_mgr = 0,
ACE_Reactor reactor = ACE_Reactor::instance () 
)

An ACE_Thread_Manager is useful when creating active objects and the ACE_Reactor is used to initialize the service handler's reactor.

Definition at line 21 of file Strategies_T.inl.

{
  ACE_TRACE ("ACE_Creation_Strategy<SVC_HANDLER>::open");
  this->thr_mgr_ = thr_mgr;
  this->reactor_ = reactor;
  return 0;
}


Member Data Documentation

template<class SVC_HANDLER>
ACE_Creation_Strategy< SVC_HANDLER >::ACE_ALLOC_HOOK_DECLARE

Declare the dynamic allocation hooks.

Reimplemented in ACE_Singleton_Strategy< SVC_HANDLER >, and ACE_DLL_Strategy< SVC_HANDLER >.

Definition at line 119 of file Strategies_T.h.

template<class SVC_HANDLER>
ACE_Reactor* ACE_Creation_Strategy< SVC_HANDLER >::reactor_ [protected]

Pointer to an ACE_Reactor.

Definition at line 126 of file Strategies_T.h.

template<class SVC_HANDLER>
ACE_Thread_Manager* ACE_Creation_Strategy< SVC_HANDLER >::thr_mgr_ [protected]

Pointer to a thread manager.

Definition at line 123 of file Strategies_T.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines