TAO_EC_Timeout_Filter Class Reference

A filter based on event type/source. More...

#include <EC_Timeout_Filter.h>

Inheritance diagram for TAO_EC_Timeout_Filter:

Inheritance graph
[legend]
Collaboration diagram for TAO_EC_Timeout_Filter:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TAO_EC_Timeout_Filter (TAO_EC_Event_Channel_Base *event_channel, TAO_EC_ProxyPushSupplier *supplier, const TAO_EC_QOS_Info &qos_info, RtecEventComm::EventType type, RtecEventComm::Time period)
 Constructor.
virtual ~TAO_EC_Timeout_Filter (void)
 Destructor.
const TAO_EC_QOS_Infoqos_info (void) const
 Return the QOS_Info for this Timeout filter.
RtecEventComm::EventType type (void) const
 The type of timeout event that we generate.
void push_to_proxy (const RtecEventComm::EventSet &event, TAO_EC_QOS_Info &qos_info)
 Callback from the Timeout_Generator.
virtual int filter (const RtecEventComm::EventSet &event, TAO_EC_QOS_Info &qos_info)
virtual int filter_nocopy (RtecEventComm::EventSet &event, TAO_EC_QOS_Info &qos_info)
virtual void push (const RtecEventComm::EventSet &event, TAO_EC_QOS_Info &qos_info)
virtual void push_nocopy (RtecEventComm::EventSet &event, TAO_EC_QOS_Info &qos_info)
virtual void clear (void)
virtual CORBA::ULong max_event_size (void) const
 Returns the maximum size of the events pushed by this filter.
virtual int can_match (const RtecEventComm::EventHeader &header) const
virtual int add_dependencies (const RtecEventComm::EventHeader &header, const TAO_EC_QOS_Info &qos_info)

Private Member Functions

 TAO_EC_Timeout_Filter (const TAO_EC_Timeout_Filter &)
TAO_EC_Timeout_Filteroperator= (const TAO_EC_Timeout_Filter &)

Private Attributes

TAO_EC_Event_Channel_Baseevent_channel_
 The event channel.
TAO_EC_ProxyPushSuppliersupplier_
 The supplier that finally receives the timeout event.
TAO_EC_QOS_Info qos_info_
 Events "generated" by this filter use this QOS_Info.
RtecEventComm::EventType type_
 The type of timeout event...
RtecEventComm::Time period_
 The period for deadline timeouts...
long id_

Detailed Description

A filter based on event type/source.

This filter only accept events with a predefined type/source, both the source and the type can be wildcards.

Definition at line 42 of file EC_Timeout_Filter.h.


Constructor & Destructor Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_EC_Timeout_Filter::TAO_EC_Timeout_Filter ( TAO_EC_Event_Channel_Base event_channel,
TAO_EC_ProxyPushSupplier supplier,
const TAO_EC_QOS_Info qos_info,
RtecEventComm::EventType  type,
RtecEventComm::Time  period 
)

Constructor.

Definition at line 20 of file EC_Timeout_Filter.cpp.

References ACE_ES_EVENT_DEADLINE_TIMEOUT, ACE_ES_EVENT_INTERVAL_TIMEOUT, TAO_EC_Timeout_Generator::schedule_timer(), and ACE_Time_Value::zero.

00026   : event_channel_ (event_channel),
00027     supplier_ (supplier),
00028     qos_info_ (qos_info),
00029     type_ (type),
00030     period_ (period),
00031     id_ (-1)
00032 {
00033   ACE_Time_Value tv_delta;
00034   ORBSVCS_Time::TimeT_to_Time_Value (tv_delta, period);
00035 
00036   TAO_EC_Timeout_Generator *tg =
00037     this->event_channel_->timeout_generator ();
00038 
00039   if (this->type_ == ACE_ES_EVENT_INTERVAL_TIMEOUT
00040       || this->type_ == ACE_ES_EVENT_DEADLINE_TIMEOUT)
00041     {
00042       ACE_Time_Value tv_interval;
00043       ORBSVCS_Time::TimeT_to_Time_Value (tv_interval, this->period_);
00044 
00045       this->id_ =
00046         tg->schedule_timer (this,
00047                             tv_delta,
00048                             tv_interval);
00049     }
00050   else
00051     {
00052       this->id_ =
00053         tg->schedule_timer (this,
00054                             tv_delta,
00055                             ACE_Time_Value::zero);
00056     }
00057 
00058   //  ACE_DEBUG ((LM_DEBUG,
00059   //              "EC_Timeout_Filter - interval = %d:%d, ID = %d\n",
00060   //              tv_interval.sec (), tv_interval.usec (),
00061   //              this->id_));
00062 }

