ACE_ConsumerQOS_Factory Class Reference

Consumer QOS Factory. More...

#include <Event_Utilities.h>

Collaboration diagram for ACE_ConsumerQOS_Factory:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ACE_ConsumerQOS_Factory (TAO_EC_Event_Initializer initializer=0)
 Default construction.

 ~ACE_ConsumerQOS_Factory (void)
 Death and destruction.

int start_conjunction_group (int nchildren=0)
int start_disjunction_group (int nchildren=0)
int start_logical_and_group (int nchildren=0)
int start_negation (void)
int start_bitmask (CORBA::ULong source_mask, CORBA::ULong type_mask)
int insert_bitmasked_value (CORBA::ULong source_mask, CORBA::ULong type_mask, CORBA::ULong source_value, CORBA::ULong type_value)
int insert_null_terminator (void)
 Insert a node that accepts any event, useful for bitmask filters.

int insert (const RtecEventChannelAdmin::Dependency &subscribe)
int insert (RtecEventComm::EventSourceID source, RtecEventComm::EventType type, RtecBase::handle_t rt_info)
int insert_type (RtecEventComm::EventType type, RtecBase::handle_t rt_info)
 Insert type-only dependency.

int insert_source (RtecEventComm::EventSourceID source, RtecBase::handle_t rt_info)
 Insert source-only dependency.

int insert_time (RtecEventComm::EventType type, RtecEventComm::Time interval, RtecBase::handle_t rt_info)
int insert_act (RtecEventComm::EventData act)
 This will be inserted as type ACE_ES_EVENT_ACT.

const RtecEventChannelAdmin::ConsumerQOSget_ConsumerQOS (void)
 operator const RtecEventChannelAdmin::ConsumerQOS & (void)
 Calls this->get_ConsumerQOS.


Static Public Member Functions

void debug (const RtecEventChannelAdmin::ConsumerQOS &qos)

Private Attributes

RtecEventChannelAdmin::ConsumerQOS qos_
 The representation to be sent to the channel.

int designator_set_
TAO_EC_Event_Initializer event_initializer_

Detailed Description

Consumer QOS Factory.

This class allows easy (free from CORBA IDL constraints) construction of RtecEventChannelAdmin::ConsumerQOS structures. = CORRELATIONS ACE_ConsumerQOS_Factory separates subscriptions into conjunction and disjunction groups. A group can be thought of as a set of events inside parenthesis: (A+B+C), where A,B, and C are events. The following code would be used to represent (A+B) | (B+C): ACE_ConsumerQOS_Factor factory; factory.start_conjunction_group (); factory.insert (A); factory.insert (B); factory.start_conjunction_group (); factory.insert (B); factory.insert (C); The following code would be used to represent (A|B) | (B|C): ACE_ConsumerQOS_Factor factory; factory.start_disjunction_group (); factory.insert (A); factory.insert (B); factory.start_disjunction_group (); factory.insert (B); factory.insert (C); First, this may not seem to be initially useful, as (A|B) | (B|C) seems the same as A|B|C. However, this form does have a significant use when deadline timers are specified (described below). Note that groups end with the next call to start_XX_group. Groups are always OR'd together. That is, there is no way to directly build (A|B|C) + (D|E|F). You can always expand the previous statement to the OR of multiple ANDs. = TIMEOUTS There are two types of timeout types defined in Event_Service_Constants.h. ACE_ES_EVENT_INTERVAL_TIMEOUT - the consumer wants to receive a timeout every N seconds. ACE_ES_EVENT_DEADLINE_TIMEOUT - the consumer wants the timeout if and only if some dependencies are not resolved first. Using these timeouts with the correlations discussed above, we can construct four different timer semantics: Interval Timer, Deadline Timer, Interval Correlation, Deadline Correlation: Interval Timer: (A+B+C) | (D+E+F) | (G+H+I) | IntervalTimeout This registers to receive an interval timeout regardless of other dependencies. Event if events occur, the interval timeout will still be sent. Deadline Timer: (A+B+C) | (D+E+F) | (G+H+I) | DeadlineTimeout This registers to receive the deadline timeout ONLY if no other events occur. If a single event is sent to the consumer, the timer is cancelled and rescheduled. Deadline Correlation: (A+B+C) | (D+E+F) | (G+H+DeadlineTimeout) If G and H do not occur within DeadlineTimeout time, a deadline timeout is sent. It is cancelled and rescheduled if G and H occur. Interval Correlation: (A+B+C) | (D+E+F) | (G+H+IntervalTimeout) G+H+IntervalTimeout are sent ONLY after all have occurred. If G+H occur, they are queued until IntervalTimeout occurs. If IntervalTimeout occurs, it is queued until G+H occur.

