Classes | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes

TAO_LF_Multi_Event Class Reference

Use the Leader/Follower loop to wait for one specific event in the invocation path. More...

#include <LF_Multi_Event.h>

Inheritance diagram for TAO_LF_Multi_Event:
Inheritance graph
[legend]
Collaboration diagram for TAO_LF_Multi_Event:
Collaboration graph
[legend]

List of all members.

Classes

struct  Event_Node

Public Member Functions

 TAO_LF_Multi_Event (void)
 Constructor.
virtual ~TAO_LF_Multi_Event (void)
 Destructor.
virtual int bind (TAO_LF_Follower *follower)
 propogate the follower to all the events in the collection.
virtual int unbind (TAO_LF_Follower *follower)
 Unbind the follower from all the collected events.
void add_event (TAO_Connection_Handler *ch)
 Adds a handler to the collection.
TAO_Connection_Handlerwinner (void)
TAO_Transportbase_transport (void)
 Returns the transport associated with the first entry in the collection.

int successful (void) const
int error_detected (void) const

Protected Member Functions

virtual void state_changed_i (int new_state)
 Validate the state change.
virtual int is_state_final (void)
 Check whether we have reached the final state..

Private Member Functions

void operator= (const TAO_LF_Multi_Event &)
 TAO_LF_Multi_Event (const TAO_LF_Multi_Event &)

Private Attributes

struct Event_Nodeevents_
TAO_Connection_Handlerwinner_

Detailed Description

Use the Leader/Follower loop to wait for one specific event in the invocation path.

Used by the parallel connection strategy for waiting on one of many connections.

Definition at line 39 of file LF_Multi_Event.h.


Constructor & Destructor Documentation

TAO_LF_Multi_Event::TAO_LF_Multi_Event ( void   ) 

Constructor.

Definition at line 12 of file LF_Multi_Event.cpp.

  : TAO_LF_Event (),
    events_ (0),
    winner_ (0)
{
}

TAO_LF_Multi_Event::~TAO_LF_Multi_Event ( void   )  [virtual]

Destructor.

Definition at line 19 of file LF_Multi_Event.cpp.

{
  while (this->events_ != 0)
    {
      Event_Node *n = this->events_->next_;
      delete this->events_;
      this->events_ = n;
    }
}

TAO_LF_Multi_Event::TAO_LF_Multi_Event ( const TAO_LF_Multi_Event  )  [private]

Member Function Documentation

void TAO_LF_Multi_Event::add_event ( TAO_Connection_Handler ch  ) 

Adds a handler to the collection.

Definition at line 63 of file LF_Multi_Event.cpp.

{
  Event_Node *node = 0;
  ACE_NEW (node, Event_Node);
  node->next_ = this->events_;
  node->ptr_ = ev;

  this->events_ = node;
}

TAO_Transport * TAO_LF_Multi_Event::base_transport ( void   ) 

Returns the transport associated with the first entry in the collection.

Definition at line 80 of file LF_Multi_Event.cpp.

{
  return (this->events_ == 0) ? 0 : this->events_->ptr_->transport();
}

int TAO_LF_Multi_Event::bind ( TAO_LF_Follower follower  )  [virtual]

propogate the follower to all the events in the collection.

Reimplemented from TAO_LF_Event.

Definition at line 30 of file LF_Multi_Event.cpp.

{
  if (this->TAO_LF_Event::bind(follower) == -1)
    {
      return -1;
    }

  for (Event_Node *n = this->events_; n != 0; n = n->next_)
    if (n->ptr_->bind(follower) == -1)
      {
        return -1;
      }
  return 0;
}

int TAO_LF_Multi_Event::error_detected ( void   )  const [virtual]

Return 1 if an error was detected while waiting for the event - This iterates over the list of events and returns 1 only if all of them return 1 from error_detected.

Implements TAO_LF_Event.

Definition at line 98 of file LF_Multi_Event.cpp.

{
  int result = 1;
  for (Event_Node *n = this->events_; n != 0; n = n->next_)
    if (n->ptr_->error_detected () == 0)
      result = 0;
  return result;
}

int TAO_LF_Multi_Event::is_state_final ( void   )  [protected, virtual]

Check whether we have reached the final state..

Implements TAO_LF_Event.

Definition at line 114 of file LF_Multi_Event.cpp.

{
  int result = 1;
  for (Event_Node *n = this->events_; n != 0; n = n->next_)
    if (!n->ptr_->is_state_final () == 0)
      result = 0;
  return result;
}

void TAO_LF_Multi_Event::operator= ( const TAO_LF_Multi_Event  )  [private]
void TAO_LF_Multi_Event::state_changed_i ( int  new_state  )  [protected, virtual]

Validate the state change.

Implements TAO_LF_Event.

Definition at line 108 of file LF_Multi_Event.cpp.

{
  // no-op
}

int TAO_LF_Multi_Event::successful ( void   )  const [virtual]

Return 1 if the condition was satisfied successfully, 0 if it has not - This iterates over the list of attached events and returns 1 if any of them return 1 from successful.

Implements TAO_LF_Event.

Definition at line 86 of file LF_Multi_Event.cpp.

{
  for (Event_Node *n = this->events_; n != 0; n = n->next_)
    if (n->ptr_->successful() == 1)
      {
        this->winner_ = n->ptr_;
        return 1;
      }
  return 0;
}

int TAO_LF_Multi_Event::unbind ( TAO_LF_Follower follower  )  [virtual]

Unbind the follower from all the collected events.

Reimplemented from TAO_LF_Event.

Definition at line 46 of file LF_Multi_Event.cpp.

{
  if (this->TAO_LF_Event::unbind (follower) == -1)
    {
      return -1;
    }

  for (Event_Node *n = this->events_; n != 0; n = n->next_)
    if (n->ptr_->unbind (follower) == -1)
      {
        return -1;
      }
  return 0;
}

TAO_Connection_Handler * TAO_LF_Multi_Event::winner ( void   ) 

Returns the connection handler that caused the successful status to be returned.

Definition at line 74 of file LF_Multi_Event.cpp.

{
  return this->winner_;
}


Member Data Documentation

Definition at line 95 of file LF_Multi_Event.h.

Definition at line 97 of file LF_Multi_Event.h.


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