TAO_EC_Timeout_Filter::~TAO_EC_Timeout_Filter ( void   )  [virtual]

Destructor.

Definition at line 64 of file EC_Timeout_Filter.cpp.

References TAO_EC_Timeout_Generator::cancel_timer(), event_channel_, and TAO_EC_Event_Channel_Base::timeout_generator().

00065 {
00066   this->event_channel_->timeout_generator ()->cancel_timer (this->qos_info_,
00067                                                             this->id_);
00068 }

TAO_EC_Timeout_Filter::TAO_EC_Timeout_Filter ( const TAO_EC_Timeout_Filter  )  [private]


Member Function Documentation

int TAO_EC_Timeout_Filter::add_dependencies ( const RtecEventComm::EventHeader header,
const TAO_EC_QOS_Info qos_info 
) [virtual]

This is used for computing the scheduling dependencies:

Leaf filters check if the header could be matched, similar to the can_match() method; if it does they return 1, and 0 otherwise. Intermediate nodes always return 0.

This is used to build precise dependencies between the suppliers and the leaf of the filters that accept that event. Notice that only the nodes doing scheduling recurse through the list, so in configurations that do no require scheduling the recursion stops fairly soon.

Implements TAO_EC_Filter.

Definition at line 155 of file EC_Timeout_Filter.cpp.

00158 {
00159   return 0;
00160 }

int TAO_EC_Timeout_Filter::can_match ( const RtecEventComm::EventHeader header  )  const [virtual]

Returns 0 if an event with that header could never be accepted. This can used by the suppliers to filter out consumers that couldn't possibly be interested in their events. The rt_info and

Implements TAO_EC_Filter.

Definition at line 148 of file EC_Timeout_Filter.cpp.

00150 {
00151   return 0;
00152 }

void TAO_EC_Timeout_Filter::clear ( void   )  [virtual]

Clear any saved state, must reset and assume no events have been received.

Implements TAO_EC_Filter.

Definition at line 120 of file EC_Timeout_Filter.cpp.

References ACE_ES_EVENT_DEADLINE_TIMEOUT, TAO_EC_Timeout_Generator::cancel_timer(), event_channel_, id_, TAO_EC_Timeout_Generator::schedule_timer(), and TAO_EC_Event_Channel_Base::timeout_generator().

00121 {
00122   if (this->type_ == ACE_ES_EVENT_DEADLINE_TIMEOUT)
00123     {
00124       TAO_EC_Timeout_Generator *tg =
00125         this->event_channel_->timeout_generator ();
00126 
00127       tg->cancel_timer (this->qos_info_,
00128                         this->id_);
00129 
00130       ACE_Time_Value tv_interval;
00131       ORBSVCS_Time::TimeT_to_Time_Value (tv_interval, this->period_);
00132       ACE_Time_Value tv_delta = tv_interval;
00133 
00134       this->id_ =
00135         tg->schedule_timer (this,
00136                             tv_delta,
00137                             tv_interval);
00138     }
00139 }

int TAO_EC_Timeout_Filter::filter ( const RtecEventComm::EventSet event,
TAO_EC_QOS_Info qos_info 
) [virtual]

Filter this event, returns 1 if the event is accepted, 0 otherwise. Notice that there are two versions of the method, if the event is not const then filter can take ownership of the event.

Attention:
There seems to be a disparity in interfaces: Supplier always push event sets of size 1 to the EC_ProxyPushSupplier, and EC_Filters do not implement handling of sets of more than 1 event. Then, why is this not enforced by the interface by having EC_ProxyPushSupplier take an event rather than a set?

Implements TAO_EC_Filter.

Definition at line 82 of file EC_Timeout_Filter.cpp.

References qos_info(), and TAO_EC_QOS_Info::timer_id_.

00084 {
00085   if (qos_info.timer_id_ == this->id_
00086       && this->parent () != 0)
00087     {
00088       this->parent ()->push (event, qos_info);
00089       return 1;
00090     }
00091   return 0;
00092 }

int TAO_EC_Timeout_Filter::filter_nocopy ( RtecEventComm::EventSet event,
TAO_EC_QOS_Info qos_info 
) [virtual]

Implements TAO_EC_Filter.

Definition at line 95 of file EC_Timeout_Filter.cpp.