Definition at line 95 of file Event_Utilities.h.


Constructor & Destructor Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL ACE_ConsumerQOS_Factory::ACE_ConsumerQOS_Factory TAO_EC_Event_Initializer  initializer = 0  ) 
 

Default construction.

Definition at line 19 of file Event_Utilities.cpp.

References RtecEventChannelAdmin::ConsumerQOS::is_gateway.

00020   : designator_set_ (0),
00021     event_initializer_ (initializer)
00022 {
00023   qos_.is_gateway = 0;
00024 }

ACE_ConsumerQOS_Factory::~ACE_ConsumerQOS_Factory void   ) 
 

Death and destruction.

Definition at line 26 of file Event_Utilities.cpp.

00027 {
00028 }


Member Function Documentation

void ACE_ConsumerQOS_Factory::debug const RtecEventChannelAdmin::ConsumerQOS qos  )  [static]
 

Definition at line 141 of file Event_Utilities.cpp.

References ACE_DEBUG, RtecEventChannelAdmin::ConsumerQOS::dependencies, event_debug(), RtecEventChannelAdmin::ConsumerQOS::is_gateway, LM_DEBUG, and ACE_OS::sprintf().

00142 {
00143   ACE_DEBUG ((LM_DEBUG, "ConsumerQOS { \n"));
00144   ACE_DEBUG ((LM_DEBUG, "  is_gateway: %d\n", qos.is_gateway));
00145 
00146   for (u_int i = 0; i < qos.dependencies.length (); ++i)
00147     {
00148       char buf[128];
00149       ACE_OS::sprintf (buf, " dep[%d]", i);
00150       event_debug (buf, qos.dependencies[i].event);
00151       ACE_DEBUG ((LM_DEBUG, "%s  rt_info: %d\n",
00152                   buf, qos.dependencies[i].rt_info));
00153     }
00154   ACE_DEBUG ((LM_DEBUG, "}\n"));
00155 }

ACE_INLINE const RtecEventChannelAdmin::ConsumerQOS & ACE_ConsumerQOS_Factory::get_ConsumerQOS void   ) 
 

Allows conversions to ConsumerQOS, which is expected by the PushSupplierProxy::connect_push_consumer interface.

Definition at line 127 of file Event_Utilities.i.

Referenced by TAO_ECG_Mcast_Gateway::init_sender().

00128 {
00129   return qos_;
00130 }

TAO_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE int ACE_ConsumerQOS_Factory::insert RtecEventComm::EventSourceID  source,
RtecEventComm::EventType  type,
RtecBase::handle_t  rt_info
 

Insert source/type dependency. source of the event (may be zero), type of the event. rt_info describes the method that will handle the source/type events.

Definition at line 8 of file Event_Utilities.i.

References RtecEventChannelAdmin::Dependency::event, event_initializer_, RtecEventComm::EventSourceID, RtecBase::handle_t, RtecEventComm::Event::header, insert(), and RtecEventChannelAdmin::Dependency::rt_info.

00011 {
00012   RtecEventChannelAdmin::Dependency dependency;
00013   if (this->event_initializer_ != 0)
00014     (*this->event_initializer_) (dependency.event);
00015   dependency.event.header.source = source;
00016   dependency.event.header.type = type;
00017   //dependency.event.header.creation_time = 0;
00018   //dependency.event.header.ec_recv_time = 0;
00019   //dependency.event.header.ec_send_time = 0;
00020   dependency.rt_info = rt_info;
00021   return this->insert (dependency);
00022 }

int ACE_ConsumerQOS_Factory::insert const RtecEventChannelAdmin::Dependency subscribe  ) 
 

Insert the subscribe structure describing the event and receiving method into the current group.

Definition at line 108 of file Event_Utilities.cpp.

References ACE_ES_GLOBAL_DESIGNATOR, RtecEventChannelAdmin::ConsumerQOS::dependencies, designator_set_, and event_initializer_.

Referenced by TAO_ECG_Mcast_Gateway::init_sender(), insert(), insert_act(), insert_bitmasked_value(), insert_null_terminator(), insert_source(), insert_time(), and insert_type().

