diff options
Diffstat (limited to 'apps/Orbix-Examples/Event_Comm/libsrc')
13 files changed, 0 insertions, 2273 deletions
diff --git a/apps/Orbix-Examples/Event_Comm/libsrc/Event_Comm.hh b/apps/Orbix-Examples/Event_Comm/libsrc/Event_Comm.hh deleted file mode 100644 index 85ad256da2a..00000000000 --- a/apps/Orbix-Examples/Event_Comm/libsrc/Event_Comm.hh +++ /dev/null @@ -1,887 +0,0 @@ - -#ifndef Event_Comm_hh -#define Event_Comm_hh - -#include <CORBA.h> - -#include <string.h> - -class Event_Comm { -public: - -#ifndef Event_Comm_Notification_defined -#define Event_Comm_Notification_defined - - struct Notification { - CORBA::String_mgr tag_; - - void encodeOp (CORBA::Request &IT_r) const; - void decodeOp (CORBA::Request &IT_r); - void decodeInOutOp (CORBA::Request &IT_r); - static void* IT_anySupport (CORBA::Request &IT_r, - void *&, void*, const CORBA::Flags&); - static const void *IT_fn; - }; - - static const CORBA::TypeCode_ptr _tc_Notification; - -#ifndef Event_Comm_NotificationVarH -#define Event_Comm_NotificationVarH - -#ifndef Event_Comm_NotificationvPtr -#define Event_Comm_NotificationvPtr -typedef Notification* Notification_vPtr; -#endif - -class Notification_var : public CORBA::_var -{ - public: - - Notification_var () { - _ptr = NULL; - } - - Notification_var (Notification *IT_p) { - _ptr = IT_p; - } - - Notification_var (const Notification_var &IT_s) { - if (!IT_s._ptr) { - _ptr = IT_s._ptr; - return; - } - _ptr = new Notification (*(IT_s._ptr)); - } - - Notification_var &operator= (Notification *IT_p) { - if (_ptr != IT_p) { - delete _ptr; - } - _ptr = IT_p; - return (*this); - } - - Notification_var &operator= (const Notification_var &IT_s) { - if (_ptr != IT_s._ptr) { - delete _ptr; - } - _ptr = new Notification (*(IT_s._ptr)); - return (*this); - } - - ~Notification_var () { - delete _ptr; - } - - Notification* operator-> () { - return _ptr; - } - - operator const Notification_vPtr () const { return _ptr;} - operator Notification_vPtr& () { return _ptr;} - operator Notification& () const { return * _ptr;} - - protected: - Notification *_ptr; - private: - Notification_var &operator= (const CORBA::_var &IT_s); - Notification_var (const CORBA::_var &IT_s); -}; - -#endif - - -#endif - - -#ifndef _Event_Comm_Notification_Receiver_defined -#define _Event_Comm_Notification_Receiver_defined -class Notification_Receiver_dispatch : public virtual CORBA::PPTR { -public: - - Notification_Receiver_dispatch (void *IT_p, CORBA::Object* IT_o, const char *IT_m, - CORBA::LoaderClass *IT_l, char *IT_i, void* IT_im) - : CORBA::PPTR (IT_p,IT_o,IT_m,IT_l,IT_i,IT_im) {} - - - Notification_Receiver_dispatch (char *IT_OR, void *IT_p, CORBA::Object *IT_o) - : CORBA::PPTR (IT_OR,IT_p,IT_o) {} - - - Notification_Receiver_dispatch () {} - - Notification_Receiver_dispatch (ObjectReference *IT_OR, void *IT_p, CORBA::Object *IT_o) - : CORBA::PPTR (IT_OR,IT_p,IT_o) {} - - - Notification_Receiver_dispatch (void *IT_p, CORBA::Object *IT_o, const char *IT_m, - char *IT_i, CORBA::Object* IT_ob, void* IT_im) - : CORBA::PPTR (IT_p,IT_o,IT_m,IT_i,IT_ob,IT_im) {} - - - virtual unsigned char dispatch (CORBA::Request &IT_r, - unsigned char IT_isTarget, void* IT_pp=NULL); - - -}; - -class Notification_Receiver; - -#ifndef Event_Comm_Notification_ReceiverPtr -#define Event_Comm_Notification_ReceiverPtr - - typedef Notification_Receiver* Notification_Receiver_ptr; - - typedef Notification_Receiver* Notification_ReceiverRef; - -#endif - - -#ifndef Event_Comm_Notification_ReceiverForwH -#define Event_Comm_Notification_ReceiverForwH -static CORBA::ObjectRef Notification_Receiver_getBase (void *); -static void Notification_Receiver_release (Notification_Receiver *, CORBA::Environment &IT_env); -static void Notification_Receiver_release (Notification_Receiver_ptr); -static Notification_Receiver* Notification_Receiver_duplicate (Notification_Receiver_ptr, CORBA::Environment &IT_env); -static Notification_Receiver* Notification_Receiver_duplicate (Notification_Receiver_ptr ); -static Notification_Receiver_ptr Notification_Receiver_nil (CORBA::Environment &IT_env); -static Notification_Receiver_ptr Notification_Receiver_nil (); -#endif -#define Event_Comm_Notification_Receiver_IMPL "Event_Comm_Notification_Receiver" - - -class Notification_Receiver; - - typedef Notification_Receiver Notification_ReceiverProxy; -#define Event_Comm_Notification_Receiver_IR "Event_Comm_Notification_Receiver" -#define Event_Comm_Notification_Receiver_IMPL "Event_Comm_Notification_Receiver" - -#ifndef Event_Comm_Notification_ReceiverPtr -#define Event_Comm_Notification_ReceiverPtr - - typedef Notification_Receiver* Notification_Receiver_ptr; - - typedef Notification_Receiver* Notification_ReceiverRef; - -#endif - -class Notification_Receiver: public virtual CORBA::Object { -public: - Notification_Receiver (char *IT_OR); - Notification_Receiver (ObjectReference *IT_OR); - Notification_Receiver () : CORBA::Object (1) {} -protected: - Notification_Receiver_ptr __duplicate( - CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) { - CORBA::Object::__duplicate (IT_env); - return this; - } -public: - static Notification_Receiver_ptr _duplicate( - Notification_Receiver_ptr obj, - CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) { - CORBA::EnvExcRaiser IT_raise (&IT_env); - if (CORBA::is_nil(obj, IT_env)) { - IT_raise.maybeRaise (); - return (obj); - } - Notification_Receiver_ptr IT_obj = obj->__duplicate (IT_env); - IT_raise.maybeRaise(); - return IT_obj; - } -public: - static Notification_Receiver* _bind (const char* IT_markerServer, const char* host, - const CORBA::Context &IT_c, - CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()); - static Notification_Receiver* _bind (CORBA::Environment &IT_env); - static Notification_Receiver* _bind (const char* IT_markerServer=NULL, const char* host=NULL, - CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()); - static Notification_Receiver* _narrow (CORBA::Object* , CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()); - static Notification_Receiver_ptr _nil (CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) { - CORBA::EnvExcRaiser IT_raise (&IT_env); - IT_raise.maybeRaise(); - return (Notification_Receiver_ptr) CORBA::OBJECT_NIL;} - virtual void receive_notification (const Event_Comm::Notification& notification, CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) throw (CORBA::SystemException); - virtual void disconnect (const char * reason, CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) throw (CORBA::SystemException); -}; - - static const CORBA::TypeCode_ptr _tc_Notification_Receiver; - - static const CORBA::TypeCode_ptr _tc_Notification_ReceiverRef; - -#ifndef Event_Comm_Notification_ReceiverVarH -#define Event_Comm_Notification_ReceiverVarH - -#ifndef Event_Comm_Notification_ReceivervPtr -#define Event_Comm_Notification_ReceivervPtr -typedef Notification_Receiver* Notification_Receiver_vPtr; -#endif - -class Notification_Receiver_var : public CORBA::_var -{ - public: - - Notification_Receiver_var () { - _ptr = Notification_Receiver_nil (); - } - - Notification_Receiver_var (Notification_Receiver *IT_p) { - _ptr = IT_p; - } - - Notification_Receiver_var (const Notification_Receiver_var &IT_s) { - _ptr = Notification_Receiver_duplicate (IT_s._ptr); - } - - Notification_Receiver_var &operator= (Notification_Receiver *IT_p) { - Notification_Receiver_release (_ptr); - _ptr = IT_p; - return (*this); - } - - Notification_Receiver_var &operator= (const Notification_Receiver_var &IT_s) { - Notification_Receiver_release (_ptr); - _ptr = Notification_Receiver_duplicate (IT_s._ptr); - return (*this); - } - - ~Notification_Receiver_var () { - Notification_Receiver_release (_ptr); - } - - Notification_Receiver* operator-> () { - return _ptr; - } - - operator const Notification_Receiver_vPtr () const { return _ptr;} - operator Notification_Receiver_vPtr& () { return _ptr;} - - protected: - Notification_Receiver *_ptr; - private: - Notification_Receiver_var &operator= (const CORBA::_var &IT_s); - Notification_Receiver_var (const CORBA::_var &IT_s); - Notification_Receiver_var &operator= (const CORBA::_mgr &IT_s); - Notification_Receiver_var &operator= (const CORBA::_SeqElem &IT_s); - Notification_Receiver_var (const CORBA::_mgr &IT_s); - Notification_Receiver_var (const CORBA::_SeqElem &IT_s); -}; - -#endif - - -#ifndef Event_Comm_Notification_ReceiverMgrH -#define Event_Comm_Notification_ReceiverMgrH - -class Notification_Receiver_mgr : public CORBA::_mgr -{ - public: - - Notification_Receiver_mgr () { - _ptr = Notification_Receiver_nil (); - _release = 1; - } - - Notification_Receiver_mgr (const Notification_Receiver_mgr &IT_s) { - _ptr = Notification_Receiver_duplicate (IT_s._ptr); - _release = 1; - } - - Notification_Receiver_mgr &operator= (Notification_Receiver *IT_p) { - if (_ptr && _release) - Notification_Receiver_release (_ptr); - _ptr = IT_p; - _release = 1; - return (*this); - } - - Notification_Receiver_mgr &operator= (const Notification_Receiver_mgr &IT_s) { - if (_ptr && _release) - Notification_Receiver_release (_ptr); - _ptr = Notification_Receiver_duplicate(IT_s._ptr); - _release = 1; - return (*this); - } - - Notification_Receiver_mgr &operator= (const Notification_Receiver_var &IT_s) { - if (_ptr && _release) - Notification_Receiver_release (_ptr); - _ptr = Notification_Receiver_duplicate(IT_s); - _release = 1; - return (*this); - } - - ~Notification_Receiver_mgr () { - if (_release) - Notification_Receiver_release (_ptr); - } - - unsigned char release () { - return _release; - } - - void release (unsigned char rel) { - _release = rel; - } - - operator int () const { - CORBA::Environment env; - CORBA::EnvExcRaiser IT_raise (&env); - return (!(CORBA::is_nil((CORBA::Object*) _ptr, env))); - } - - operator void* () const { - return _ptr; - } - - operator CORBA::Object * () const { - return (CORBA::Object *) _ptr; - } - - operator Notification_Receiver* () const { - return (Notification_Receiver*) _ptr; - } - - Notification_Receiver *_ptr; - - protected: - - unsigned char _release; -}; - -#endif - -#ifndef Event_Comm_Notification_ReceiverSeqElemH -#define Event_Comm_Notification_ReceiverSeqElemH - -class Notification_Receiver_SeqElem : public CORBA::_SeqElem -{ - public: - - Notification_Receiver_SeqElem (Event_Comm::Notification_Receiver_ptr* IT_p, unsigned char rel) { - _ptr = IT_p; - _release = rel; - } - - Notification_Receiver_SeqElem &operator= (Event_Comm::Notification_Receiver_ptr IT_p) { - if (!_ptr) - return (*this); - if (*(_ptr) && _release) - Notification_Receiver_release (*(_ptr)); - *(_ptr) = IT_p; - return (*this); - } - - Notification_Receiver_SeqElem &operator= (const Notification_Receiver_SeqElem &IT_s) { - if (!_ptr|| !IT_s._ptr) - return (*this); - if (*(_ptr) && _release) - Notification_Receiver_release (*(_ptr)); - *(_ptr) = Notification_Receiver_duplicate(*(IT_s._ptr)); - return (*this); - } - - operator Event_Comm::Notification_Receiver_ptr () const -{ - if (!_ptr) - return (Notification_Receiver_nil()); - return (Event_Comm::Notification_Receiver_ptr) (*_ptr); - } - - Notification_Receiver_ptr operator->() const { return *_ptr;} - - protected: - Event_Comm::Notification_Receiver_ptr *_ptr; - unsigned char _release; -}; - -#endif - - -#define TIE_Event_Comm_Notification_Receiver(X) Event_Comm_Notification_Receiver##X - -#define DEF_TIE_Event_Comm_Notification_Receiver(X) \ - class Event_Comm_Notification_Receiver##X : public virtual Event_Comm::Notification_Receiver { \ - X* m_obj; \ - public: \ - \ - Event_Comm_Notification_Receiver##X (X *objp, const char* m="", CORBA::LoaderClass *l=0)\ - : Event_Comm::Notification_Receiver(), CORBA::Object (), m_obj(objp) { \ - m_pptr = new Event_Comm::Notification_Receiver_dispatch \ - (( Event_Comm::Notification_Receiver*)this,(CORBA::Object*)this,m,l,Event_Comm_Notification_Receiver_IR,m_obj); \ - } \ - Event_Comm_Notification_Receiver##X (CORBA::Object *IT_p, const char* IT_m="", void *IT_q=0)\ - : Event_Comm::Notification_Receiver(), CORBA::Object () { \ - m_pptr = new Event_Comm::Notification_Receiver_dispatch \ - (( Event_Comm::Notification_Receiver*)this,(CORBA::Object*)this,IT_m,Event_Comm_Notification_Receiver_IR,IT_p,IT_q); \ - m_obj = (X*)(m_pptr->getImplObj ()); \ - } \ - \ - virtual ~Event_Comm_Notification_Receiver##X () { \ - if (_okToDeleteImpl ()) delete m_obj; } \ - \ - virtual void* _deref () { \ - return m_obj; } \ - \ - virtual void receive_notification (const Event_Comm::Notification& notification, CORBA::Environment &IT_env) throw (CORBA::SystemException){\ - m_obj->receive_notification ( notification,IT_env);\ -}\ - \ - virtual void disconnect (const char * reason, CORBA::Environment &IT_env) throw (CORBA::SystemException){\ - m_obj->disconnect ( reason,IT_env);\ -}\ - \ - }; - - -#define QUALS_Event_Comm_Notification_Receiver \ - virtual void receive_notification (const Event_Comm::Notification& notification, CORBA::Environment &IT_env) throw (CORBA::SystemException){\ - m_obj->receive_notification ( notification,IT_env);\ -}\ - \ - virtual void disconnect (const char * reason, CORBA::Environment &IT_env) throw (CORBA::SystemException){\ - m_obj->disconnect ( reason,IT_env);\ -}\ - - - - -class Notification_ReceiverProxyFactoryClass : public virtual CORBA::ObjectFactoryClass { -public: - Notification_ReceiverProxyFactoryClass (unsigned char IT_p=0) - : CORBA::ProxyFactory (Event_Comm_Notification_Receiver_IR, IT_p) {} - - virtual void* New (char *IT_OR, CORBA::Environment&); - - virtual void* New (ObjectReference *IT_OR, CORBA::Environment&); - - virtual void* New2 (); - - virtual void* IT_castUp (void *IT_p, char* IT_s); - - virtual CORBA::PPTR* pptr (void *IT_p); - - virtual void baseInterfaces (_IDL_SEQUENCE_string&); - - -}; - -static Notification_ReceiverProxyFactoryClass Notification_ReceiverProxyFactory; - - - -#endif - - -#ifndef _Event_Comm_Notifier_defined -#define _Event_Comm_Notifier_defined -class Notifier_dispatch : public virtual CORBA::PPTR { -public: - - Notifier_dispatch (void *IT_p, CORBA::Object* IT_o, const char *IT_m, - CORBA::LoaderClass *IT_l, char *IT_i, void* IT_im) - : CORBA::PPTR (IT_p,IT_o,IT_m,IT_l,IT_i,IT_im) {} - - - Notifier_dispatch (char *IT_OR, void *IT_p, CORBA::Object *IT_o) - : CORBA::PPTR (IT_OR,IT_p,IT_o) {} - - - Notifier_dispatch () {} - - Notifier_dispatch (ObjectReference *IT_OR, void *IT_p, CORBA::Object *IT_o) - : CORBA::PPTR (IT_OR,IT_p,IT_o) {} - - - Notifier_dispatch (void *IT_p, CORBA::Object *IT_o, const char *IT_m, - char *IT_i, CORBA::Object* IT_ob, void* IT_im) - : CORBA::PPTR (IT_p,IT_o,IT_m,IT_i,IT_ob,IT_im) {} - - - virtual unsigned char dispatch (CORBA::Request &IT_r, - unsigned char IT_isTarget, void* IT_pp=NULL); - - -}; - -class Notifier; - -#ifndef Event_Comm_NotifierPtr -#define Event_Comm_NotifierPtr - - typedef Notifier* Notifier_ptr; - - typedef Notifier* NotifierRef; - -#endif - - -#ifndef Event_Comm_NotifierForwH -#define Event_Comm_NotifierForwH -static CORBA::ObjectRef Notifier_getBase (void *); -static void Notifier_release (Notifier *, CORBA::Environment &IT_env); -static void Notifier_release (Notifier_ptr); -static Notifier* Notifier_duplicate (Notifier_ptr, CORBA::Environment &IT_env); -static Notifier* Notifier_duplicate (Notifier_ptr ); -static Notifier_ptr Notifier_nil (CORBA::Environment &IT_env); -static Notifier_ptr Notifier_nil (); -#endif -#define Event_Comm_Notifier_IMPL "Event_Comm_Notifier" - - -class Notifier; - - typedef Notifier NotifierProxy; -#define Event_Comm_Notifier_IR "Event_Comm_Notifier" -#define Event_Comm_Notifier_IMPL "Event_Comm_Notifier" - -#ifndef Event_Comm_NotifierPtr -#define Event_Comm_NotifierPtr - - typedef Notifier* Notifier_ptr; - - typedef Notifier* NotifierRef; - -#endif - -class Notifier: public virtual CORBA::Object { -public: - Notifier (char *IT_OR); - Notifier (ObjectReference *IT_OR); - Notifier () : CORBA::Object (1) {} -protected: - Notifier_ptr __duplicate( - CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) { - CORBA::Object::__duplicate (IT_env); - return this; - } -public: - static Notifier_ptr _duplicate( - Notifier_ptr obj, - CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) { - CORBA::EnvExcRaiser IT_raise (&IT_env); - if (CORBA::is_nil(obj, IT_env)) { - IT_raise.maybeRaise (); - return (obj); - } - Notifier_ptr IT_obj = obj->__duplicate (IT_env); - IT_raise.maybeRaise(); - return IT_obj; - } -public: - static Notifier* _bind (const char* IT_markerServer, const char* host, - const CORBA::Context &IT_c, - CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()); - static Notifier* _bind (CORBA::Environment &IT_env); - static Notifier* _bind (const char* IT_markerServer=NULL, const char* host=NULL, - CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()); - static Notifier* _narrow (CORBA::Object* , CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()); - static Notifier_ptr _nil (CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) { - CORBA::EnvExcRaiser IT_raise (&IT_env); - IT_raise.maybeRaise(); - return (Notifier_ptr) CORBA::OBJECT_NIL;} - virtual void send_disconnect (const char * reason, CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) throw (CORBA::SystemException); - virtual void send_notification (const Event_Comm::Notification& notification, CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) throw (CORBA::SystemException); - virtual void subscribe (Event_Comm::Notification_Receiver_ptr notification_receiver, const char * filtering_criteria, CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) throw (CORBA::SystemException); - virtual void unsubscribe (Event_Comm::Notification_Receiver_ptr notification_receiver, const char * filtering_criteria, CORBA::Environment &IT_env=CORBA::IT_chooseDefaultEnv ()) throw (CORBA::SystemException); -}; - - static const CORBA::TypeCode_ptr _tc_Notifier; - - static const CORBA::TypeCode_ptr _tc_NotifierRef; - -#ifndef Event_Comm_NotifierVarH -#define Event_Comm_NotifierVarH - -#ifndef Event_Comm_NotifiervPtr -#define Event_Comm_NotifiervPtr -typedef Notifier* Notifier_vPtr; -#endif - -class Notifier_var : public CORBA::_var -{ - public: - - Notifier_var () { - _ptr = Notifier_nil (); - } - - Notifier_var (Notifier *IT_p) { - _ptr = IT_p; - } - - Notifier_var (const Notifier_var &IT_s) { - _ptr = Notifier_duplicate (IT_s._ptr); - } - - Notifier_var &operator= (Notifier *IT_p) { - Notifier_release (_ptr); - _ptr = IT_p; - return (*this); - } - - Notifier_var &operator= (const Notifier_var &IT_s) { - Notifier_release (_ptr); - _ptr = Notifier_duplicate (IT_s._ptr); - return (*this); - } - - ~Notifier_var () { - Notifier_release (_ptr); - } - - Notifier* operator-> () { - return _ptr; - } - - operator const Notifier_vPtr () const { return _ptr;} - operator Notifier_vPtr& () { return _ptr;} - - protected: - Notifier *_ptr; - private: - Notifier_var &operator= (const CORBA::_var &IT_s); - Notifier_var (const CORBA::_var &IT_s); - Notifier_var &operator= (const CORBA::_mgr &IT_s); - Notifier_var &operator= (const CORBA::_SeqElem &IT_s); - Notifier_var (const CORBA::_mgr &IT_s); - Notifier_var (const CORBA::_SeqElem &IT_s); -}; - -#endif - - -#ifndef Event_Comm_NotifierMgrH -#define Event_Comm_NotifierMgrH - -class Notifier_mgr : public CORBA::_mgr -{ - public: - - Notifier_mgr () { - _ptr = Notifier_nil (); - _release = 1; - } - - Notifier_mgr (const Notifier_mgr &IT_s) { - _ptr = Notifier_duplicate (IT_s._ptr); - _release = 1; - } - - Notifier_mgr &operator= (Notifier *IT_p) { - if (_ptr && _release) - Notifier_release (_ptr); - _ptr = IT_p; - _release = 1; - return (*this); - } - - Notifier_mgr &operator= (const Notifier_mgr &IT_s) { - if (_ptr && _release) - Notifier_release (_ptr); - _ptr = Notifier_duplicate(IT_s._ptr); - _release = 1; - return (*this); - } - - Notifier_mgr &operator= (const Notifier_var &IT_s) { - if (_ptr && _release) - Notifier_release (_ptr); - _ptr = Notifier_duplicate(IT_s); - _release = 1; - return (*this); - } - - ~Notifier_mgr () { - if (_release) - Notifier_release (_ptr); - } - - unsigned char release () { - return _release; - } - - void release (unsigned char rel) { - _release = rel; - } - - operator int () const { - CORBA::Environment env; - CORBA::EnvExcRaiser IT_raise (&env); - return (!(CORBA::is_nil((CORBA::Object*) _ptr, env))); - } - - operator void* () const { - return _ptr; - } - - operator CORBA::Object * () const { - return (CORBA::Object *) _ptr; - } - - operator Notifier* () const { - return (Notifier*) _ptr; - } - - Notifier *_ptr; - - protected: - - unsigned char _release; -}; - -#endif - -#ifndef Event_Comm_NotifierSeqElemH -#define Event_Comm_NotifierSeqElemH - -class Notifier_SeqElem : public CORBA::_SeqElem -{ - public: - - Notifier_SeqElem (Event_Comm::Notifier_ptr* IT_p, unsigned char rel) { - _ptr = IT_p; - _release = rel; - } - - Notifier_SeqElem &operator= (Event_Comm::Notifier_ptr IT_p) { - if (!_ptr) - return (*this); - if (*(_ptr) && _release) - Notifier_release (*(_ptr)); - *(_ptr) = IT_p; - return (*this); - } - - Notifier_SeqElem &operator= (const Notifier_SeqElem &IT_s) { - if (!_ptr|| !IT_s._ptr) - return (*this); - if (*(_ptr) && _release) - Notifier_release (*(_ptr)); - *(_ptr) = Notifier_duplicate(*(IT_s._ptr)); - return (*this); - } - - operator Event_Comm::Notifier_ptr () const -{ - if (!_ptr) - return (Notifier_nil()); - return (Event_Comm::Notifier_ptr) (*_ptr); - } - - Notifier_ptr operator->() const { return *_ptr;} - - protected: - Event_Comm::Notifier_ptr *_ptr; - unsigned char _release; -}; - -#endif - - -#define TIE_Event_Comm_Notifier(X) Event_Comm_Notifier##X - -#define DEF_TIE_Event_Comm_Notifier(X) \ - class Event_Comm_Notifier##X : public virtual Event_Comm::Notifier { \ - X* m_obj; \ - public: \ - \ - Event_Comm_Notifier##X (X *objp, const char* m="", CORBA::LoaderClass *l=0)\ - : Event_Comm::Notifier(), CORBA::Object (), m_obj(objp) { \ - m_pptr = new Event_Comm::Notifier_dispatch \ - (( Event_Comm::Notifier*)this,(CORBA::Object*)this,m,l,Event_Comm_Notifier_IR,m_obj); \ - } \ - Event_Comm_Notifier##X (CORBA::Object *IT_p, const char* IT_m="", void *IT_q=0)\ - : Event_Comm::Notifier(), CORBA::Object () { \ - m_pptr = new Event_Comm::Notifier_dispatch \ - (( Event_Comm::Notifier*)this,(CORBA::Object*)this,IT_m,Event_Comm_Notifier_IR,IT_p,IT_q); \ - m_obj = (X*)(m_pptr->getImplObj ()); \ - } \ - \ - virtual ~Event_Comm_Notifier##X () { \ - if (_okToDeleteImpl ()) delete m_obj; } \ - \ - virtual void* _deref () { \ - return m_obj; } \ - \ - virtual void send_disconnect (const char * reason, CORBA::Environment &IT_env) throw (CORBA::SystemException){\ - m_obj->send_disconnect ( reason,IT_env);\ -}\ - \ - virtual void send_notification (const Event_Comm::Notification& notification, CORBA::Environment &IT_env) throw (CORBA::SystemException){\ - m_obj->send_notification ( notification,IT_env);\ -}\ - \ - virtual void subscribe (Event_Comm::Notification_Receiver_ptr notification_receiver, const char * filtering_criteria, CORBA::Environment &IT_env) throw (CORBA::SystemException){\ - m_obj->subscribe ( notification_receiver, filtering_criteria,IT_env);\ -}\ - \ - virtual void unsubscribe (Event_Comm::Notification_Receiver_ptr notification_receiver, const char * filtering_criteria, CORBA::Environment &IT_env) throw (CORBA::SystemException){\ - m_obj->unsubscribe ( notification_receiver, filtering_criteria,IT_env);\ -}\ - \ - }; - - -#define QUALS_Event_Comm_Notifier \ - virtual void send_disconnect (const char * reason, CORBA::Environment &IT_env) throw (CORBA::SystemException){\ - m_obj->send_disconnect ( reason,IT_env);\ -}\ - \ - virtual void send_notification (const Event_Comm::Notification& notification, CORBA::Environment &IT_env) throw (CORBA::SystemException){\ - m_obj->send_notification ( notification,IT_env);\ -}\ - \ - virtual void subscribe (Event_Comm::Notification_Receiver_ptr notification_receiver, const char * filtering_criteria, CORBA::Environment &IT_env) throw (CORBA::SystemException){\ - m_obj->subscribe ( notification_receiver, filtering_criteria,IT_env);\ -}\ - \ - virtual void unsubscribe (Event_Comm::Notification_Receiver_ptr notification_receiver, const char * filtering_criteria, CORBA::Environment &IT_env) throw (CORBA::SystemException){\ - m_obj->unsubscribe ( notification_receiver, filtering_criteria,IT_env);\ -}\ - - - - -class NotifierProxyFactoryClass : public virtual CORBA::ObjectFactoryClass { -public: - NotifierProxyFactoryClass (unsigned char IT_p=0) - : CORBA::ProxyFactory (Event_Comm_Notifier_IR, IT_p) {} - - virtual void* New (char *IT_OR, CORBA::Environment&); - - virtual void* New (ObjectReference *IT_OR, CORBA::Environment&); - - virtual void* New2 (); - - virtual void* IT_castUp (void *IT_p, char* IT_s); - - virtual CORBA::PPTR* pptr (void *IT_p); - - virtual void baseInterfaces (_IDL_SEQUENCE_string&); - - -}; - -static NotifierProxyFactoryClass NotifierProxyFactory; - - - -#endif - -}; - - -void operator<<= (CORBA::any &IT_a, Event_Comm::Notification_Receiver_ptr IT_t); -CORBA::Boolean operator>>= (const CORBA::any &IT_a, Event_Comm::Notification_Receiver_ptr& IT_t); - - -void operator<<= (CORBA::any &IT_a, Event_Comm::Notifier_ptr IT_t); -CORBA::Boolean operator>>= (const CORBA::any &IT_a, Event_Comm::Notifier_ptr& IT_t); - - -void operator<<= (CORBA::any &IT_a, const Event_Comm::Notification& IT_t); -CORBA::Boolean operator>>= (const CORBA::any &IT_a, Event_Comm::Notification*& IT_t); - - -#endif diff --git a/apps/Orbix-Examples/Event_Comm/libsrc/Event_Comm.idl b/apps/Orbix-Examples/Event_Comm/libsrc/Event_Comm.idl deleted file mode 100644 index 26890129d70..00000000000 --- a/apps/Orbix-Examples/Event_Comm/libsrc/Event_Comm.idl +++ /dev/null @@ -1,92 +0,0 @@ -/* -*- C++ -*- */ -// @(#)Event_Comm.idl 1.1 10/18/96 - - -// ============================================================================ -// -// = LIBRARY -// EventComm -// -// = FILENAME -// Event_Comm.idl -// -// = DESCRIPTION -// The CORBA IDL module for distributed event notification. -// -// = AUTHOR -// Douglas C. Schmidt (schmidt@cs.wustl.edu) -// -// ============================================================================ - -#ifndef _EVENT_COMM_IDL -#define _EVENT_COMM_IDL - -module Event_Comm - // = TITLE - // The CORBA IDL module for distributed event notification. - // - // = DESCRIPTION -{ - struct Notification - // = TITLE - // Defines the interface for an event <Notification>. - // - // = This is the type passed by the Notifier to the Notification_Receiver. - // Since it contains an <any>, it can hold any values. Naturally, - // the consumer must understand how to interpret this! - { - string tag_; - // Tag for the notification. - - // any value_; - // A notification can contain anything. - -// Object object_ref_; - // Object reference for callbacks. - }; - - interface Notification_Receiver - // = TITLE - // Defines the interface for a <Notification_Receiver> of events. - // Note that all operations are <oneway> to avoid blocking. - // - // = DESCRIPTION - { - oneway void receive_notification (in Notification notification); - // Inform the <Notification_Receiver> that <event> has occurred. - - oneway void disconnect (in string reason); - // Disconnect the <Notification_Receiver> from the <Notifier>, - // giving it the <reason>. - }; - - interface Notifier - // = TITLE - // Defines the interface for a <Notifier> of events. - // - // = DESCRIPTION - { - oneway void send_disconnect (in string reason); - // Disconnect all the receivers, giving them the <reason>. - - oneway void send_notification (in Notification notification); - // Send the <Notification> to all the consumers who - // have subscribed and who match the filtering criteria. - - oneway void subscribe (in Notification_Receiver notification_receiver, - in string filtering_criteria); - // Subscribe the <Notification_Receiver> to receive events that - // match the regular expresssion <filtering_criteria> applied by - // the <Notifier>. If <filtering_criteria> is "" then all events - // are matched. - - oneway void unsubscribe (in Notification_Receiver notification_receiver, - in string filtering_criteria); - // Unsubscribe the <Notification_Receiver> that matches the - // filtering criteria. If <filtering_criteria> is "" then - // all <Notification_Receivers> with the matching object reference - // are removed. - }; -}; - -#endif /* _EVENT_COMM_IDL */ diff --git a/apps/Orbix-Examples/Event_Comm/libsrc/Event_CommC.cpp b/apps/Orbix-Examples/Event_Comm/libsrc/Event_CommC.cpp deleted file mode 100644 index b7e328c556c..00000000000 --- a/apps/Orbix-Examples/Event_Comm/libsrc/Event_CommC.cpp +++ /dev/null @@ -1,351 +0,0 @@ - -// $Id$ - -#include "Event_Comm.hh" - - -#ifndef Event_Comm_Notification_Ops -#define Event_Comm_Notification_Ops - -void Event_Comm::Notification:: encodeOp (CORBA::Request &IT_r) const { - IT_r.encodeStringOp (tag_); -} - -void Event_Comm::Notification:: decodeOp (CORBA::Request &IT_r) { - IT_r.decodeStringOp(tag_); -} - -void Event_Comm::Notification:: decodeInOutOp (CORBA::Request &IT_r) { - IT_r.decodeInOutStrOp(tag_, 0); -} - -void* Event_Comm::Notification:: IT_anySupport (CORBA::Request &IT_r, - void *& IT_v, void *IT_to, const CORBA::Flags& IT_f) { - Event_Comm::Notification* IT_l = (Event_Comm::Notification*)IT_v; - - if (IT_f.isSetAll (CORBA::ARG_INOUT)) { - if (!IT_l) - IT_l = new Event_Comm::Notification(); - IT_l -> decodeInOutOp (IT_r); - IT_v = IT_l; - } - else if (IT_f.isSet (CORBA::ARG_IN)) { - IT_l -> encodeOp (IT_r); - } - else if (IT_f.isSet (CORBA::ARG_OUT)) { - if (!IT_l) - IT_l = new Event_Comm::Notification(); - IT_l -> decodeOp (IT_r); - IT_v = IT_l; - } - else if (IT_f.isSet (CORBA::_ANY_ASSIGN)) { - Event_Comm::Notification*IT_s = IT_to ? (Event_Comm::Notification*)IT_to : new Event_Comm::Notification; - *IT_s = *IT_l; return IT_s; - } - else if (IT_f.isSet (CORBA::_ANY_DELETE)) { - if (IT_to) IT_l->Event_Comm::Notification::~Notification(); - else delete IT_l; - return NULL; - } - else if (IT_f.isSet (CORBA::_ANY_SIZEOF)) { - return (void*) (sizeof (Event_Comm::Notification)); - } - else if (IT_f.isNil ()) { - if (!IT_l) - IT_l = new Event_Comm::Notification(); - IT_l -> decodeOp (IT_r); - IT_v = IT_l; - } - return NULL; -} - -const void *Event_Comm::Notification:: IT_fn = -CORBA::anyTable.record ("Event_Comm::Notification", &Event_Comm::Notification:: IT_anySupport); - -Event_Comm::Notification &Event_Comm::Notification:: operator= (const Event_Comm::IONANC_Notification& IT_p) { - this->operator= (*(Event_Comm::Notification*) &IT_p); - return (*this); -} - -Event_Comm::Notification:: operator Event_Comm::IONANC_Notification () { - Event_Comm::IONANC_Notification tmp; - memset (&tmp, 0, sizeof(tmp)); - ((Event_Comm::Notification *) &tmp)->operator= (*this); - return tmp; -} - -Event_Comm::Notification:: operator const Event_Comm::IONANC_Notification () const { - Event_Comm::IONANC_Notification tmp; - memset (&tmp, 0, sizeof(tmp)); - ((Event_Comm::Notification *) &tmp)->operator= (*this); - return tmp; -} - -Event_Comm::Notification::~Notification () { - if (tag_) delete [] tag_; -} - -Event_Comm::Notification:: Notification (const Event_Comm::Notification &IT_s) - { - if (IT_s.tag_) { - tag_=new char [strlen(IT_s.tag_)+1]; - strcpy (tag_, IT_s.tag_); - } - else { - tag_ = NULL; - } -} - -Event_Comm::Notification:: Notification () { - tag_ = NULL; -} - -Event_Comm::Notification &Event_Comm::Notification:: operator= (const Event_Comm::Notification& IT_s) { - if (this == &IT_s) return *this; - if (tag_) delete [] tag_; - if (IT_s.tag_) { - tag_=new char [strlen(IT_s.tag_)+1]; - strcpy (tag_, IT_s.tag_); - } - else { - tag_ = NULL; - } - return *this; -} - -Event_Comm::IONANC_Notification:: operator Event_Comm::Notification () { - return (*((Event_Comm::Notification *) this)); -} - -Event_Comm::IONANC_Notification:: operator const Event_Comm::Notification () const { - return (*((const Event_Comm::Notification *) this)); -} - - -#endif -Event_Comm::Notification_Receiver::Notification_Receiver (char *IT_OR) { - m_pptr = new Notification_Receiver_dispatch (IT_OR, this,(CORBA::Object*)this); -} - -#ifndef Event_Comm_Notification_ReceiverForwC -#define Event_Comm_Notification_ReceiverForwC -CORBA::ObjectRef Event_Comm::Notification_Receiver_getBase(void *IT_p){ - return (Event_Comm::Notification_Receiver*)IT_p;} - -void Event_Comm::Notification_Receiver_release (void *IT_p, CORBA::Environment &IT_env) { - ((Event_Comm::Notification_Receiver*)IT_p)->_release(IT_env);} - -Event_Comm::Notification_Receiver* Event_Comm::Notification_Receiver_duplicate (void *IT_p, CORBA::Environment &IT_env) { - return ((Event_Comm::Notification_Receiver*)IT_p)->_duplicate(IT_env); } -#endif - - - -Event_Comm::Notification_Receiver* Event_Comm::Notification_Receiver:: _bind (const char* IT_markerServer, const char* host, - const CORBA::Context &IT_c, - CORBA::Environment &IT_env) { - Notification_Receiver*IT_p = - (Notification_Receiver*)CORBA::Factory.New (IT_markerServer, IT_env, IT_c, host, - Event_Comm_Notification_Receiver_IMPL, Event_Comm_Notification_Receiver_IR); - return IT_p ? IT_p->_duplicate () : NULL; } - - - -Event_Comm::Notification_Receiver* Event_Comm::Notification_Receiver:: _bind (CORBA::Environment &IT_env) { - return _bind (NULL,NULL,CORBA::Context(), IT_env); } - - -Event_Comm::Notification_Receiver* Event_Comm::Notification_Receiver:: _bind (const char* IT_markerServer, const char* host, - CORBA::Environment &IT_env) { - return _bind (IT_markerServer, host, CORBA::Context (), IT_env); } -Event_Comm::Notification_Receiver* Event_Comm::Notification_Receiver::_narrow (CORBA::Object* IT_obj, CORBA::Environment &IT_env) { - Event_Comm::Notification_Receiver* IT_p = (Event_Comm::Notification_Receiver*)CORBA::Object::_castDown (IT_obj, Event_Comm_Notification_Receiver_IR, IT_env); - return IT_p ? IT_p->_duplicate(IT_env) : NULL; - } - -void* Event_Comm::Notification_ReceiverProxyFactoryClass::New (char *IT_OR, CORBA::Environment&) { - return new Notification_Receiver(IT_OR);} - -void* Event_Comm::Notification_ReceiverProxyFactoryClass::New2 () { - return new Notification_Receiver();} - -void* Event_Comm::Notification_ReceiverProxyFactoryClass::IT_castUp (void *IT_p, char* IT_s) { - void *IT_l; - if (!CORBA::_interfaceCmp (IT_s,Event_Comm_Notification_Receiver_IR)) - return IT_p; - else if (IT_l=CORBA::ObjectFactoryClass::IT_castUp((CORBA::Object*)((Event_Comm::Notification_Receiver*)IT_p),IT_s)) - return IT_l; - else return NULL; - } - - -CORBA::PPTR* Event_Comm::Notification_ReceiverProxyFactoryClass::pptr (void *IT_p) { - return ((Event_Comm::Notification_Receiver*)IT_p)->_pptr ();} - -void Event_Comm::Notification_ReceiverProxyFactoryClass::baseInterfaces (_IDL_SEQUENCE_string& seq) { - add (seq, Event_Comm_Notification_Receiver_IR); - CORBA::ObjectFactoryClass::baseInterfaces (seq); -} - - void Event_Comm::Notification_Receiver:: receive_notification(const Event_Comm::Notification& notification, CORBA::Environment &IT_env) { - - if (IT_env || m_isNull) return ; - CORBA::Request IT_r (this, "receive_notification",IT_env,1,1); - if (!IT_r.isException (IT_env)) { - notification.encodeOp (IT_r); - } - - IT_r.invoke (CORBA::Flags(CORBA::INV_NO_RESPONSE), IT_env); - } - - void Event_Comm::Notification_Receiver:: disconnect(const char * reason, CORBA::Environment &IT_env) { - - if (IT_env || m_isNull) return ; - CORBA::Request IT_r (this, "disconnect",IT_env,1,1); - if (!IT_r.isException (IT_env)) { - IT_r.encodeStringOp (reason); - } - - IT_r.invoke (CORBA::Flags(CORBA::INV_NO_RESPONSE), IT_env); - } - - -Event_Comm::Notification_ReceiverProxyFactoryClass Event_Comm::Notification_ReceiverProxyFactory(1); - - -#ifndef Event_Comm_Notification_Receiver_dispatch_impl - -unsigned char Event_Comm::Notification_Receiver_dispatch::dispatch (CORBA::Request &IT_r, - unsigned char, void *) { - IT_r.makeRuntimeException1 ("Event_Comm::Notification_Receiver"); - return 0; -} - -#endif - -Event_Comm::Notifier::Notifier (char *IT_OR) { - m_pptr = new Notifier_dispatch (IT_OR, this,(CORBA::Object*)this); -} - -#ifndef Event_Comm_NotifierForwC -#define Event_Comm_NotifierForwC -CORBA::ObjectRef Event_Comm::Notifier_getBase(void *IT_p){ - return (Event_Comm::Notifier*)IT_p;} - -void Event_Comm::Notifier_release (void *IT_p, CORBA::Environment &IT_env) { - ((Event_Comm::Notifier*)IT_p)->_release(IT_env);} - -Event_Comm::Notifier* Event_Comm::Notifier_duplicate (void *IT_p, CORBA::Environment &IT_env) { - return ((Event_Comm::Notifier*)IT_p)->_duplicate(IT_env); } -#endif - - - -Event_Comm::Notifier* Event_Comm::Notifier:: _bind (const char* IT_markerServer, const char* host, - const CORBA::Context &IT_c, - CORBA::Environment &IT_env) { - Notifier*IT_p = - (Notifier*)CORBA::Factory.New (IT_markerServer, IT_env, IT_c, host, - Event_Comm_Notifier_IMPL, Event_Comm_Notifier_IR); - return IT_p ? IT_p->_duplicate () : NULL; } - - - -Event_Comm::Notifier* Event_Comm::Notifier:: _bind (CORBA::Environment &IT_env) { - return _bind (NULL,NULL,CORBA::Context(), IT_env); } - - -Event_Comm::Notifier* Event_Comm::Notifier:: _bind (const char* IT_markerServer, const char* host, - CORBA::Environment &IT_env) { - return _bind (IT_markerServer, host, CORBA::Context (), IT_env); } -Event_Comm::Notifier* Event_Comm::Notifier::_narrow (CORBA::Object* IT_obj, CORBA::Environment &IT_env) { - Event_Comm::Notifier* IT_p = (Event_Comm::Notifier*)CORBA::Object::_castDown (IT_obj, Event_Comm_Notifier_IR, IT_env); - return IT_p ? IT_p->_duplicate(IT_env) : NULL; - } - -void* Event_Comm::NotifierProxyFactoryClass::New (char *IT_OR, CORBA::Environment&) { - return new Notifier(IT_OR);} - -void* Event_Comm::NotifierProxyFactoryClass::New2 () { - return new Notifier();} - -void* Event_Comm::NotifierProxyFactoryClass::IT_castUp (void *IT_p, char* IT_s) { - void *IT_l; - if (!CORBA::_interfaceCmp (IT_s,Event_Comm_Notifier_IR)) - return IT_p; - else if (IT_l=CORBA::ObjectFactoryClass::IT_castUp((CORBA::Object*)((Event_Comm::Notifier*)IT_p),IT_s)) - return IT_l; - else return NULL; - } - - -CORBA::PPTR* Event_Comm::NotifierProxyFactoryClass::pptr (void *IT_p) { - return ((Event_Comm::Notifier*)IT_p)->_pptr ();} - -void Event_Comm::NotifierProxyFactoryClass::baseInterfaces (_IDL_SEQUENCE_string& seq) { - add (seq, Event_Comm_Notifier_IR); - CORBA::ObjectFactoryClass::baseInterfaces (seq); -} - - void Event_Comm::Notifier:: send_disconnect(const char * reason, CORBA::Environment &IT_env) { - - if (IT_env || m_isNull) return ; - CORBA::Request IT_r (this, "send_disconnect",IT_env,1,1); - if (!IT_r.isException (IT_env)) { - IT_r.encodeStringOp (reason); - } - - IT_r.invoke (CORBA::Flags(CORBA::INV_NO_RESPONSE), IT_env); - } - - void Event_Comm::Notifier:: send_notification(const Event_Comm::Notification& notification, CORBA::Environment &IT_env) { - - if (IT_env || m_isNull) return ; - CORBA::Request IT_r (this, "send_notification",IT_env,1,1); - if (!IT_r.isException (IT_env)) { - notification.encodeOp (IT_r); - } - - IT_r.invoke (CORBA::Flags(CORBA::INV_NO_RESPONSE), IT_env); - } - - void Event_Comm::Notifier:: subscribe(Event_Comm::Notification_Receiver* notification_receiver, const char * filtering_criteria, CORBA::Environment &IT_env) { - - if (IT_env || m_isNull) return ; - CORBA::Request IT_r (this, "subscribe",IT_env,1,1); - if (!IT_r.isException (IT_env)) { - IT_r << (CORBA::Object*)notification_receiver; - - IT_r.encodeStringOp (filtering_criteria); - } - - IT_r.invoke (CORBA::Flags(CORBA::INV_NO_RESPONSE), IT_env); - } - - void Event_Comm::Notifier:: unsubscribe(Event_Comm::Notification_Receiver* notification_receiver, const char * filtering_criteria, CORBA::Environment &IT_env) { - - if (IT_env || m_isNull) return ; - CORBA::Request IT_r (this, "unsubscribe",IT_env,1,1); - if (!IT_r.isException (IT_env)) { - IT_r << (CORBA::Object*)notification_receiver; - - IT_r.encodeStringOp (filtering_criteria); - } - - IT_r.invoke (CORBA::Flags(CORBA::INV_NO_RESPONSE), IT_env); - } - - -Event_Comm::NotifierProxyFactoryClass Event_Comm::NotifierProxyFactory(1); - - -#ifndef Event_Comm_Notifier_dispatch_impl - -unsigned char Event_Comm::Notifier_dispatch::dispatch (CORBA::Request &IT_r, - unsigned char, void *) { - IT_r.makeRuntimeException1 ("Event_Comm::Notifier"); - return 0; -} - -#endif - diff --git a/apps/Orbix-Examples/Event_Comm/libsrc/Event_CommS.cpp b/apps/Orbix-Examples/Event_Comm/libsrc/Event_CommS.cpp deleted file mode 100644 index 7609370a2e6..00000000000 --- a/apps/Orbix-Examples/Event_Comm/libsrc/Event_CommS.cpp +++ /dev/null @@ -1,166 +0,0 @@ - -// $Id$ - -#include "Event_Comm.hh" - - -#define Event_Comm_Notification_Receiver_dispatch_impl - -unsigned char Event_Comm::Notification_Receiver_dispatch::dispatch (CORBA::Request &IT_r, - unsigned char IT_isTarget, void *IT_pp) { - if (!IT_pp) - IT_pp = m_obj; - const char *IT_s = IT_r.getOperation (); - if (!strcmp(IT_s,"receive_notification")) { - CORBA::Environment IT_env (IT_r); - CORBA::Filter* IT_f = CORBA::Orbix.getFilter (); - if (!IT_r.tcAssert ("\ -Ro~receive_notification~+notification{R~Event_Comm::Notification~tag_{0}},>{v},O{}\ -")) - return 1; - Event_Comm::Notification notification; - notification.decodeOp (IT_r); - - if (IT_f && !IT_r.isException (IT_env)) - IT_f->inRequestPostM (IT_r, IT_env); - if (!IT_r.isException (IT_env)) - ((Event_Comm::Notification_Receiver*)IT_pp)->receive_notification ( notification, IT_env); - - IT_r.replyNoResults (CORBA::Flags(CORBA::INV_NO_RESPONSE),IT_env); - return 1; - } - - else if (!strcmp(IT_s,"disconnect")) { - CORBA::Environment IT_env (IT_r); - CORBA::Filter* IT_f = CORBA::Orbix.getFilter (); - if (!IT_r.tcAssert ("\ -Ro~disconnect~+reason{0},>{v},O{}\ -")) - return 1; - char * reason; - IT_r.decodeStringOp(reason); - - if (IT_f && !IT_r.isException (IT_env)) - IT_f->inRequestPostM (IT_r, IT_env); - if (!IT_r.isException (IT_env)) - ((Event_Comm::Notification_Receiver*)IT_pp)->disconnect ( reason, IT_env); - - delete [] reason; - IT_r.replyNoResults (CORBA::Flags(CORBA::INV_NO_RESPONSE),IT_env); - return 1; - } - - else if (IT_isTarget) - IT_r.makeRuntimeException2 (); - - return 0; -} - -#define Event_Comm_Notifier_dispatch_impl - -unsigned char Event_Comm::Notifier_dispatch::dispatch (CORBA::Request &IT_r, - unsigned char IT_isTarget, void *IT_pp) { - if (!IT_pp) - IT_pp = m_obj; - const char *IT_s = IT_r.getOperation (); - if (!strcmp(IT_s,"send_disconnect")) { - CORBA::Environment IT_env (IT_r); - CORBA::Filter* IT_f = CORBA::Orbix.getFilter (); - if (!IT_r.tcAssert ("\ -Ro~send_disconnect~+reason{0},>{v},O{}\ -")) - return 1; - char * reason; - IT_r.decodeStringOp(reason); - - if (IT_f && !IT_r.isException (IT_env)) - IT_f->inRequestPostM (IT_r, IT_env); - if (!IT_r.isException (IT_env)) - ((Event_Comm::Notifier*)IT_pp)->send_disconnect ( reason, IT_env); - - delete [] reason; - IT_r.replyNoResults (CORBA::Flags(CORBA::INV_NO_RESPONSE),IT_env); - return 1; - } - - else if (!strcmp(IT_s,"send_notification")) { - CORBA::Environment IT_env (IT_r); - CORBA::Filter* IT_f = CORBA::Orbix.getFilter (); - if (!IT_r.tcAssert ("\ -Ro~send_notification~+notification{R~Event_Comm::Notification~tag_{0}},>{v},O{}\ -")) - return 1; - Event_Comm::Notification notification; - notification.decodeOp (IT_r); - - if (IT_f && !IT_r.isException (IT_env)) - IT_f->inRequestPostM (IT_r, IT_env); - if (!IT_r.isException (IT_env)) - ((Event_Comm::Notifier*)IT_pp)->send_notification ( notification, IT_env); - - IT_r.replyNoResults (CORBA::Flags(CORBA::INV_NO_RESPONSE),IT_env); - return 1; - } - - else if (!strcmp(IT_s,"subscribe")) { - CORBA::Environment IT_env (IT_r); - CORBA::Filter* IT_f = CORBA::Orbix.getFilter (); - if (!IT_r.tcAssert ("\ -Ro~subscribe~+notification_receiver{O~Event_Comm::Notification_Receiver},+filtering_criteria{0},>{v},O{}\ -")) - return 1; - Event_Comm::Notification_Receiver* notification_receiver; - notification_receiver = (Event_Comm::Notification_Receiver*) IT_r.decodeObjRef (Event_Comm_Notification_Receiver_IR); - if (notification_receiver) notification_receiver->_duplicate (); - - char * filtering_criteria; - IT_r.decodeStringOp(filtering_criteria); - - if (IT_f && !IT_r.isException (IT_env)) - IT_f->inRequestPostM (IT_r, IT_env); - if (!IT_r.isException (IT_env)) - ((Event_Comm::Notifier*)IT_pp)->subscribe ( notification_receiver, filtering_criteria, IT_env); - - if (notification_receiver) notification_receiver->_release (); - - delete [] filtering_criteria; - IT_r.replyNoResults (CORBA::Flags(CORBA::INV_NO_RESPONSE),IT_env); - - return 1; - } - - else if (!strcmp(IT_s,"unsubscribe")) { - CORBA::Environment IT_env (IT_r); - CORBA::Filter* IT_f = CORBA::Orbix.getFilter (); - if (!IT_r.tcAssert ("\ -Ro~unsubscribe~+notification_receiver{O~Event_Comm::Notification_Receiver},+filtering_criteria{0},>{v},O{}\ -")) - return 1; - Event_Comm::Notification_Receiver* notification_receiver; - notification_receiver = (Event_Comm::Notification_Receiver*) IT_r.decodeObjRef (Event_Comm_Notification_Receiver_IR); - if (notification_receiver) notification_receiver->_duplicate (); - - char * filtering_criteria; - IT_r.decodeStringOp(filtering_criteria); - - if (IT_f && !IT_r.isException (IT_env)) - IT_f->inRequestPostM (IT_r, IT_env); - if (!IT_r.isException (IT_env)) - ((Event_Comm::Notifier*)IT_pp)->unsubscribe ( notification_receiver, filtering_criteria, IT_env); - - if (notification_receiver) notification_receiver->_release (); - - delete [] filtering_criteria; - IT_r.replyNoResults (CORBA::Flags(CORBA::INV_NO_RESPONSE),IT_env); - - return 1; - } - - else if (IT_isTarget) - IT_r.makeRuntimeException2 (); - - return 0; -} - -#include "Event_CommC.cpp" - diff --git a/apps/Orbix-Examples/Event_Comm/libsrc/Event_Comm_i.h b/apps/Orbix-Examples/Event_Comm/libsrc/Event_Comm_i.h deleted file mode 100644 index 57ab7124255..00000000000 --- a/apps/Orbix-Examples/Event_Comm/libsrc/Event_Comm_i.h +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - - -// ============================================================================ -// -// = LIBRARY -// EventComm -// -// = FILENAME -// Event_Comm_i.h -// -// = DESCRIPTION -// Class interface for the implementation of the distributed -// event notification mechanism. -// -// = AUTHOR -// Douglas C. Schmidt (schmidt@cs.wustl.edu) -// -// ============================================================================ - -#if !defined (_EVENT_COMM_I_H) -#define _EVENT_COMM_I_H - -#include "Notification_Receiver_i.h" -#include "Notifier_i.h" - -#if defined (ACE_HAS_ORBIX) -#define nil 0 - -// Tie the Notification_Receiver and Notifier implementation classes -// together with the IDL interface. - -DEF_TIE_Event_Comm_Notification_Receiver (Notification_Receiver_i) -DEF_TIE_Event_Comm_Notifier (Notifier_i) - -#endif /* ACE_HAS_ORBIX */ -#endif /* _EVENT_COMM_I_H */ diff --git a/apps/Orbix-Examples/Event_Comm/libsrc/Makefile b/apps/Orbix-Examples/Event_Comm/libsrc/Makefile deleted file mode 100644 index add9fd31151..00000000000 --- a/apps/Orbix-Examples/Event_Comm/libsrc/Makefile +++ /dev/null @@ -1,113 +0,0 @@ -#---------------------------------------------------------------------------- -# @(#)Makefile 1.1 10/18/96 -# -# Makefile for the Event Communications library -#---------------------------------------------------------------------------- - -#---------------------------------------------------------------------------- -# Local macros -#---------------------------------------------------------------------------- - -LIB = libEvent_Comm.a -SHLIB = libEvent_Comm.so - -FILES = Event_CommS \ - Event_CommC \ - Notifier_i \ - Notification_Receiver_i - -LSRC = $(addsuffix .cpp,$(FILES)) -LOBJ = $(addsuffix .o,$(FILES)) -SHOBJ = $(addsuffix .so,$(FILES)) - -VLDLIBS = $(LDLIBS:%=%$(VAR)) - -BUILD = $(VLIB) - -#---------------------------------------------------------------------------- -# Include macros and targets -#---------------------------------------------------------------------------- - -include $(WRAPPER_ROOT)/include/makeinclude/wrapper_macros.GNU -include $(WRAPPER_ROOT)/include/makeinclude/macros.GNU -include $(WRAPPER_ROOT)/include/makeinclude/rules.common.GNU -include $(WRAPPER_ROOT)/include/makeinclude/rules.nonested.GNU -include $(WRAPPER_ROOT)/include/makeinclude/rules.lib.GNU -include $(WRAPPER_ROOT)/include/makeinclude/rules.local.GNU - -#---------------------------------------------------------------------------- -# Orbix related macros and target settings. -#---------------------------------------------------------------------------- - -ORBIX_BINDIR = $(ORBIX_ROOT)/bin -ORBIX_LIBDIR = $(ORBIX_ROOT)/lib -ORBIX_INCDIR = $(ORBIX_ROOT)/include - -CPPFLAGS += -DEXCEPTIONS -I$(ORBIX_INCDIR) -DWANT_ORBIX_FDS -LDFLAGS += -L$(ORBIX_LIBDIR) -R $(ORBIX_LIBDIR) - -IDLFLAGS = -A -s S.cpp -c C.cpp - -#---------------------------------------------------------------------------- -# Local targets -#---------------------------------------------------------------------------- - -#---------------------------------------------------------------------------- -# Dependencies -#---------------------------------------------------------------------------- - -# DO NOT DELETE THIS LINE -- g++dep uses it. -# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. - -Event_CommS.o: Event_CommS.cpp Event_Comm.hh Event_CommC.cpp -Event_CommC.o: Event_CommC.cpp Event_Comm.hh -Notifier_i.o: Notifier_i.cpp \ - /project/adaptive/ACE_wrappers/build/SunOS5.4/include/ace/Log_Msg.h \ - /project/adaptive/ACE_wrappers/build/SunOS5.4/include/ace/Log_Record.h \ - /project/adaptive/ACE_wrappers/build/SunOS5.4/include/ace/sysincludes.h \ - /project/adaptive/ACE_wrappers/build/SunOS5.4/include/ace/config.h \ - /project/adaptive/ACE_wrappers/build/SunOS5.4/include/ace/Log_Priority.h \ - /project/adaptive/ACE_wrappers/build/SunOS5.4/include/ace/Log_Record.i \ - /project/adaptive/ACE_wrappers/build/SunOS5.4/include/ace/Log_Msg.i \ - /project/adaptive/ACE_wrappers/build/SunOS5.4/include/ace/Thread_Specific.h \ - /project/adaptive/ACE_wrappers/build/SunOS5.4/include/ace/Synch.h \ - /project/adaptive/ACE_wrappers/build/SunOS5.4/include/ace/Time_Value.h \ - /project/adaptive/ACE_wrappers/build/SunOS5.4/include/ace/Synch_T.h \ - /project/adaptive/ACE_wrappers/build/SunOS5.4/include/ace/Thread_Specific.i \ - Notification_Receiver_i.h Notifier_i.h \ - /project/adaptive/ACE_wrappers/build/SunOS5.4/include/ace/Map_Manager.h \ - /project/adaptive/ACE_wrappers/build/SunOS5.4/include/ace/SString.h \ - /project/adaptive/ACE_wrappers/build/SunOS5.4/include/ace/SString.i \ - Event_Comm.hh -Notification_Receiver_i.o: Notification_Receiver_i.cpp \ - /project/adaptive/ACE_wrappers/build/SunOS5.4/include/ace/Log_Msg.h \ - /project/adaptive/ACE_wrappers/build/SunOS5.4/include/ace/Log_Record.h \ - /project/adaptive/ACE_wrappers/build/SunOS5.4/include/ace/sysincludes.h \ - /project/adaptive/ACE_wrappers/build/SunOS5.4/include/ace/config.h \ - /project/adaptive/ACE_wrappers/build/SunOS5.4/include/ace/Log_Priority.h \ - /project/adaptive/ACE_wrappers/build/SunOS5.4/include/ace/Log_Record.i \ - /project/adaptive/ACE_wrappers/build/SunOS5.4/include/ace/Log_Msg.i \ - /project/adaptive/ACE_wrappers/build/SunOS5.4/include/ace/Thread_Specific.h \ - /project/adaptive/ACE_wrappers/build/SunOS5.4/include/ace/Synch.h \ - /project/adaptive/ACE_wrappers/build/SunOS5.4/include/ace/Time_Value.h \ - /project/adaptive/ACE_wrappers/build/SunOS5.4/include/ace/Synch_T.h \ - /project/adaptive/ACE_wrappers/build/SunOS5.4/include/ace/Thread_Specific.i \ - /project/adaptive/ACE_wrappers/build/SunOS5.4/include/ace/Service_Config.h \ - /project/adaptive/ACE_wrappers/build/SunOS5.4/include/ace/Reactor.h \ - /project/adaptive/ACE_wrappers/build/SunOS5.4/include/ace/Handle_Set.h \ - /project/adaptive/ACE_wrappers/build/SunOS5.4/include/ace/Handle_Set.i \ - /project/adaptive/ACE_wrappers/build/SunOS5.4/include/ace/Timer_Queue.h \ - /project/adaptive/ACE_wrappers/build/SunOS5.4/include/ace/Event_Handler.h \ - /project/adaptive/ACE_wrappers/build/SunOS5.4/include/ace/Timer_Queue.i \ - /project/adaptive/ACE_wrappers/build/SunOS5.4/include/ace/Signal.h \ - /project/adaptive/ACE_wrappers/build/SunOS5.4/include/ace/Set.h \ - /project/adaptive/ACE_wrappers/build/SunOS5.4/include/ace/Thread.h \ - /project/adaptive/ACE_wrappers/build/SunOS5.4/include/ace/Token.h \ - /project/adaptive/ACE_wrappers/build/SunOS5.4/include/ace/Reactor.i \ - /project/adaptive/ACE_wrappers/build/SunOS5.4/include/ace/Service_Object.h \ - /project/adaptive/ACE_wrappers/build/SunOS5.4/include/ace/Shared_Object.h \ - /project/adaptive/ACE_wrappers/build/SunOS5.4/include/ace/Service_Record.h \ - /project/adaptive/ACE_wrappers/build/SunOS5.4/include/ace/Thread_Manager.h \ - Notification_Receiver_i.h - -# IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/apps/Orbix-Examples/Event_Comm/libsrc/Notification.idl b/apps/Orbix-Examples/Event_Comm/libsrc/Notification.idl deleted file mode 100644 index ecfd5adb8e0..00000000000 --- a/apps/Orbix-Examples/Event_Comm/libsrc/Notification.idl +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- C++ -*- */ -// @(#)Notification.idl 1.1 10/18/96 - - -// ============================================================================ -// -// = LIBRARY -// EventComm -// -// = FILENAME -// Notification.idl -// -// = DESCRIPTION -// This is the CORBA IDL interface for the Event Communication <Notification>. -// -// = AUTHOR -// Douglas C. Schmidt (schmidt@cs.wustl.edu) -// -// ============================================================================ - -#ifndef _NOTIFICATION_IDL -#define _NOTIFICATION_IDL - -struct Notification - // = TITLE - // Defines the interface for an event <Notification>. - // - // = This is the type passed by the Notifier to the Notification_Receiver. - // Since it contains an <any>, it can hold any values. Naturally, - // the consumer must understand how to interpret this! -{ - string tag_; - // Tag for the notification. - -// any value_; - // A notification can contain anything. - - Object object_ref_; - // Object reference for callbacks. -}; - -#endif /* _NOTIFICATION_IDL */ diff --git a/apps/Orbix-Examples/Event_Comm/libsrc/Notification_Receiver.idl b/apps/Orbix-Examples/Event_Comm/libsrc/Notification_Receiver.idl deleted file mode 100644 index 222f18782f7..00000000000 --- a/apps/Orbix-Examples/Event_Comm/libsrc/Notification_Receiver.idl +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- C++ -*- */ -// @(#)Notification_Receiver.idl 1.1 10/18/96 - - -// ============================================================================ -// -// = LIBRARY -// EventComm -// -// = FILENAME -// Notification_Receiver.idl -// -// = DESCRIPTION -// The CORBA IDL interface for the Event Communication -// <Notification_Receiver> component. -// -// = AUTHOR -// Douglas C. Schmidt (schmidt@cs.wustl.edu) -// -// ============================================================================ - -#include "Notification.idl" - -#ifndef _Notification_Receiver_iDL -#define _Notification_Receiver_iDL - -interface Notification_Receiver - // = TITLE - // Defines the interface for a <Notification_Receiver> of events. - // Note that all operations are <oneway> to avoid blocking. - // - // = DESCRIPTION -{ - oneway void receive_notification (in Notification notification); - // Inform the <Notification_Receiver> that <event> has occurred. - - oneway void disconnect (in string reason); - // Disconnect the <Notification_Receiver> from the <Notifier>, - // giving it the <reason>. -}; - -#endif /* _Notification_Receiver_iDL */ diff --git a/apps/Orbix-Examples/Event_Comm/libsrc/Notification_Receiver_i.cpp b/apps/Orbix-Examples/Event_Comm/libsrc/Notification_Receiver_i.cpp deleted file mode 100644 index 57fb7cf8f91..00000000000 --- a/apps/Orbix-Examples/Event_Comm/libsrc/Notification_Receiver_i.cpp +++ /dev/null @@ -1,39 +0,0 @@ - -// $Id$ - -#include "ace/Service_Config.h" -#include "Notification_Receiver_i.h" - -#if defined (ACE_HAS_ORBIX) - -Notification_Receiver_i::Notification_Receiver_i (void) -{ -} - -Notification_Receiver_i::~Notification_Receiver_i (void) -{ -} - -// Inform the <Event_Comm::Notification_Receiver> that <event> has occurred. - -void -Notification_Receiver_i::receive_notification - (const Event_Comm::Notification ¬ification, - CORBA::Environment &IT_env) -{ - const char *tmpstr = notification.tag_; - - ACE_DEBUG ((LM_DEBUG, "**** got notification = %s\n", tmpstr)); -} - -// Disconnect the <Event_Comm::Notification_Receiver> from the <Event_Comm::Notifier>. - -void -Notification_Receiver_i::disconnect (const char *reason, - CORBA::Environment &IT_env) -{ - ACE_DEBUG ((LM_DEBUG, "**** got disconnected due to %s\n", reason)); - ACE_Service_Config::end_reactor_event_loop (); -} - -#endif /* ACE_HAS_ORBIX */ diff --git a/apps/Orbix-Examples/Event_Comm/libsrc/Notification_Receiver_i.h b/apps/Orbix-Examples/Event_Comm/libsrc/Notification_Receiver_i.h deleted file mode 100644 index 91bb99d6124..00000000000 --- a/apps/Orbix-Examples/Event_Comm/libsrc/Notification_Receiver_i.h +++ /dev/null @@ -1,48 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - - -// ============================================================================ -// -// = LIBRARY -// EventComm -// -// = FILENAME -// Notification_Receiver__i.h -// -// = DESCRIPTION -// Class interface for the implementation of the <Notification_Receiver> -// -// = AUTHOR -// Douglas C. Schmidt (schmidt@cs.wustl.edu) -// -// ============================================================================ - -#if !defined (_Notification_Receiver_i_H) -#define _Notification_Receiver_i_H - -#if defined (ACE_HAS_ORBIX) -#include "Event_Comm.hh" - -class Notification_Receiver_i - // = TITLE - // Defines the implementation class for event <Notification_Receivers>. - // - // = DESCRIPTION -{ -public: - Notification_Receiver_i (void); - ~Notification_Receiver_i (void); - - virtual void receive_notification (const Event_Comm::Notification ¬ification, - CORBA::Environment &IT_env); - // Pass the <Notification> to the <Notification_Receiver>. - - virtual void disconnect (const char *reason, - CORBA::Environment &IT_env); - // Disconnect the <Notification_Receiver> from the <Notifier>, - // giving it the <reason>. -}; - -#endif /* ACE_HAS_ORBIX */ -#endif /* _Notification_Receiver_i_H */ diff --git a/apps/Orbix-Examples/Event_Comm/libsrc/Notifier.idl b/apps/Orbix-Examples/Event_Comm/libsrc/Notifier.idl deleted file mode 100644 index 75e738e0627..00000000000 --- a/apps/Orbix-Examples/Event_Comm/libsrc/Notifier.idl +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- C++ -*- */ -// @(#)Notifier.idl 1.1 10/18/96 - - -// ============================================================================ -// -// = LIBRARY -// EventComm -// -// = FILENAME -// Notifier.idl -// -// = DESCRIPTION -// This is the CORBA IDL interface for the Event Communication <Notifier>. -// -// = AUTHOR -// Douglas C. Schmidt (schmidt@cs.wustl.edu) -// -// ============================================================================ - -#ifndef _Notifier_iDL -#define _Notifier_iDL - -#include "Notification.idl" -#include "Notification_Receiver.idl" - -interface Notifier - // = TITLE - // Defines the interface for a <Notifier> of events. - // - // = DESCRIPTION -{ - oneway void send_disconnect (in string reason); - // Disconnect all the receivers, giving them the <reason>. - - oneway void send_notification (in Notification notification); - // Send the <Notification> to all the consumers who - // have subscribed and who match the filtering criteria. - - oneway void subscribe (in Notification_Receiver notification_receiver, - in string filtering_criteria); - // Subscribe the <Notification_Receiver> to receive events that - // match <filtering_criteria> applied by the <Notifier>. - - oneway void unsubscribe (in Notification_Receiver notification_receiver); - // Unsubscribe the <Notification_Receiver>. -}; - -#endif /* _Notifier_iDL */ diff --git a/apps/Orbix-Examples/Event_Comm/libsrc/Notifier_i.cpp b/apps/Orbix-Examples/Event_Comm/libsrc/Notifier_i.cpp deleted file mode 100644 index 192a0aaab2a..00000000000 --- a/apps/Orbix-Examples/Event_Comm/libsrc/Notifier_i.cpp +++ /dev/null @@ -1,324 +0,0 @@ - -// $Id$ - -#include "Notification_Receiver_i.h" -#include "Notifier_i.h" - -#if defined (ACE_HAS_ORBIX) - -class Notification_Receiver_Entry - // = TITLE - // Keeps track of context information associated with - // a <Event_Comm::Notification_Receiver> entry. - // - // = DESCRIPTION - // -{ -public: - Notification_Receiver_Entry (Event_Comm::Notification_Receiver *notification_receiver, - const char *filtering_criteria); - ~Notification_Receiver_Entry (void); - - // = Set/get filtering criteria. - void criteria (const char *criteria); - const char *criteria (void); - - // = Set/get Event_Comm::Notification_Receiver object reference. - Event_Comm::Notification_Receiver *receiver (void); - void receiver (Event_Comm::Notification_Receiver *); - - // = Set/get the compiled regular expression buffer. - const char *regexp (void); - void regexp (char *); - -private: - const char *filtering_criteria_; - // String containing the filtering criteria. - - char *compiled_regexp_; - // Compiled representation of the regular expression (see - // regexpr(3g)). - - Event_Comm::Notification_Receiver *receiver_; - // Object reference for the Event_Comm::Notification_Receiver. -}; - -// = Set/get filtering criteria. - -void -Notification_Receiver_Entry::criteria (const char *criteria) -{ - ACE_OS::free (ACE_MALLOC_T (this->filtering_criteria_)); - this->filtering_criteria_ = ACE_OS::strdup (criteria); -} - -const char * -Notification_Receiver_Entry::criteria (void) -{ - return this->filtering_criteria_; -} - -// = Set/get Event_Comm::Notification_Receiver object reference. - -Event_Comm::Notification_Receiver * -Notification_Receiver_Entry::receiver (void) -{ - return this->receiver_; -} - -void -Notification_Receiver_Entry::receiver (Event_Comm::Notification_Receiver *receiver) -{ - this->receiver_ = receiver; -} - -const char * -Notification_Receiver_Entry::regexp (void) -{ - return this->compiled_regexp_; -} - -void -Notification_Receiver_Entry::regexp (char *regexp) -{ - ACE_OS::free (ACE_MALLOC_T (this->compiled_regexp_)); - this->compiled_regexp_ = regexp; -} - -Notification_Receiver_Entry::Notification_Receiver_Entry (Event_Comm::Notification_Receiver *receiver, - const char *filtering_criteria) - : receiver_ (receiver), - filtering_criteria_ (0), - compiled_regexp_ (0) -{ - char *compile_buffer = 0; - - this->criteria (filtering_criteria); - ACE_ASSERT (this->criteria ()); - - // Check for wildcard case first. - if (ACE_OS::strcmp (filtering_criteria, "") == 0) - compile_buffer = ACE_OS::strdup (""); - else // Compile the regular expression (the 0's cause ACE_OS::compile to allocate space). - compile_buffer = ACE_OS::compile (filtering_criteria, 0, 0); - - // Should throw an exception here! - ACE_ASSERT (compile_buffer != 0); - - this->regexp (compile_buffer); - ACE_ASSERT (this->regexp ()); - - // Increment the reference count since we are keeping a copy of - // this... - this->receiver_->_duplicate (this->receiver_); -} - -Notification_Receiver_Entry::~Notification_Receiver_Entry (void) -{ - ACE_OS::free (this->filtering_criteria_); - ACE_OS::free (this->compiled_regexp_); - // Decrement the object reference count. - CORBA::release (this->receiver_); -} - -Notifier_i::Notifier_i (size_t size) - : map_ (size) -{ -} - -// Add a new receiver to the table, being careful to check for -// duplicate entries. A receiver is considered a duplicate under -// the following circumstances: -// 1. It has the same marker name and the same filtering criteria -// 2. It has the same marker name and its filtering criteria is "" (the wild card). - -void -Notifier_i::subscribe (Event_Comm::Notification_Receiver *receiver_ref, - const char *filtering_criteria, - CORBA::Environment &IT_env) -{ - ACE_DEBUG ((LM_DEBUG, - "in Notifier_i::subscribe for %s with filtering criteria \"%s\"\n", - receiver_ref->_marker (), filtering_criteria)); - ACE_SString key (receiver_ref->_marker ()); - MAP_ITERATOR mi (this->map_); - - // Try to locate an entry using its marker name (which should be - // unique across the system). If we don't find the entry, or if the - // filtering criteria is different that is good news since we - // currently don't allow duplicates... In particular, if @@ Should - // duplicates be allowed? - - for (MAP_ENTRY *me = 0; mi.next (me) != 0; mi.advance ()) - { - Notification_Receiver_Entry *nr_entry = me->int_id_; - - // Check for a duplicate entry. - if (key == me->ext_id_ - && (ACE_OS::strcmp (filtering_criteria, "") == 0 - || ACE_OS::strcmp (filtering_criteria, nr_entry->criteria ()) == 0)) - { - // Inform the caller that the - // Event_Comm::Notification_Receiver * is already being - // used. - - errno = EADDRINUSE; - ACE_ERROR ((LM_ERROR, - "duplicate entry for receiver %s with criteria \"%s\"", - receiver_ref->_marker (), filtering_criteria)); - // Raise exception here??? - return; - } - } - - // If we get this far then we didn't find a duplicate, so add the - // new entry! - Notification_Receiver_Entry *nr_entry = - new Notification_Receiver_Entry (receiver_ref, filtering_criteria); - - if (nr_entry == 0) - { - errno = ENOMEM; - ACE_ERROR ((LM_ERROR, "%p\n", "new failed")); - // Raise exception here... - } - // Try to add new <Notification_Receiver_Entry> to the map. - else if (this->map_.bind (key, nr_entry) == -1) - { - // Prevent memory leaks. - delete nr_entry; - // Raise exception here... - ACE_ERROR ((LM_ERROR, "%p\n", "bind failed")); - } -} - -// Remove a receiver from the table. - -void -Notifier_i::unsubscribe (Event_Comm::Notification_Receiver *receiver_ref, - const char *filtering_criteria, - CORBA::Environment &IT_env) -{ - ACE_DEBUG ((LM_DEBUG, "in Notifier_i::unsubscribe for %s\n", - receiver_ref->_marker ())); - Notification_Receiver_Entry *nr_entry = 0; - ACE_SString key; - MAP_ITERATOR mi (this->map_); - int found = 0; - - // Don't make a copy since we are deleting... - key.rep ((char *) receiver_ref->_marker ()); - - // Locate <Notification_Receiver_Entry> and free up resources. @@ - // Note, we don't properly handle deallocation of KEYS! - - for (MAP_ENTRY *me = 0; mi.next (me) != 0; mi.advance ()) - { - if (key == me->ext_id_ - && (ACE_OS::strcmp (filtering_criteria, "") == 0 - || ACE_OS::strcmp (filtering_criteria, nr_entry->criteria ()) == 0)) - { - ACE_DEBUG ((LM_DEBUG, "removed entry %s with criteria \"%s\"\n", - receiver_ref->_marker (), filtering_criteria)); - found = 1; - // @@ This is a hack, we need a better approach! - if (this->map_.unbind (key, nr_entry) == -1) - ACE_ERROR ((LM_ERROR, "unbind failed for %s\n", - receiver_ref->_marker ())); - else - delete nr_entry; - } - } - - if (found == 0) - ACE_ERROR ((LM_ERROR, "entry %s with criteria \"%s\" not found\n", - receiver_ref->_marker (), filtering_criteria)); -} - -// Disconnect all the receivers, giving them the <reason>. - -void -Notifier_i::send_disconnect (const char *reason, - CORBA::Environment &IT_env) -{ - ACE_DEBUG ((LM_DEBUG, "in Notifier_i::send_disconnect = %s\n", reason)); - - MAP_ITERATOR mi (this->map_); - int count = 0; - - // Notify all the receivers, taking into account the filtering criteria. - - for (MAP_ENTRY *me = 0; mi.next (me) != 0; mi.advance ()) - { - Event_Comm::Notification_Receiver *receiver_ref = me->int_id_->receiver (); - ACE_ASSERT (receiver_ref->_marker () != 0); - ACE_DEBUG ((LM_DEBUG, "disconnecting client %s\n", receiver_ref->_marker ())); - TRY { - receiver_ref->disconnect (reason, IT_X); - } - CATCHANY { - cerr << "Unexpected exception " << IT_X << endl; - } - ENDTRY; - delete me->int_id_; - delete me->ext_id_.rep (); - count++; - } - - this->map_.close (); - if (count == 1) - ACE_DEBUG ((LM_DEBUG, "there was 1 receiver\n")); - else - ACE_DEBUG ((LM_DEBUG, "there were %d receivers\n", count)); -} - -// Notify all receivers whose filtering criteria match the event. - -void -Notifier_i::send_notification (const Event_Comm::Notification ¬ification, - CORBA::Environment &IT_env) -{ - ACE_DEBUG ((LM_DEBUG, "in Notifier_i::send_notification = %s\n", - notification.tag_)); - MAP_ITERATOR mi (this->map_); - int count = 0; - - // Notify all the receivers. - // @@ Later on we need to consider the filtering_criteria! - - for (MAP_ENTRY *me = 0; mi.next (me) != 0; mi.advance ()) - { - Event_Comm::Notification_Receiver *receiver_ref = me->int_id_->receiver (); - ACE_ASSERT (receiver_ref->_marker () != 0); - const char *regexp = me->int_id_->regexp (); - const char *criteria = me->int_id_->criteria (); - ACE_ASSERT (regexp); - ACE_ASSERT (criteria); - - // Do a regular expression comparison to determine matching. - if (ACE_OS::strcmp ("", criteria) == 0 // Everything matches the wildcard. -// || ACE_OS::strcmp (notification.tag_, regexp) == 0) - || ACE_OS::step (notification.tag_, regexp) != 0) - { - ACE_DEBUG ((LM_DEBUG, "string %s matched regexp \"%s\" for client %s\n", - notification.tag_, me->int_id_->criteria (), - receiver_ref->_marker ())); - TRY { - receiver_ref->receive_notification (notification, IT_X); - } - CATCHANY { - cerr << "Unexpected exception " << IT_X << endl; - continue; - } - ENDTRY; - count++; - } - } - - if (count == 1) - ACE_DEBUG ((LM_DEBUG, "there was 1 receiver\n")); - else - ACE_DEBUG ((LM_DEBUG, "there were %d receivers\n", count)); -} - -#endif /* ACE_HAS_ORBIX */ diff --git a/apps/Orbix-Examples/Event_Comm/libsrc/Notifier_i.h b/apps/Orbix-Examples/Event_Comm/libsrc/Notifier_i.h deleted file mode 100644 index 523710811a5..00000000000 --- a/apps/Orbix-Examples/Event_Comm/libsrc/Notifier_i.h +++ /dev/null @@ -1,82 +0,0 @@ -/* -*- C++ -*- */ -// $Id$ - - -// ============================================================================ -// -// = LIBRARY -// EventComm -// -// = FILENAME -// Notifier_i.h -// -// = DESCRIPTION -// Class interface for the implementation of the <Notifier> -// -// = AUTHOR -// Douglas C. Schmidt (schmidt@cs.wustl.edu) -// -// ============================================================================ - -#if !defined (_Notifier_i_H) -#define _Notifier_i_H - -#include "ace/Map_Manager.h" -#include "ace/Synch.h" -#include "ace/SString.h" -#include "Event_Comm.hh" - -#if defined (ACE_HAS_ORBIX) - -// Forward reference. -class Notification_Receiver_Entry; - -class Notifier_i - // = TITLE - // Defines the implementation class for event <Notifiers>. - // - // = DESCRIPTION -{ -public: - enum - { - DEFAULT_SIZE = 1024 // Default max number of Event_Comm::Notification_Receivers. - }; - - Notifier_i (size_t size_hint = Notifier_i::DEFAULT_SIZE); - // Initialize a Notifier_i object with the specified size hint. - - void send_disconnect (const char *reason, - CORBA::Environment &IT_env); - // Disconnect all the receivers, giving them the <reason>. - - void send_notification (const Event_Comm::Notification ¬ification, - CORBA::Environment &IT_env); - // Send the <Notification> to all the consumers who - // have subscribed and who match the filtering criteria. - - void subscribe (Event_Comm::Notification_Receiver *notification_receiver, - const char *filtering_criteria, - CORBA::Environment &IT_env); - // Subscribe the <Notification_Receiver> to receive events that - // match <filtering_criteria> applied by the <Notifier>. - - void unsubscribe (Event_Comm::Notification_Receiver *notification_receiver, - const char *filtering_criteria, - CORBA::Environment &IT_env); - // Unsubscribe the <Notification_Receiver>. - -private: - // The following implementation should be replaced - // by a standard container class from STL... - - typedef ACE_Map_Manager <ACE_SString, Notification_Receiver_Entry *, ACE_Null_Mutex> MAP_MANAGER; - typedef ACE_Map_Iterator <ACE_SString, Notification_Receiver_Entry *, ACE_Null_Mutex> MAP_ITERATOR; - typedef ACE_Map_Entry <ACE_SString, Notification_Receiver_Entry *> MAP_ENTRY; - - MAP_MANAGER map_; - // Table that maps a <Event_Comm::Notification_Receiver *> to a <Notification_Receiver_Entry *>. -}; - -#endif /* ACE_HAS_ORBIX */ -#endif /* _Notifier_i_H */ |