References qos_info(), and TAO_EC_QOS_Info::timer_id_.

00097 {
00098   if (qos_info.timer_id_ == this->id_
00099       && this->parent () != 0)
00100     {
00101       this->parent ()->push_nocopy (event, qos_info);
00102       return 1;
00103     }
00104   return 0;
00105 }

CORBA::ULong TAO_EC_Timeout_Filter::max_event_size ( void   )  const [virtual]

Returns the maximum size of the events pushed by this filter.

Implements TAO_EC_Filter.

Definition at line 142 of file EC_Timeout_Filter.cpp.

00143 {
00144   return 1;
00145 }

TAO_EC_Timeout_Filter& TAO_EC_Timeout_Filter::operator= ( const TAO_EC_Timeout_Filter  )  [private]

void TAO_EC_Timeout_Filter::push ( const RtecEventComm::EventSet event,
TAO_EC_QOS_Info qos_info 
) [virtual]

This is called by the children when they accept an event and which to pass it up. Notice that there are two versions of the method, if the event is not const then filter can take ownership of the event.

Implements TAO_EC_Filter.

Definition at line 108 of file EC_Timeout_Filter.cpp.

00110 {
00111 }

void TAO_EC_Timeout_Filter::push_nocopy ( RtecEventComm::EventSet event,
TAO_EC_QOS_Info qos_info 
) [virtual]

Implements TAO_EC_Filter.

Definition at line 114 of file EC_Timeout_Filter.cpp.

00116 {
00117 }

void TAO_EC_Timeout_Filter::push_to_proxy ( const RtecEventComm::EventSet event,
TAO_EC_QOS_Info qos_info 
)

Callback from the Timeout_Generator.

Definition at line 71 of file EC_Timeout_Filter.cpp.

References TAO_EC_ProxyPushSupplier::filter(), id_, qos_info(), supplier_, and TAO_EC_QOS_Info::timer_id_.

Referenced by TAO_EC_Timeout_Adapter::handle_timeout().

00073 {
00074   qos_info.timer_id_ = this->id_;
00075 
00076   if (this->supplier_ != 0)
00077     this->supplier_->filter (event,
00078                              qos_info);
00079 }

TAO_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE const TAO_EC_QOS_Info & TAO_EC_Timeout_Filter::qos_info ( void   )  const

Return the QOS_Info for this Timeout filter.

Definition at line 8 of file EC_Timeout_Filter.inl.

References qos_info_.

Referenced by filter(), filter_nocopy(), TAO_EC_Timeout_Adapter::handle_timeout(), and push_to_proxy().

00009 {
00010   return this->qos_info_;
00011 }

ACE_INLINE RtecEventComm::EventType TAO_EC_Timeout_Filter::type ( void   )  const

The type of timeout event that we generate.

Definition at line 14 of file EC_Timeout_Filter.inl.

References type_.

Referenced by TAO_EC_Timeout_Adapter::handle_timeout().

00015 {
00016   return this->type_;
00017 }


Member Data Documentation

TAO_EC_Event_Channel_Base* TAO_EC_Timeout_Filter::event_channel_ [private]

The event channel.

Definition at line 87 of file EC_Timeout_Filter.h.

Referenced by clear(), and ~TAO_EC_Timeout_Filter().

long TAO_EC_Timeout_Filter::id_ [private]

The ID of the timeout in the Timeout_Generator, for cancellation.

Definition at line 103 of file EC_Timeout_Filter.h.

Referenced by clear(), and push_to_proxy().

RtecEventComm::Time TAO_EC_Timeout_Filter::period_ [private]

The period for deadline timeouts...

Definition at line 99 of file EC_Timeout_Filter.h.

TAO_EC_QOS_Info TAO_EC_Timeout_Filter::qos_info_ [private]

Events "generated" by this filter use this QOS_Info.

Definition at line 93 of file EC_Timeout_Filter.h.

Referenced by qos_info().

TAO_EC_ProxyPushSupplier* TAO_EC_Timeout_Filter::supplier_ [private]

The supplier that finally receives the timeout event.

Definition at line 90 of file EC_Timeout_Filter.h.

Referenced by push_to_proxy().

RtecEventComm::EventType TAO_EC_Timeout_Filter::type_ [private]

The type of timeout event...

Definition at line 96 of file EC_Timeout_Filter.h.

Referenced by type().


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:44:36 2010 for TAO_RTEvent by  doxygen 1.4.7