00109 {
00110   // Make sure that a designator is first.
00111   if (designator_set_ == 0)
00112     {
00113       int l = qos_.dependencies.length ();
00114       qos_.dependencies.length (l + 1);
00115       if (this->event_initializer_ != 0)
00116         (*this->event_initializer_) (qos_.dependencies[l].event);
00117       qos_.dependencies[l].rt_info = 0;
00118       qos_.dependencies[l].event.header.type = ACE_ES_GLOBAL_DESIGNATOR;
00119 
00120       this->designator_set_ = 1;
00121     }
00122 
00123   int l = qos_.dependencies.length ();
00124   qos_.dependencies.length (l + 1);
00125   qos_.dependencies[l] = subscribe;
00126   return 0;
00127 }

ACE_INLINE int ACE_ConsumerQOS_Factory::insert_act RtecEventComm::EventData  act  ) 
 

This will be inserted as type ACE_ES_EVENT_ACT.

Definition at line 112 of file Event_Utilities.i.

References ACE_ES_EVENT_ACT, RtecEventComm::Event::data, RtecEventChannelAdmin::Dependency::event, event_initializer_, RtecEventComm::EventData, RtecEventComm::Event::header, and insert().

00113 {
00114   RtecEventChannelAdmin::Dependency dependency;
00115   if (this->event_initializer_ != 0)
00116     (*this->event_initializer_) (dependency.event);
00117   dependency.event.header.source = 0;
00118   dependency.event.header.type = ACE_ES_EVENT_ACT;
00119   //dependency.event.header.creation_time = 0;
00120   //dependency.event.header.ec_recv_time = 0;
00121   //dependency.event.header.ec_send_time = 0;
00122   dependency.event.data = act;
00123   return this->insert (dependency);
00124 }

ACE_INLINE int ACE_ConsumerQOS_Factory::insert_bitmasked_value CORBA::ULong  source_mask,
CORBA::ULong  type_mask,
CORBA::ULong  source_value,
CORBA::ULong  type_value
 

Inser a new filter that only accepts events with the following properties: (event.header.type & type_mask) == type_value (event.header.source & source_mask) == source_value

Definition at line 25 of file Event_Utilities.i.

References ACE_ES_MASKED_TYPE_DESIGNATOR, RtecEventChannelAdmin::Dependency::event, event_initializer_, RtecEventComm::Event::header, insert(), and RtecEventChannelAdmin::Dependency::rt_info.

00030 {
00031   RtecEventChannelAdmin::Dependency dependency;
00032   if (this->event_initializer_ != 0)
00033     (*this->event_initializer_) (dependency.event);
00034   dependency.event.header.type = ACE_ES_MASKED_TYPE_DESIGNATOR;
00035   dependency.event.header.source = 0;
00036   //dependency.event.header.creation_time = 0;
00037   //dependency.event.header.ec_recv_time = 0;
00038   //dependency.event.header.ec_send_time = 0;
00039   dependency.rt_info = 0;
00040   this->insert (dependency);
00041 
00042   dependency.event.header.source = source_mask;
00043   dependency.event.header.type = type_mask;
00044   this->insert (dependency);
00045 
00046   dependency.event.header.source = source_value;
00047   dependency.event.header.type = type_value;
00048   return this->insert (dependency);
00049 }

ACE_INLINE int ACE_ConsumerQOS_Factory::insert_null_terminator void   ) 
 

Insert a node that accepts any event, useful for bitmask filters.

Definition at line 52 of file Event_Utilities.i.

References ACE_ES_NULL_DESIGNATOR, RtecEventChannelAdmin::Dependency::event, event_initializer_, RtecEventComm::Event::header, and insert().

00053 {
00054   RtecEventChannelAdmin::Dependency dependency;
00055   if (this->event_initializer_ != 0)
00056     (*this->event_initializer_) (dependency.event);
00057   dependency.event.header.type = ACE_ES_NULL_DESIGNATOR;
00058   dependency.event.header.source = 0;
00059   return this->insert (dependency);
00060 }

ACE_INLINE int ACE_ConsumerQOS_Factory::insert_source RtecEventComm::EventSourceID  source,
RtecBase::handle_t  rt_info
 

Insert source-only dependency.

Definition at line 79 of file Event_Utilities.i.

References ACE_ES_EVENT_ANY, RtecEventChannelAdmin::Dependency::event, event_initializer_, RtecEventComm::EventSourceID, RtecBase::handle_t, RtecEventComm::Event::header, insert(), and RtecEventChannelAdmin::Dependency::rt_info.

