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

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_Reactive_Strategy< SVC_HANDLER >::ACE_Reactive_Strategy ( int  flags = 0  ) 

"Do-nothing constructor"

Definition at line 88 of file Strategies_T.inl.

  : ACE_Concurrency_Strategy<SVC_HANDLER> (flags),
    reactor_ (0),
    mask_ (ACE_Event_Handler::NULL_MASK)
{
  ACE_TRACE ("ACE_Reactive_Strategy<SVC_HANDLER>::ACE_Reactive_Strategy");
}

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

Initialize the strategy.

Definition at line 73 of file Strategies_T.inl.

{
  ACE_TRACE ("ACE_Reactive_Strategy<SVC_HANDLER>::ACE_Reactive_Strategy");

  if (this->open (reactor,
                  mask,
                  flags) == -1)
    ACE_ERROR ((LM_ERROR,
                ACE_TEXT ("%p\n"),
                ACE_TEXT ("ACE_Reactive_Strategy<SVC_HANDLER>::ACE_Reactive_Strategy")));
}

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

Destructor.

Definition at line 1260 of file Strategies_T.cpp.

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


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

{
  ACE_TRACE ("ACE_Reactive_Strategy<SVC_HANDLER>::activate_svc_handler");

  int result = 0;

  if (this->reactor_ == 0)
    result = -1;

  // Register with the Reactor with the appropriate <mask>.
  else if (this->reactor_->register_handler (svc_handler, this->mask_) == -1)
    result = -1;

  // If the implementation of the reactor uses event associations
  else if (this->reactor_->uses_event_associations ())
    {
      // If we don't have non-block on, it won't work with
      // WFMO_Reactor
      // This maybe too harsh
      // if (!ACE_BIT_ENABLED (this->flags_, ACE_NONBLOCK))
      // goto failure;
      if (svc_handler->open (arg) != -1)
        return 0;
      else
        result = -1;
    }
  else
    // Call up to our parent to do the SVC_HANDLER initialization.
    return this->inherited::activate_svc_handler (svc_handler, arg);

  if (result == -1)
    // The connection was already made; so this close is a "normal" close
    // operation.
    svc_handler->close (NORMAL_CLOSE_OPERATION);

  return result;
}

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

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

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

Initialize the strategy.

Definition at line 209 of file Strategies_T.cpp.

{
  ACE_TRACE ("ACE_Reactive_Strategy<SVC_HANDLER>::open");
  this->reactor_ = reactor;
  this->mask_ = mask;
  this->flags_ = flags;

  // Must have a <Reactor>
  if (this->reactor_ == 0)
    return -1;
  else
    return 0;
}


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.

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.


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