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_INLINE ACE_Creation_Strategy< SVC_HANDLER >::ACE_Creation_Strategy ( ACE_Thread_Manager = 0,
ACE_Reactor = ACE_Reactor::instance() 
)

Default constructor.

Definition at line 31 of file Strategies_T.inl.

References ACE_ERROR, ACE_TEXT, ACE_TRACE, and LM_ERROR.

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

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

Definition at line 1443 of file Strategies_T.cpp.

References ACE_TRACE.

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


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 1463 of file Strategies_T.cpp.

References ACE_TRACE.

Referenced by ACE_Strategy_Acceptor< SVC_HANDLER, >::dump().

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

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 1452 of file Strategies_T.cpp.

References ACE_NEW_RETURN, and ACE_TRACE.

Referenced by ACE_Strategy_Connector< SVC_HANDLER, >::make_svc_handler(), and ACE_Strategy_Acceptor< SVC_HANDLER, >::make_svc_handler().

01453 {
01454   ACE_TRACE ("ACE_Creation_Strategy<SVC_HANDLER>::make_svc_handler");
01455 
01456   if (sh == 0)
01457     ACE_NEW_RETURN (sh, SVC_HANDLER (this->thr_mgr_), -1);
01458   sh->reactor (this->reactor_);
01459   return 0;
01460 }

template<class SVC_HANDLER>
ACE_INLINE int ACE_Creation_Strategy< SVC_HANDLER >::open ( ACE_Thread_Manager = 0,
ACE_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.

References ACE_TRACE, ACE_Creation_Strategy< SVC_HANDLER >::reactor_, and ACE_Creation_Strategy< SVC_HANDLER >::thr_mgr_.

00023 {
00024   ACE_TRACE ("ACE_Creation_Strategy<SVC_HANDLER>::open");
00025   this->thr_mgr_ = thr_mgr;
00026   this->reactor_ = reactor;
00027   return 0;
00028 }


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.

Referenced by ACE_Creation_Strategy< SVC_HANDLER >::open().

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.

Referenced by ACE_Creation_Strategy< SVC_HANDLER >::open().


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:35:03 2010 for ACE by  doxygen 1.4.7