Public Member Functions | Protected Attributes

TAO_AV_Flow_Handler Class Reference

#include <Transport.h>

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

List of all members.

Public Member Functions

 TAO_AV_Flow_Handler (void)
 Constructor.
virtual ~TAO_AV_Flow_Handler (void)
virtual int start (TAO_FlowSpec_Entry::Role role)
 Start/stop the flow handler.
virtual int stop (TAO_FlowSpec_Entry::Role role)
virtual int schedule_timer (void)
 Schedule timer. Uses the get_timeout method on the callback.
virtual int cancel_timer (void)
TAO_AV_Transporttransport (void)
 get the transport.
TAO_AV_Protocol_Objectprotocol_object (void)
 set/get protocol_object.
void protocol_object (TAO_AV_Protocol_Object *protocol_object)
void callback (TAO_AV_Callback *callback)
 set the callback.
virtual int handle_timeout (const ACE_Time_Value &tv, const void *arg=0)
 Handle timeout. called from reactor.
virtual int set_remote_address (ACE_Addr *address)
 set the remote address.
virtual ACE_Event_Handlerevent_handler (void)=0
 get the underlying event handler. To be overridden by the derived clases.
virtual int change_qos (AVStreams::QoS)

Protected Attributes

TAO_AV_Transporttransport_
TAO_AV_Callbackcallback_
TAO_AV_Protocol_Objectprotocol_object_
long timer_id_
ACE_Reactorreactor_
void * timeout_arg_

Detailed Description

Definition at line 110 of file Transport.h.


Constructor & Destructor Documentation

TAO_AV_Flow_Handler::TAO_AV_Flow_Handler ( void   ) 

Constructor.

Definition at line 488 of file Transport.cpp.

  :transport_ (0),
   callback_ (0),
   protocol_object_ (0),
   timer_id_ (-1)
{
}

TAO_AV_Flow_Handler::~TAO_AV_Flow_Handler ( void   )  [virtual]

Definition at line 496 of file Transport.cpp.

{
  // cancel the timer (if there is one)
  this->cancel_timer();
}


Member Function Documentation

void TAO_AV_Flow_Handler::callback ( TAO_AV_Callback callback  ) 

set the callback.

Definition at line 626 of file Transport.cpp.

{
  this->callback_ = callback;
}

int TAO_AV_Flow_Handler::cancel_timer ( void   )  [virtual]

Definition at line 549 of file Transport.cpp.

{
  if (this->timer_id_ != -1)
  return TAO_AV_CORE::instance()->reactor ()->cancel_timer (this->timer_id_);
  else
    return 0;
}

int TAO_AV_Flow_Handler::change_qos ( AVStreams::QoS   )  [virtual]

Definition at line 602 of file Transport.cpp.

{
  return 0;
}

virtual ACE_Event_Handler* TAO_AV_Flow_Handler::event_handler ( void   )  [pure virtual]

get the underlying event handler. To be overridden by the derived clases.

int TAO_AV_Flow_Handler::handle_timeout ( const ACE_Time_Value tv,
const void *  arg = 0 
) [virtual]

Handle timeout. called from reactor.

Definition at line 578 of file Transport.cpp.

{
  int result = this->callback_->handle_timeout (this->timeout_arg_);
  if (result < 0)
    return result;
  ACE_Event_Handler *event_handler = this->event_handler ();
  ACE_Time_Value *timeout = 0;

  this->callback_->get_timeout (timeout,  this->timeout_arg_);
  if (timeout == 0)
    return 0;

  this->timer_id_ =  event_handler->reactor ()->schedule_timer (event_handler,
                                                                0,
                                                                *timeout);

  if (this->timer_id_ < 0)
    return -1;

  return 0;
}

TAO_AV_Protocol_Object * TAO_AV_Flow_Handler::protocol_object ( void   ) 

set/get protocol_object.

Definition at line 620 of file Transport.cpp.

{
  return this->protocol_object_;
}

void TAO_AV_Flow_Handler::protocol_object ( TAO_AV_Protocol_Object protocol_object  ) 

Definition at line 614 of file Transport.cpp.

{
  this->protocol_object_ = protocol_object;
}

int TAO_AV_Flow_Handler::schedule_timer ( void   )  [virtual]

Schedule timer. Uses the get_timeout method on the callback.

Definition at line 527 of file Transport.cpp.

{
  ACE_Event_Handler *event_handler = this->event_handler ();
  ACE_Time_Value *tv = 0;

  this->callback_->get_timeout (tv, this->timeout_arg_);
  if (tv == 0)
    return 0;

  this->timer_id_ =
      TAO_AV_CORE::instance()->reactor ()->schedule_timer (event_handler,
                                                           0,
                                                           *tv);

  if (this->timer_id_ < 0)
    return -1;

  return 0;
}

int TAO_AV_Flow_Handler::set_remote_address ( ACE_Addr address  )  [virtual]

set the remote address.

Definition at line 503 of file Transport.cpp.

{
  return 0;
}

int TAO_AV_Flow_Handler::start ( TAO_FlowSpec_Entry::Role  role  )  [virtual]

Start/stop the flow handler.

Definition at line 509 of file Transport.cpp.

{
  this->callback_->handle_start ();
  switch (role)
    {
      // only for producer we register for the timeout.
    case TAO_FlowSpec_Entry::TAO_AV_PRODUCER:
      {
        this->schedule_timer ();
      }
      break;
    default:
      break;
    }
  return 0;
}

int TAO_AV_Flow_Handler::stop ( TAO_FlowSpec_Entry::Role  role  )  [virtual]

Definition at line 559 of file Transport.cpp.

{
  this->callback_->handle_stop ();
  switch (role)
    {
    case TAO_FlowSpec_Entry::TAO_AV_PRODUCER:
      {
        int result =  this->event_handler ()->reactor ()->cancel_timer (this->timer_id_);
        if (result <  0)
          if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG,"TAO_AV_Flow_Handler::stop:cancel_timer failed\n"));
      }
      break;
    default:
      break;
    }
  return 0;
}

TAO_AV_Transport * TAO_AV_Flow_Handler::transport ( void   ) 

get the transport.

Definition at line 608 of file Transport.cpp.

{
  return this->transport_;
}


Member Data Documentation

Definition at line 148 of file Transport.h.

Definition at line 149 of file Transport.h.

Definition at line 151 of file Transport.h.

Definition at line 152 of file Transport.h.

Definition at line 150 of file Transport.h.

Definition at line 147 of file Transport.h.


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