ACE_Reactive_Strategy< SVC_HANDLER > Class Template Reference

Defines the interface for specifying a reactive concurrency strategy for a SVC_HANDLER, where all upcalls to handle_*() methods run in the reactor's thread of control. More...

#include <Strategies_T.h>

Inheritance diagram for ACE_Reactive_Strategy< SVC_HANDLER >:

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

Collaboration graph
[legend]
List of all members.

Public Types

typedef ACE_Concurrency_Strategy<
SVC_HANDLER > 
base_type

Public Member Functions

 ACE_Reactive_Strategy (int flags=0)
 "Do-nothing constructor"
 ACE_Reactive_Strategy (ACE_Reactor *reactor, ACE_Reactor_Mask=ACE_Event_Handler::READ_MASK, int flags=0)
 Initialize the strategy.
virtual int open (ACE_Reactor *reactor, ACE_Reactor_Mask=ACE_Event_Handler::READ_MASK, int flags=0)
 Initialize the strategy.
virtual ~ACE_Reactive_Strategy (void)
 Destructor.
virtual int activate_svc_handler (SVC_HANDLER *svc_handler, void *arg=0)
void dump (void) const
 Dump the state of an object.

Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks.

Protected Types

typedef ACE_Concurrency_Strategy<
SVC_HANDLER > 
inherited

Protected Attributes

ACE_Reactorreactor_
 Pointer to the Reactor we'll use to register the SVC_HANDLER.
ACE_Reactor_Mask mask_

Detailed Description

template<class SVC_HANDLER>
class ACE_Reactive_Strategy< SVC_HANDLER >

Defines the interface for specifying a reactive concurrency strategy for a SVC_HANDLER, where all upcalls to handle_*() methods run in the reactor's thread of control.

This class provides a strategy that registers the SVC_HANDLER with a <Reactor>.

Definition at line 299 of file Strategies_T.h.


Member Typedef Documentation

template<class SVC_HANDLER>
typedef ACE_Concurrency_Strategy<SVC_HANDLER> ACE_Reactive_Strategy< SVC_HANDLER >::base_type

Definition at line 304 of file Strategies_T.h.

template<class SVC_HANDLER>
typedef ACE_Concurrency_Strategy<SVC_HANDLER> ACE_Reactive_Strategy< SVC_HANDLER >::inherited [protected]

Definition at line 336 of file Strategies_T.h.


Constructor & Destructor Documentation

template<class SVC_HANDLER>
ACE_INLINE ACE_Reactive_Strategy< SVC_HANDLER >::ACE_Reactive_Strategy ( int  flags = 0  ) 

"Do-nothing constructor"

Definition at line 88 of file Strategies_T.inl.

References ACE_TRACE.

00089   : ACE_Concurrency_Strategy<SVC_HANDLER> (flags),
00090     reactor_ (0),
00091     mask_ (ACE_Event_Handler::NULL_MASK)
00092 {
00093   ACE_TRACE ("ACE_Reactive_Strategy<SVC_HANDLER>::ACE_Reactive_Strategy");
00094 }

template<class SVC_HANDLER>
ACE_INLINE ACE_Reactive_Strategy< SVC_HANDLER >::ACE_Reactive_Strategy ( ACE_Reactor reactor,
ACE_Reactor_Mask  = ACE_Event_Handler::READ_MASK,
int  flags = 0 
)

Initialize the strategy.

Definition at line 73 of file Strategies_T.inl.

References ACE_ERROR, ACE_TEXT, ACE_TRACE, and LM_ERROR.

00076 {
00077   ACE_TRACE ("ACE_Reactive_Strategy<SVC_HANDLER>::ACE_Reactive_Strategy");
00078 
00079   if (this->open (reactor,
00080                   mask,
00081                   flags) == -1)
00082     ACE_ERROR ((LM_ERROR,
00083                 ACE_TEXT ("%p\n"),
00084                 ACE_TEXT ("ACE_Reactive_Strategy<SVC_HANDLER>::ACE_Reactive_Strategy")));
00085 }

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

Destructor.

Definition at line 1256 of file Strategies_T.cpp.

References ACE_TRACE.

