StructuredEvent.cpp

Go to the documentation of this file.
00001 // StructuredEvent.cpp,v 1.13 2006/03/15 21:29:10 jtc Exp
00002 
00003 #include "orbsvcs/Notify/Structured/StructuredEvent.h"
00004 
00005 ACE_RCSID(RT_Notify, TAO_Notify_StructuredEvent, "StructuredEvent.cpp,v 1.13 2006/03/15 21:29:10 jtc Exp")
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 (ACE_ENV_SINGLE_ARG_DECL) 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   ACE_CHECK_RETURN (0);
00067   return new_event;
00068 }
00069 
00070 CORBA::Boolean
00071 TAO_Notify_StructuredEvent_No_Copy::do_match (CosNotifyFilter::Filter_ptr filter ACE_ENV_ARG_DECL) const
00072 {
00073   if (TAO_debug_level > 0)
00074     ACE_DEBUG ((LM_DEBUG, "Notify (%P|%t) - "
00075                 "TAO_Notify_StructuredEvent::do_match ()\n"));
00076 
00077   return filter->match_structured (*this->notification_ ACE_ENV_ARG_PARAMETER);
00078 }
00079 
00080 void
00081 TAO_Notify_StructuredEvent_No_Copy::convert (CosNotification::StructuredEvent& notification) const
00082 {
00083   notification = *this->notification_;
00084 }
00085 
00086 void
00087 TAO_Notify_StructuredEvent_No_Copy::push (TAO_Notify_Consumer* consumer ACE_ENV_ARG_DECL) const
00088 {
00089   if (TAO_debug_level > 0)
00090     ACE_DEBUG ((LM_DEBUG, "Notify (%P|%t) - "
00091                           "TAO_Notify_StructuredEvent::do_push ("
00092                           "CosNotifyComm::StructuredPushConsumer_ptr)\n"));
00093 
00094   consumer->push (*this->notification_ ACE_ENV_ARG_PARAMETER);
00095 }
00096 
00097 void
00098 TAO_Notify_StructuredEvent_No_Copy::push (Event_Forwarder::StructuredProxyPushSupplier_ptr forwarder ACE_ENV_ARG_DECL) const
00099 {
00100   forwarder->forward_structured (*this->notification_ ACE_ENV_ARG_PARAMETER);
00101 }
00102 
00103 void
00104 TAO_Notify_StructuredEvent_No_Copy::push_no_filtering (Event_Forwarder::StructuredProxyPushSupplier_ptr forwarder ACE_ENV_ARG_DECL) const
00105 {
00106   forwarder->forward_structured_no_filtering (*this->notification_ ACE_ENV_ARG_PARAMETER);
00107 }
00108 
00109 void
00110 TAO_Notify_StructuredEvent_No_Copy::push (Event_Forwarder::ProxyPushSupplier_ptr forwarder ACE_ENV_ARG_DECL) const
00111 {
00112   CORBA::Any any;
00113 
00114   TAO_Notify_Event::translate (*this->notification_, any);
00115 
00116   forwarder->forward_any (any ACE_ENV_ARG_PARAMETER);
00117 }
00118 
00119 void
00120 TAO_Notify_StructuredEvent_No_Copy::push_no_filtering (Event_Forwarder::ProxyPushSupplier_ptr forwarder ACE_ENV_ARG_DECL) const
00121 {
00122   CORBA::Any any;
00123 
00124   TAO_Notify_Event::translate (*this->notification_, any);
00125 
00126   forwarder->forward_any_no_filtering (any ACE_ENV_ARG_PARAMETER);
00127 }
00128 
00129 /*****************************************************************************************************/
00130 
00131 TAO_Notify_StructuredEvent::TAO_Notify_StructuredEvent (const CosNotification::StructuredEvent& notification)
00132   : TAO_Notify_StructuredEvent_No_Copy (notification)
00133     , notification_copy (notification)
00134 {
00135   this->notification_ = &notification_copy;
00136 }
00137 
00138 TAO_Notify_StructuredEvent::~TAO_Notify_StructuredEvent ()
00139 {
00140 }
00141 
00142 TAO_END_VERSIONED_NAMESPACE_DECL

Generated on Thu Nov 9 13:24:17 2006 for TAO_CosNotification by doxygen 1.3.6