00081 {
00082   RtecEventChannelAdmin::Dependency dependency;
00083   if (this->event_initializer_ != 0)
00084     (*this->event_initializer_) (dependency.event);
00085   dependency.event.header.source = source;
00086   dependency.event.header.type = ACE_ES_EVENT_ANY;
00087   //dependency.event.header.creation_time = 0;
00088   //dependency.event.header.ec_recv_time = 0;
00089   //dependency.event.header.ec_send_time = 0;
00090   dependency.rt_info = rt_info;
00091   return this->insert (dependency);
00092 }

ACE_INLINE int ACE_ConsumerQOS_Factory::insert_time RtecEventComm::EventType  type,
RtecEventComm::Time  interval,
RtecBase::handle_t  rt_info
 

Register temporal dependency. type designates interval or deadline timeout that will occur every interval.

Definition at line 95 of file Event_Utilities.i.

References ACE_ES_EVENT_SOURCE_ANY, RtecEventChannelAdmin::Dependency::event, event_initializer_, RtecBase::handle_t, RtecEventComm::Event::header, insert(), RtecEventChannelAdmin::Dependency::rt_info, and RtecEventComm::Time.

00098 {
00099   RtecEventChannelAdmin::Dependency dependency;
00100   if (this->event_initializer_ != 0)
00101     (*this->event_initializer_) (dependency.event);
00102   dependency.event.header.source = ACE_ES_EVENT_SOURCE_ANY;
00103   dependency.event.header.type = type;
00104   dependency.event.header.creation_time = interval;
00105   //dependency.event.header.ec_recv_time = 0;
00106   //dependency.event.header.ec_send_time = 0;
00107   dependency.rt_info = rt_info;
00108   return this->insert (dependency);
00109 }

ACE_INLINE int ACE_ConsumerQOS_Factory::insert_type RtecEventComm::EventType  type,
RtecBase::handle_t  rt_info
 

Insert type-only dependency.

Definition at line 63 of file Event_Utilities.i.

References ACE_ES_EVENT_SOURCE_ANY, RtecEventChannelAdmin::Dependency::event, event_initializer_, RtecBase::handle_t, RtecEventComm::Event::header, insert(), and RtecEventChannelAdmin::Dependency::rt_info.

00065 {
00066   RtecEventChannelAdmin::Dependency dependency;
00067   if (this->event_initializer_ != 0)
00068     (*this->event_initializer_) (dependency.event);
00069   dependency.event.header.source = ACE_ES_EVENT_SOURCE_ANY;
00070   dependency.event.header.type = type;
00071   //dependency.event.header.creation_time = 0;
00072   //dependency.event.header.ec_recv_time = 0;
00073   //dependency.event.header.ec_send_time = 0;
00074   dependency.rt_info = rt_info;
00075   return this->insert (dependency);
00076 }

ACE_INLINE ACE_ConsumerQOS_Factory::operator const RtecEventChannelAdmin::ConsumerQOS & void   ) 
 

Calls this->get_ConsumerQOS.

Definition at line 133 of file Event_Utilities.i.

00134 {
00135   return qos_;
00136 }

int ACE_ConsumerQOS_Factory::start_bitmask CORBA::ULong  source_mask,
CORBA::ULong  type_mask
 

Insert a bitmask filter, this acts as a quick rejection mechanism for the subsequent filters.

Definition at line 86 of file Event_Utilities.cpp.

References ACE_ES_BITMASK_DESIGNATOR, RtecEventChannelAdmin::ConsumerQOS::dependencies, designator_set_, and event_initializer_.

00088 {
00089   int l = qos_.dependencies.length ();
00090   qos_.dependencies.length (l + 2);
00091   if (this->event_initializer_ != 0)
00092     {
00093       (*this->event_initializer_) (qos_.dependencies[l].event);
00094       (*this->event_initializer_) (qos_.dependencies[l + 1].event);
00095     }
00096   qos_.dependencies[l].event.header.type = ACE_ES_BITMASK_DESIGNATOR;
00097   qos_.dependencies[l].rt_info = 0;
00098 
00099   qos_.dependencies[l+1].event.header.source = source_mask;
00100   qos_.dependencies[l+1].event.header.type = type_mask;
00101   qos_.dependencies[l+1].rt_info = 0;
00102 
00103   this->designator_set_ = 1;
00104   return 0;
00105 }

int ACE_ConsumerQOS_Factory::start_conjunction_group int  nchildren = 0  ) 
 

The Event Channel waits until all the children have accepted at least one event, and then send them all as a single event to the consumer.

Definition at line 31 of file Event_Utilities.cpp.

References ACE_ES_CONJUNCTION_DESIGNATOR, RtecEventChannelAdmin::ConsumerQOS::dependencies, designator_set_, and event_initializer_.

