StructuredEvent.cpp

Go to the documentation of this file.
00001 // $Id: StructuredEvent.cpp 76589 2007-01-25 18:04:11Z elliott_c $
00002 
00003 #include "orbsvcs/Notify/Structured/StructuredEvent.h"
00004 
00005 ACE_RCSID(RT_Notify, TAO_Notify_StructuredEvent, "$Id: StructuredEvent.cpp 76589 2007-01-25 18:04:11Z elliott_c $")
00006 
00007 #include "orbsvcs/Notify/PropertySeq.h"
00008 #include "orbsvcs/Notify/Consumer.h"
00009 #include "tao/debug.h"
00010 #include "tao/corba.h"
00011 
00012 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00013 
00014 TAO_Notify_StructuredEvent_No_Copy::TAO_Notify_StructuredEvent_No_Copy (const CosNotification::StructuredEvent &notification)
00015   : notification_ (&notification), type_ (notification.header.fixed_header.event_type)
00016 {
00017   const CosNotification::PropertySeq& prop_seq = notification.header.variable_header;
00018 
00019   for (CORBA::ULong i = 0; i < prop_seq.length (); ++i)
00020     {
00021       if (ACE_OS::strcmp (prop_seq[i].name.in (), CosNotification::Priority) == 0)
00022         this->priority_.set (prop_seq[i].value);
00023       else if (ACE_OS::strcmp (prop_seq[i].name.in (), CosNotification::Timeout) == 0)
00024         this->timeout_.set (prop_seq[i].value);
00025     }
00026 }
00027 
00028 const TAO_Notify_EventType&
00029 TAO_Notify_StructuredEvent_No_Copy::type (void) const
00030 {
00031   return this->type_;
00032 }
00033 
00034 TAO_Notify_StructuredEvent_No_Copy::~TAO_Notify_StructuredEvent_No_Copy ()
00035 {
00036 }
00037 
00038 void
00039 TAO_Notify_StructuredEvent_No_Copy::marshal (TAO_OutputCDR & cdr) const
00040 {
00041   static const ACE_CDR::Octet STRUCTURED_CODE = MARSHAL_STRUCTURED;
00042   cdr.write_octet (STRUCTURED_CODE);
00043   cdr << (*this->notification_);
00044 }
00045 
00046 //static
00047 TAO_Notify_StructuredEvent *
00048 TAO_Notify_StructuredEvent_No_Copy::unmarshal (TAO_InputCDR & cdr)
00049 {
00050   TAO_Notify_StructuredEvent * event = 0;
00051   CosNotification::StructuredEvent body;
00052   if (cdr >> body)
00053   {
00054     event = new TAO_Notify_StructuredEvent (body);
00055   }
00056   return event;
00057 }
00058 
00059 TAO_Notify_Event *
00060 TAO_Notify_StructuredEvent_No_Copy::copy (void) const
00061 {
00062   TAO_Notify_Event * new_event;
00063   ACE_NEW_THROW_EX (new_event,
00064                     TAO_Notify_StructuredEvent (*this->notification_),
00065                     CORBA::NO_MEMORY ());
00066   return new_event;
00067 }
00068 
00069 CORBA::Boolean
00070 TAO_Notify_StructuredEvent_No_Copy::do_match (CosNotifyFilter::Filter_ptr filter) const
00071 {
00072   if (TAO_debug_level > 0)
00073     ACE_DEBUG ((LM_DEBUG, "Notify (%P|%t) - "
00074                 "TAO_Notify_StructuredEvent::do_match ()\n"));
00075 
00076   return filter->match_structured (*this->notification_);
00077 }
00078 
00079 void
00080 TAO_Notify_StructuredEvent_No_Copy::convert (CosNotification::StructuredEvent& notification) const
00081 {
00082   notification = *this->notification_;
00083 }
00084 
00085 void
00086 TAO_Notify_StructuredEvent_No_Copy::push (TAO_Notify_Consumer* consumer) const
00087 {
00088   if (TAO_debug_level > 0)
00089     ACE_DEBUG ((LM_DEBUG, "Notify (%P|%t) - "
00090                           "TAO_Notify_StructuredEvent::do_push ("
00091                           "CosNotifyComm::StructuredPushConsumer_ptr)\n"));
00092 
00093   consumer->push (*this->notification_);
00094 }
00095 
00096 void
00097 TAO_Notify_StructuredEvent_No_Copy::push (Event_Forwarder::StructuredProxyPushSupplier_ptr forwarder) const
00098 {
00099   forwarder->forward_structured (*this->notification_);
00100 }
00101 
00102 void
00103 TAO_Notify_StructuredEvent_No_Copy::push_no_filtering (Event_Forwarder::StructuredProxyPushSupplier_ptr forwarder) const
00104 {
00105   forwarder->forward_structured_no_filtering (*this->notification_);
00106 }
00107 
00108 void
00109 TAO_Notify_StructuredEvent_No_Copy::push (Event_Forwarder::ProxyPushSupplier_ptr forwarder) const
00110 {
00111   CORBA::Any any;
00112 
00113   TAO_Notify_Event::translate (*this->notification_, any);
00114 
00115   forwarder->forward_any (any);
00116 }
00117 
00118 void
00119 TAO_Notify_StructuredEvent_No_Copy::push_no_filtering (Event_Forwarder::ProxyPushSupplier_ptr forwarder) const
00120 {
00121   CORBA::Any any;
00122 
00123   TAO_Notify_Event::translate (*this->notification_, any);
00124 
00125   forwarder->forward_any_no_filtering (any);
00126 }
00127 
00128 /*****************************************************************************************************/
00129 
00130 TAO_Notify_StructuredEvent::TAO_Notify_StructuredEvent (const CosNotification::StructuredEvent& notification)
00131   : TAO_Notify_StructuredEvent_No_Copy (notification)
00132     , notification_copy (notification)
00133 {
00134   this->notification_ = &notification_copy;
00135 }
00136 
00137 TAO_Notify_StructuredEvent::~TAO_Notify_StructuredEvent ()
00138 {
00139 }
00140 
00141 TAO_END_VERSIONED_NAMESPACE_DECL

Generated on Tue Feb 2 17:45:29 2010 for TAO_CosNotification by  doxygen 1.4.7