00001
00002
00003 #include "orbsvcs/Notify/Event.h"
00004
00005 #if ! defined (__ACE_INLINE__)
00006 #include "orbsvcs/Notify/Event.inl"
00007 #endif
00008
00009 ACE_RCSID (Notify,
00010 TAO_Notify_Event,
00011 "Event.cpp,v 1.15 2006/03/15 21:29:09 jtc Exp")
00012
00013 #include "tao/debug.h"
00014 #include "tao/CDR.h"
00015 #include "orbsvcs/CosNotificationC.h"
00016
00017 #include "orbsvcs/Notify/Any/AnyEvent.h"
00018 #include "orbsvcs/Notify/Structured/StructuredEvent.h"
00019
00020 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00021
00022 TAO_Notify_Event::TAO_Notify_Event (void)
00023 : priority_ (CosNotification::Priority, CosNotification::DefaultPriority)
00024 , timeout_ (CosNotification::Timeout)
00025 , reliable_ (CosNotification::EventReliability, false)
00026 , clone_ (0)
00027 , is_on_heap_ (false)
00028 {
00029
00030
00031 }
00032
00033 TAO_Notify_Event::~TAO_Notify_Event ()
00034 {
00035
00036
00037 }
00038 void
00039 TAO_Notify_Event::release (void)
00040 {
00041 delete this;
00042 }
00043
00044 void
00045 TAO_Notify_Event::translate (const CORBA::Any& any, CosNotification::StructuredEvent& notification)
00046 {
00047 notification.remainder_of_body <<= any;
00048 notification.header.fixed_header.event_type.type_name = CORBA::string_dup ("%ANY");
00049 notification.header.fixed_header.event_type.domain_name = CORBA::string_dup ("");
00050 }
00051
00052 void
00053 TAO_Notify_Event::translate (const CosNotification::StructuredEvent& notification, CORBA::Any& any)
00054 {
00055 any <<= notification;
00056 }
00057
00058
00059 TAO_Notify_Event *
00060 TAO_Notify_Event::unmarshal (TAO_InputCDR & cdr)
00061 {
00062 TAO_Notify_Event * result = 0;
00063 ACE_CDR::Octet code = 0;
00064 if (cdr.read_octet (code))
00065 {
00066 switch (code)
00067 {
00068 case MARSHAL_ANY:
00069 result = TAO_Notify_AnyEvent::unmarshal (cdr);
00070 break;
00071 case MARSHAL_STRUCTURED:
00072 result = TAO_Notify_StructuredEvent::unmarshal (cdr);
00073 break;
00074 default:
00075 ACE_ERROR ((LM_ERROR,
00076 ACE_TEXT ("(%P|%t) TAO_Notify_Event::unmarshal: unknown event code %d\n"),
00077 code));
00078 break;
00079 }
00080 }
00081 return result;
00082 }
00083
00084 TAO_END_VERSIONED_NAMESPACE_DECL