00001 /* -*- C++ -*- */ 00002 /** 00003 * @file AnyEvent.h 00004 * 00005 * AnyEvent.h,v 1.15 2006/03/15 21:29:09 jtc Exp 00006 * 00007 * @author Pradeep Gore <pradeep@oomworks.com> 00008 * 00009 * 00010 */ 00011 00012 #ifndef TAO_Notify_ANYEVENT_H 00013 #define TAO_Notify_ANYEVENT_H 00014 00015 #include /**/ "ace/pre.h" 00016 00017 #include "orbsvcs/Notify/notify_serv_export.h" 00018 00019 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00020 # pragma once 00021 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00022 00023 #include "orbsvcs/Notify/Event.h" 00024 #include "orbsvcs/Notify/EventType.h" 00025 00026 #include "orbsvcs/CosNotificationC.h" 00027 00028 00029 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00030 00031 class TAO_Notify_Consumer; 00032 class TAO_Notify_AnyEvent; 00033 /** 00034 * @class TAO_Notify_AnyEvent 00035 * 00036 * @brief 00037 * 00038 */ 00039 class TAO_Notify_Serv_Export TAO_Notify_AnyEvent_No_Copy : public TAO_Notify_Event 00040 { 00041 friend class TAO_Notify_Builder; 00042 public: 00043 /// Constuctor 00044 TAO_Notify_AnyEvent_No_Copy (const CORBA::Any &event); 00045 00046 /// Destructor 00047 virtual ~TAO_Notify_AnyEvent_No_Copy (); 00048 00049 /// Get the event type. 00050 virtual const TAO_Notify_EventType& type (void) const; 00051 00052 CORBA::Boolean do_match (CosNotifyFilter::Filter_ptr filter ACE_ENV_ARG_DECL) const; 00053 00054 /// Convert to CosNotification::Structured type 00055 virtual void convert (CosNotification::StructuredEvent& notification) const; 00056 00057 /// Push event to consumer 00058 virtual void push (TAO_Notify_Consumer* consumer ACE_ENV_ARG_DECL) const; 00059 00060 /// Push event to the Event_Forwarder interface 00061 virtual void push (Event_Forwarder::StructuredProxyPushSupplier_ptr forwarder ACE_ENV_ARG_DECL) const; 00062 00063 /// Push event to the Event_Forwarder interface 00064 virtual void push_no_filtering (Event_Forwarder::StructuredProxyPushSupplier_ptr forwarder ACE_ENV_ARG_DECL) const; 00065 00066 /// Push event to the Event_Forwarder interface 00067 virtual void push (Event_Forwarder::ProxyPushSupplier_ptr forwarder ACE_ENV_ARG_DECL) const; 00068 00069 /// Push event to the Event_Forwarder interface 00070 virtual void push_no_filtering (Event_Forwarder::ProxyPushSupplier_ptr forwarder ACE_ENV_ARG_DECL) const; 00071 00072 /// marshal this event into a CDR buffer (for persistence) 00073 virtual void marshal (TAO_OutputCDR & cdr) const; 00074 00075 /// unmarshal this event from a CDR buffer (for persistence) 00076 /// \param code a code indicating what type of event to create. 00077 /// \param cdr a CDR stream containing the marshalled data for the event. 00078 /// \return the new event, or NULL if this is the wrong type of event. 00079 static TAO_Notify_AnyEvent * unmarshal (TAO_InputCDR & cdr); 00080 00081 protected: 00082 /// returns a copy of this event allocated from the heap 00083 virtual TAO_Notify_Event * copy (ACE_ENV_SINGLE_ARG_DECL) const; 00084 00085 protected: 00086 00087 // This must be a pointer rather than a reference, because the derived 00088 // class needs to redirect it to a new copy 00089 const CORBA::Any* event_; 00090 00091 /// Our event type. 00092 static TAO_Notify_EventType event_type_; 00093 }; 00094 00095 /****************************************************************************/ 00096 00097 /** 00098 * @class TAO_Notify_AnyEvent 00099 * 00100 * @brief AnyEvent implementation. 00101 * 00102 */ 00103 class TAO_Notify_Serv_Export TAO_Notify_AnyEvent : public TAO_Notify_AnyEvent_No_Copy 00104 { 00105 public: 00106 /// Constuctor 00107 TAO_Notify_AnyEvent (const CORBA::Any &event); 00108 00109 /// Destructor 00110 virtual ~TAO_Notify_AnyEvent (); 00111 00112 protected: 00113 /// Copy of the Event. 00114 CORBA::Any any_copy_; 00115 }; 00116 00117 TAO_END_VERSIONED_NAMESPACE_DECL 00118 00119 #include /**/ "ace/post.h" 00120 00121 #endif /* TAO_Notify_ANYEVENT_H */