00032 {
00033   int l = qos_.dependencies.length ();
00034   qos_.dependencies.length (l + 1);
00035   if (this->event_initializer_ != 0)
00036     (*this->event_initializer_) (qos_.dependencies[l].event);
00037   qos_.dependencies[l].event.header.type = ACE_ES_CONJUNCTION_DESIGNATOR;
00038   qos_.dependencies[l].event.header.source = nchildren;
00039   qos_.dependencies[l].rt_info = 0;
00040   this->designator_set_ = 1;
00041   return 0;
00042 }

int ACE_ConsumerQOS_Factory::start_disjunction_group int  nchildren = 0  ) 
 

The consumer accepts any event that is accepted by at least one child.

Definition at line 45 of file Event_Utilities.cpp.

References ACE_ES_DISJUNCTION_DESIGNATOR, RtecEventChannelAdmin::ConsumerQOS::dependencies, designator_set_, and event_initializer_.

Referenced by TAO_ECG_Mcast_Gateway::init_sender().

00046 {
00047   int l = qos_.dependencies.length ();
00048   qos_.dependencies.length (l + 1);
00049   if (this->event_initializer_ != 0)
00050     (*this->event_initializer_) (qos_.dependencies[l].event);
00051   qos_.dependencies[l].event.header.type = ACE_ES_DISJUNCTION_DESIGNATOR;
00052   qos_.dependencies[l].event.header.source = nchildren;
00053   qos_.dependencies[l].rt_info = 0;
00054   this->designator_set_ = 1;
00055   return 0;
00056 }

int ACE_ConsumerQOS_Factory::start_logical_and_group int  nchildren = 0  ) 
 

The consumer only accepts events that pass all the filter expressions defined by the children.

Definition at line 59 of file Event_Utilities.cpp.

References ACE_ES_LOGICAL_AND_DESIGNATOR, RtecEventChannelAdmin::ConsumerQOS::dependencies, designator_set_, and event_initializer_.

00060 {
00061   int l = qos_.dependencies.length ();
00062   qos_.dependencies.length (l + 1);
00063   if (this->event_initializer_ != 0)
00064     (*this->event_initializer_) (qos_.dependencies[l].event);
00065   qos_.dependencies[l].event.header.type = ACE_ES_LOGICAL_AND_DESIGNATOR;
00066   qos_.dependencies[l].event.header.source = nchildren;
00067   qos_.dependencies[l].rt_info = 0;
00068   this->designator_set_ = 1;
00069   return 0;
00070 }

int ACE_ConsumerQOS_Factory::start_negation void   ) 
 

The consumer wants all the events *except* the group that follows.

Definition at line 73 of file Event_Utilities.cpp.

References ACE_ES_NEGATION_DESIGNATOR, RtecEventChannelAdmin::ConsumerQOS::dependencies, designator_set_, and event_initializer_.

00074 {
00075   int l = qos_.dependencies.length ();
00076   qos_.dependencies.length (l + 1);
00077   if (this->event_initializer_ != 0)
00078     (*this->event_initializer_) (qos_.dependencies[l].event);
00079   qos_.dependencies[l].event.header.type = ACE_ES_NEGATION_DESIGNATOR;
00080   qos_.dependencies[l].rt_info = 0;
00081   this->designator_set_ = 1;
00082   return 0;
00083 }


Member Data Documentation

int ACE_ConsumerQOS_Factory::designator_set_ [private]
 

Whether a start_XX_group has been called yet. This is to make sure that a designator is placed in the subscription list first.

Definition at line 196 of file Event_Utilities.h.

Referenced by insert(), start_bitmask(), start_conjunction_group(), start_disjunction_group(), start_logical_and_group(), and start_negation().

TAO_EC_Event_Initializer ACE_ConsumerQOS_Factory::event_initializer_ [private]
 

If not zero this is a user-provided function used to initialize the events. When the event contains unions this is required to avoid marshaling and demarshaling of default initialized unions that (AFAIK) is not CORBA compliant.

Definition at line 204 of file Event_Utilities.h.

Referenced by insert(), insert_act(), insert_bitmasked_value(), insert_null_terminator(), insert_source(), insert_time(), insert_type(), start_bitmask(), start_conjunction_group(), start_disjunction_group(), start_logical_and_group(), and start_negation().

RtecEventChannelAdmin::ConsumerQOS ACE_ConsumerQOS_Factory::qos_ [private]
 

The representation to be sent to the channel.

Definition at line 192 of file Event_Utilities.h.


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 13:14:16 2006 for TAO_RTEvent by doxygen 1.3.6