Go to the documentation of this file.00001
00002
00003 #include "orbsvcs/Notify/Any/AnyEvent.h"
00004
00005 ACE_RCSID (Notify, TAO_Notify_AnyEvent, "$Id: AnyEvent.cpp 84563 2009-02-23 08:13:54Z johnnyw $")
00006
00007 #include "orbsvcs/Notify/Consumer.h"
00008
00009 #include "tao/corba.h"
00010 #include "tao/debug.h"
00011
00012
00013 #ifndef DEBUG_LEVEL
00014 # define DEBUG_LEVEL TAO_debug_level
00015 #endif //DEBUG_LEVEL
00016
00017 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00018
00019 TAO_Notify_EventType TAO_Notify_AnyEvent_No_Copy::event_type_;
00020
00021 TAO_Notify_AnyEvent_No_Copy::TAO_Notify_AnyEvent_No_Copy (const CORBA::Any &event)
00022 : event_ (&event)
00023 {
00024 }
00025
00026 TAO_Notify_AnyEvent_No_Copy::~TAO_Notify_AnyEvent_No_Copy ()
00027 {
00028 }
00029
00030 const TAO_Notify_EventType&
00031 TAO_Notify_AnyEvent_No_Copy::type (void) const
00032 {
00033 return this->event_type_;
00034 }
00035
00036 void
00037 TAO_Notify_AnyEvent_No_Copy::convert (CosNotification::StructuredEvent& notification) const
00038 {
00039 TAO_Notify_Event::translate (*this->event_, notification);
00040 }
00041
00042 CORBA::Boolean
00043 TAO_Notify_AnyEvent_No_Copy::do_match (CosNotifyFilter::Filter_ptr filter) const
00044 {
00045 if (DEBUG_LEVEL > 0)
00046 ACE_DEBUG ((LM_DEBUG, "Notify (%P|%t) - "
00047 "TAO_Notify_AnyEvent::do_match ()\n"));
00048
00049 return filter->match(*this->event_);
00050 }
00051
00052 void
00053 TAO_Notify_AnyEvent_No_Copy::push (TAO_Notify_Consumer* consumer) const
00054 {
00055 if (DEBUG_LEVEL > 0)
00056 ACE_DEBUG ((LM_DEBUG, "Notify (%P|%t) - "
00057 "TAO_Notify_AnyEvent::push\n"));
00058
00059 consumer->push (*this->event_);
00060 }
00061
00062 void
00063 TAO_Notify_AnyEvent_No_Copy::push (Event_Forwarder::StructuredProxyPushSupplier_ptr forwarder) const
00064 {
00065 CosNotification::StructuredEvent notification;
00066
00067 TAO_Notify_Event::translate (*this->event_, notification);
00068
00069 forwarder->forward_structured (notification);
00070 }
00071
00072 void
00073 TAO_Notify_AnyEvent_No_Copy::push_no_filtering (Event_Forwarder::StructuredProxyPushSupplier_ptr forwarder) const
00074 {
00075 CosNotification::StructuredEvent notification;
00076
00077 TAO_Notify_Event::translate (*this->event_, notification);
00078
00079 forwarder->forward_structured_no_filtering (notification);
00080 }
00081
00082 void
00083 TAO_Notify_AnyEvent_No_Copy::push (Event_Forwarder::ProxyPushSupplier_ptr forwarder) const
00084 {
00085 forwarder->forward_any (*this->event_);
00086 }
00087
00088 void
00089 TAO_Notify_AnyEvent_No_Copy::push_no_filtering (Event_Forwarder::ProxyPushSupplier_ptr forwarder) const
00090 {
00091 forwarder->forward_any_no_filtering (*this->event_);
00092 }
00093
00094 void
00095 TAO_Notify_AnyEvent_No_Copy::marshal (TAO_OutputCDR & cdr) const
00096 {
00097 const ACE_CDR::Octet ANY_CODE = MARSHAL_ANY;
00098 cdr.write_octet (ANY_CODE);
00099 cdr << (*this->event_);
00100 }
00101
00102
00103 TAO_Notify_AnyEvent *
00104 TAO_Notify_AnyEvent_No_Copy::unmarshal (TAO_InputCDR & cdr)
00105 {
00106 TAO_Notify_AnyEvent * event = 0;
00107 CORBA::Any body;
00108 if (cdr >> body)
00109 {
00110 event = new TAO_Notify_AnyEvent (body);
00111 }
00112 return event;
00113 }
00114
00115 TAO_Notify_Event *
00116 TAO_Notify_AnyEvent_No_Copy::copy (void) const
00117 {
00118 TAO_Notify_Event * new_event;
00119 ACE_NEW_THROW_EX (new_event,
00120 TAO_Notify_AnyEvent (*this->event_),
00121 CORBA::NO_MEMORY ());
00122 return new_event;
00123 }
00124
00125
00126
00127
00128 TAO_Notify_AnyEvent::TAO_Notify_AnyEvent (const CORBA::Any &event)
00129 : TAO_Notify_AnyEvent_No_Copy (event)
00130 , any_copy_ (event)
00131 {
00132 this->event_ = &any_copy_;
00133 }
00134
00135 TAO_Notify_AnyEvent::~TAO_Notify_AnyEvent ()
00136 {
00137 }
00138
00139 TAO_END_VERSIONED_NAMESPACE_DECL