01257 {
01258   ACE_TRACE ("ACE_Reactive_Strategy<SVC_HANDLER>::~ACE_Reactive_Strategy");
01259 }


Member Function Documentation

template<class SVC_HANDLER>
int ACE_Reactive_Strategy< SVC_HANDLER >::activate_svc_handler ( SVC_HANDLER *  svc_handler,
void *  arg = 0 
) [virtual]

Activate the <svc_handler> by registering it with the <Reactor> and then calling it's <open> hook.

Reimplemented from ACE_Concurrency_Strategy< SVC_HANDLER >.

Definition at line 223 of file Strategies_T.cpp.

References ACE_TRACE, and ACE_Concurrency_Strategy< SVC_HANDLER >::activate_svc_handler().

00225 {
00226   ACE_TRACE ("ACE_Reactive_Strategy<SVC_HANDLER>::activate_svc_handler");
00227 
00228   int result = 0;
00229 
00230   if (this->reactor_ == 0)
00231     result = -1;
00232 
00233   // Register with the Reactor with the appropriate <mask>.
00234   else if (this->reactor_->register_handler (svc_handler, this->mask_) == -1)
00235     result = -1;
00236 
00237   // If the implementation of the reactor uses event associations
00238   else if (this->reactor_->uses_event_associations ())
00239     {
00240       // If we don't have non-block on, it won't work with
00241       // WFMO_Reactor
00242       // This maybe too harsh
00243       // if (!ACE_BIT_ENABLED (this->flags_, ACE_NONBLOCK))
00244       // goto failure;
00245       if (svc_handler->open (arg) != -1)
00246         return 0;
00247       else
00248         result = -1;
00249     }
00250   else
00251     // Call up to our parent to do the SVC_HANDLER initialization.
00252     return this->inherited::activate_svc_handler (svc_handler, arg);
00253 
00254   if (result == -1)
00255     svc_handler->close (0);
00256 
00257   return result;
00258 }

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

Dump the state of an object.

Reimplemented from ACE_Concurrency_Strategy< SVC_HANDLER >.

Definition at line 1263 of file Strategies_T.cpp.

References ACE_TRACE.

01264 {
01265 #if defined (ACE_HAS_DUMP)
01266   ACE_TRACE ("ACE_Reactive_Strategy<SVC_HANDLER>::dump");
01267 #endif /* ACE_HAS_DUMP */
01268 }

template<class SVC_HANDLER>
int ACE_Reactive_Strategy< SVC_HANDLER >::open ( ACE_Reactor reactor,
ACE_Reactor_Mask  = ACE_Event_Handler::READ_MASK,
int  flags = 0 
) [virtual]

Initialize the strategy.

Definition at line 206 of file Strategies_T.cpp.

References ACE_TRACE, ACE_Concurrency_Strategy< SVC_HANDLER >::flags_, ACE_Reactive_Strategy< SVC_HANDLER >::mask_, and ACE_Reactive_Strategy< SVC_HANDLER >::reactor_.

00209 {
00210   ACE_TRACE ("ACE_Reactive_Strategy<SVC_HANDLER>::open");
00211   this->reactor_ = reactor;
00212   this->mask_ = mask;
00213   this->flags_ = flags;
00214 
00215   // Must have a <Reactor>
00216   if (this->reactor_ == 0)
00217     return -1;
00218   else
00219     return 0;
00220 }


Member Data Documentation

template<class SVC_HANDLER>
ACE_Reactive_Strategy< SVC_HANDLER >::ACE_ALLOC_HOOK_DECLARE

Declare the dynamic allocation hooks.

Reimplemented from ACE_Concurrency_Strategy< SVC_HANDLER >.

Definition at line 333 of file Strategies_T.h.

template<class SVC_HANDLER>
ACE_Reactor_Mask ACE_Reactive_Strategy< SVC_HANDLER >::mask_ [protected]

The mask that we pass to the <Reactor> when we register the SVC_HANDLER.

Definition at line 343 of file Strategies_T.h.

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

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

Pointer to the Reactor we'll use to register the SVC_HANDLER.

Definition at line 339 of file Strategies_T.h.

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


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