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 .

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 with a .

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_LIB_TEXT, ACE_Reactor_Mask, ACE_TRACE, LM_ERROR, and ACE_Reactive_Strategy< SVC_HANDLER >::open().

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_LIB_TEXT ("%p\n"),
00084                 ACE_LIB_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 1257 of file Strategies_T.cpp.

References ACE_TRACE.

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


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 by registering it with the and then calling it's hook.

Reimplemented from ACE_Concurrency_Strategy< SVC_HANDLER >.

Definition at line 224 of file Strategies_T.cpp.

References ACE_TRACE, ACE_Reactor::register_handler(), and ACE_Reactor::uses_event_associations().

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

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

References ACE_TRACE.

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

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

References ACE_Reactor_Mask, and ACE_TRACE.

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

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


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 when we register the .

Definition at line 343 of file Strategies_T.h.

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

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

Definition at line 339 of file Strategies_T.h.


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 11:27:40 2006 for ACE by doxygen 1.3.6