summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpradeep <pradeep@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-10-03 01:53:46 +0000
committerpradeep <pradeep@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-10-03 01:53:46 +0000
commit16a5d14ede4391e7b6d13f145a20c24c90cff3ac (patch)
tree2ffcff9d230292d220f3a4d862f5edf33840541a
parent966e325ef7b289cc665a8cbe4dc62c0985e3ca06 (diff)
downloadATCD-16a5d14ede4391e7b6d13f145a20c24c90cff3ac.tar.gz
*** empty log message ***
-rw-r--r--TAO/examples/Event_Comm/Consumer_Handler.cpp44
-rw-r--r--TAO/examples/Event_Comm/Consumer_Input_Handler.cpp30
-rw-r--r--TAO/examples/Event_Comm/Consumer_Input_Handler.h2
-rw-r--r--TAO/examples/Event_Comm/Event_Comm.idl3
-rw-r--r--TAO/examples/Event_Comm/Event_Comm_i.cpp83
-rw-r--r--TAO/examples/Event_Comm/Event_Comm_i.h34
-rw-r--r--TAO/examples/Event_Comm/Makefile17
-rw-r--r--TAO/examples/Event_Comm/Notifier_Handler.cpp11
-rw-r--r--TAO/examples/Event_Comm/Notifier_Handler.h5
-rw-r--r--TAO/examples/Event_Comm/Supplier_Input_Handler.cpp22
-rw-r--r--TAO/examples/Event_Comm/Supplier_Input_Handler.h2
-rw-r--r--TAO/examples/Event_Comm/notifier.cpp9
-rw-r--r--TAO/examples/Event_Comm/supplier.cpp4
13 files changed, 153 insertions, 113 deletions
diff --git a/TAO/examples/Event_Comm/Consumer_Handler.cpp b/TAO/examples/Event_Comm/Consumer_Handler.cpp
index 9b9b3bb043d..d6c6fa84702 100644
--- a/TAO/examples/Event_Comm/Consumer_Handler.cpp
+++ b/TAO/examples/Event_Comm/Consumer_Handler.cpp
@@ -4,14 +4,6 @@
ACE_RCSID(Consumer, Consumer_Handler, "$Id$")
-#if defined (ACE_HAS_ORBIX) && (ACE_HAS_ORBIX != 0)
-
-#if defined (ACE_HAS_MT_ORBIX) && (ACE_HAS_MT_ORBIX != 0)
-typedef ACE_MT_CORBA_Handler CORBA_HANDLER;
-#else
-typedef ACE_ST_CORBA_Handler CORBA_HANDLER;
-#endif /* ACE_HAS_MT_ORBIX */
-
int
Consumer_Handler::handle_close (ACE_HANDLE, ACE_Reactor_Mask)
{
@@ -21,8 +13,9 @@ Consumer_Handler::handle_close (ACE_HANDLE, ACE_Reactor_Mask)
{
ACE_DEBUG ((LM_DEBUG,
"closing down Consumer_Handler\n"));
- CORBA_HANDLER::instance ()->deactivate_service (Event_Comm_Consumer_IMPL,
+ /*CORBA_HANDLER::instance ()->deactivate_service (Event_Comm_Consumer_IMPL,
this->receiver_->_marker ());
+ */
CORBA::release (this->receiver_);
this->receiver_ = 0;
CORBA::release (this->notifier_);
@@ -34,11 +27,14 @@ Consumer_Handler::handle_close (ACE_HANDLE, ACE_Reactor_Mask)
}
Consumer_Handler::Consumer_Handler (int argc, char *argv[])
- : notifier_ (0),
+ : notifier_ (0),
receiver_ (0)
{
- const char *server_name =
- Event_Comm_Consumer_IMPL;
+ // @@ Orbix specific things. figure out TAO equivalents
+ /*
+ const char *server_name = ""; // @@ fill this in.
+ // Event_Comm_Consumer_IMPL;
+ // @@ what is this??
char buf[BUFSIZ];
char *receiver_marker = buf;
char *filtering_criteria;
@@ -54,9 +50,10 @@ Consumer_Handler::Consumer_Handler (int argc, char *argv[])
// Then override these variables with command-line arguments.
filtering_criteria = argc > 1 ? argv[1] : "";
host = argc > 2 ? argv[2] : "tango.cs";
- notifier_marker = argc > 3 ? argv[3] : "notifier:" Event_Comm_Notifier_IR;
+ notifier_marker = argc > 3 ? argv[3] : "notifier:" ;
+ // Event_Comm_Notifier_IR; @@ what is this?
- CORBA::Orbix.setDiagnostics (0);
+ // CORBA::Orbix.setDiagnostics (0);
utsname name;
@@ -64,30 +61,30 @@ Consumer_Handler::Consumer_Handler (int argc, char *argv[])
ACE_OS::uname (&name);
sprintf (buf, "/%s/%d", name.nodename, ACE_OS::getpid ());
- CORBA_HANDLER::instance ()->activate_service (Event_Comm_Consumer_IMPL,
+ CORBA_HANDLER::instance ()->activate_service (Event_Comm_Consumer_IMPL,
receiver_marker,
service_location);
// Create the receiver object.
ACE_NEW (this->receiver_,
- TIE_Event_Comm_Consumer (Consumer_i)
+ TIE_Event_Comm_Consumer (Consumer_i)
(new Consumer_i));
-
+
this->receiver_->_marker (receiver_marker);
ACE_ASSERT (this->receiver_);
- TRY
+ TRY
{
// Get a binding to the notifier.
this->notifier_ = Event_Comm::Notifier::_bind (notifier_marker, host, IT_X);
if (this->notifier_ != CORBA::OBJECT_NIL)
// Subscribe ourselves with the notifier's broker.
- this->notifier_->subscribe (this->receiver_,
+ this->notifier_->subscribe (this->receiver_,
filtering_criteria, IT_X);
- }
- CATCHANY
+ }
+ CATCHANY
{
cerr << "Unexpected exception " << IT_X << endl;
ACE_OS::exit (1);
@@ -99,9 +96,10 @@ Consumer_Handler::Consumer_Handler (int argc, char *argv[])
CORBA::BOA::activationMode mode = CORBA::Orbix.myActivationMode ();
ACE_DEBUG ((LM_DEBUG,
"starting up a %spersistent server in mode %d with marker name %s\n",
- mode == CORBA::BOA::persistentActivationMode ? "" : "non-",
+ mode == CORBA::BOA::persistentActivationMode ? "" : "non-",
mode,
receiver_marker));
+*/
}
Event_Comm::Consumer *
@@ -123,5 +121,3 @@ Consumer_Handler::~Consumer_Handler (void)
this->handle_close (-1,
ACE_Event_Handler::ALL_EVENTS_MASK);
}
-
-#endif /* ACE_HAS_ORBIX */
diff --git a/TAO/examples/Event_Comm/Consumer_Input_Handler.cpp b/TAO/examples/Event_Comm/Consumer_Input_Handler.cpp
index 3b55cc9c13d..308a0bb9261 100644
--- a/TAO/examples/Event_Comm/Consumer_Input_Handler.cpp
+++ b/TAO/examples/Event_Comm/Consumer_Input_Handler.cpp
@@ -44,18 +44,19 @@ Consumer_Input_Handler::handle_close (ACE_HANDLE, ACE_Reactor_Mask)
// Only try to unsubscribe if the Consumer initiated the
// shutdown. Otherwise, the Supplier initiated it and it has
// probably gone away by now!
- TRY
+ TAO_TRY
{
// Gracefully shutdown the Receiver by removing it from the
// Notifier's internal map.
- notifier->unsubscribe (receiver, "", IT_X);
+ notifier->unsubscribe (receiver, "", TAO_TRY_ENV); //IT_X);
+ TAO_CHECK_ENV;
}
- CATCHANY
+ TAO_CATCHANY
{
- cerr << IT_X << endl;
+ TAO_TRY_ENV.print_exception ("Consumer_Input_Handler::handle_close\n");
}
- ENDTRY;
+ TAO_ENDTRY;
}
// Don't execute a callback here otherwise we'll recurse
@@ -72,7 +73,7 @@ Consumer_Input_Handler::handle_close (ACE_HANDLE, ACE_Reactor_Mask)
return 0;
}
-Consumer_Input_Handler::Input_Handler (Consumer_Handler *ch,
+Consumer_Input_Handler::Consumer_Input_Handler (Consumer_Handler *ch,
ACE_HANDLE handle)
: receiver_handler_ (ch),
handle_ (handle),
@@ -103,6 +104,7 @@ Consumer_Input_Handler::handle_input (ACE_HANDLE h)
ACE_DEBUG ((LM_DEBUG,
"notifying for event %s\n",
buf));
+
}
else
{
@@ -121,23 +123,27 @@ Consumer_Input_Handler::handle_input (ACE_HANDLE h)
// Consumer wants to shutdown.
this->consumer_initiated_shutdown (1);
+
+
// Tell the main event loop to shutdown.
ACE_Reactor::end_event_loop();
}
else
{
- TRY
+ TAO_TRY
{
Event_Comm::Event event;
event.tag_ = ACE_OS::strdup (buf);
- notifier->push (event, IT_X);
- }
- CATCHANY
+ notifier->push (event, TAO_TRY_ENV); //IT_X);
+ TAO_CHECK_ENV;
+ }
+ TAO_CATCHANY
{
- cerr << "Unexpected exception " << IT_X << endl;
- } ENDTRY;
+ TAO_TRY_ENV.print_exception("Unexpected exception\n");
+ }
+ TAO_ENDTRY;
}
/* NOTREACHED */
diff --git a/TAO/examples/Event_Comm/Consumer_Input_Handler.h b/TAO/examples/Event_Comm/Consumer_Input_Handler.h
index 2ae7069dfe1..e0fcd60eca5 100644
--- a/TAO/examples/Event_Comm/Consumer_Input_Handler.h
+++ b/TAO/examples/Event_Comm/Consumer_Input_Handler.h
@@ -22,7 +22,7 @@
// Forward declaration.
class Consumer_Handler;
-class Input_Handler : public ACE_Service_Object
+class Consumer_Input_Handler : public ACE_Service_Object
{
// = TITLE
// Handles input events generated from a keyboard.
diff --git a/TAO/examples/Event_Comm/Event_Comm.idl b/TAO/examples/Event_Comm/Event_Comm.idl
index 1f7bdcc6441..8c2018bbba2 100644
--- a/TAO/examples/Event_Comm/Event_Comm.idl
+++ b/TAO/examples/Event_Comm/Event_Comm.idl
@@ -57,6 +57,9 @@ module Event_Comm
void disconnect (in string reason);
// Disconnect the <Consumer> from the <Notifier>,
// giving it the <reason>.
+
+ string marker ();
+ // @@ what does this do?? why was it missing?
};
interface Notifier
diff --git a/TAO/examples/Event_Comm/Event_Comm_i.cpp b/TAO/examples/Event_Comm/Event_Comm_i.cpp
index f181a15d460..593ed187a94 100644
--- a/TAO/examples/Event_Comm/Event_Comm_i.cpp
+++ b/TAO/examples/Event_Comm/Event_Comm_i.cpp
@@ -16,6 +16,7 @@ public:
// = Set/get filtering criteria.
void criteria (const char *criteria);
+
const char *criteria (void);
// = Set/get Event_Comm::Consumer object reference.
@@ -112,8 +113,8 @@ Consumer_Entry::Consumer_Entry (Event_Comm::Consumer *receiver,
Consumer_Entry::~Consumer_Entry (void)
{
- ACE_OS::free (this->filtering_criteria_);
- ACE_OS::free (this->compiled_regexp_);
+ ACE_OS::free ((void*)this->filtering_criteria_);
+ ACE_OS::free ((void*)this->compiled_regexp_);
// Decrement the object reference count.
CORBA::release (this->receiver_);
}
@@ -130,15 +131,15 @@ Notifier_i::Notifier_i (size_t size)
// 2. It has the same marker name and its filtering criteria is "" (the wild card).
void
-Notifier_i::subscribe (Event_Comm::Consumer *receiver_ref,
+Notifier_i::subscribe (Event_Comm::Consumer_ptr receiver_ref,
const char *filtering_criteria,
- CORBA::Environment &IT_env)
+ CORBA::Environment &TAO_TRY_ENV)
{
ACE_DEBUG ((LM_DEBUG,
"in Notifier_i::subscribe for %s with filtering criteria \"%s\"\n",
- receiver_ref->_marker (),
+ receiver_ref->marker (),
filtering_criteria));
- ACE_SString key (receiver_ref->_marker ());
+ ACE_SString key (receiver_ref->marker ());
MAP_ITERATOR mi (this->map_);
// Try to locate an entry using its marker name (which should be
@@ -163,7 +164,7 @@ Notifier_i::subscribe (Event_Comm::Consumer *receiver_ref,
errno = EADDRINUSE;
ACE_ERROR ((LM_ERROR,
"duplicate entry for receiver %s with criteria \"%s\"",
- receiver_ref->_marker (),
+ receiver_ref->marker (),
filtering_criteria));
// Raise exception here???
return;
@@ -177,7 +178,7 @@ Notifier_i::subscribe (Event_Comm::Consumer *receiver_ref,
Consumer_Entry (receiver_ref,
filtering_criteria));
// Try to add new <Consumer_Entry> to the map.
- else if (this->map_.bind (key, nr_entry) == -1)
+ /*else*/ if (this->map_.bind (key, nr_entry) == -1)
{
// Prevent memory leaks.
delete nr_entry;
@@ -191,20 +192,20 @@ Notifier_i::subscribe (Event_Comm::Consumer *receiver_ref,
// Remove a receiver from the table.
void
-Notifier_i::unsubscribe (Event_Comm::Consumer *receiver_ref,
+Notifier_i::unsubscribe (Event_Comm::Consumer_ptr receiver_ref,
const char *filtering_criteria,
- CORBA::Environment &IT_env)
+ CORBA::Environment &TAO_TRY_ENV)
{
ACE_DEBUG ((LM_DEBUG,
"in Notifier_i::unsubscribe for %s\n",
- receiver_ref->_marker ()));
+ receiver_ref->marker ()));
Consumer_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 ());
+ key.rep ((char *) receiver_ref->marker ());
// Locate <Consumer_Entry> and free up resources. @@
// Note, we don't properly handle deallocation of KEYS!
@@ -217,14 +218,14 @@ Notifier_i::unsubscribe (Event_Comm::Consumer *receiver_ref,
{
ACE_DEBUG ((LM_DEBUG,
"removed entry %s with criteria \"%s\"\n",
- receiver_ref->_marker (),
+ 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 ()));
+ receiver_ref->marker ()));
else
delete nr_entry;
}
@@ -233,7 +234,7 @@ Notifier_i::unsubscribe (Event_Comm::Consumer *receiver_ref,
if (found == 0)
ACE_ERROR ((LM_ERROR,
"entry %s with criteria \"%s\" not found\n",
- receiver_ref->_marker (),
+ receiver_ref->marker (),
filtering_criteria));
}
@@ -241,7 +242,7 @@ Notifier_i::unsubscribe (Event_Comm::Consumer *receiver_ref,
void
Notifier_i::disconnect (const char *reason,
- CORBA::Environment &IT_env)
+ CORBA::Environment &TAO_TRY_ENV)
{
ACE_DEBUG ((LM_DEBUG,
"in Notifier_i::send_disconnect = %s\n",
@@ -254,24 +255,27 @@ Notifier_i::disconnect (const char *reason,
for (MAP_ENTRY *me = 0; mi.next (me) != 0; mi.advance ())
{
Event_Comm::Consumer *receiver_ref = me->int_id_->receiver ();
- ACE_ASSERT (receiver_ref->_marker () != 0);
+ ACE_ASSERT (receiver_ref->marker () != 0);
ACE_DEBUG ((LM_DEBUG,
"disconnecting client %s\n",
- receiver_ref->_marker ()));
- TRY
+ receiver_ref->marker ()));
+ TAO_TRY
{
- receiver_ref->disconnect (reason, IT_X);
+ receiver_ref->disconnect (reason, TAO_TRY_ENV);
}
- CATCHANY
+ TAO_CATCHANY
{
- cerr << "Unexpected exception " << IT_X << endl;
+ TAO_TRY_ENV.print_exception ("Unexpected exception\n");
}
- ENDTRY;
+ TAO_ENDTRY;
+
delete me->int_id_;
- delete me->ext_id_.rep ();
+ // delete me->ext_id_.rep ();
+ //@@ what is this? compile error.
count++;
}
+
this->map_.close ();
if (count == 1)
ACE_DEBUG ((LM_DEBUG,
@@ -286,11 +290,11 @@ Notifier_i::disconnect (const char *reason,
void
Notifier_i::push (const Event_Comm::Event &event,
- CORBA::Environment &IT_env)
+ CORBA::Environment &TAO_TRY_ENV)
{
ACE_DEBUG ((LM_DEBUG,
"in Notifier_i::send_notification = %s\n",
- notification.tag_));
+ event.tag_));
MAP_ITERATOR mi (this->map_);
int count = 0;
@@ -300,7 +304,7 @@ Notifier_i::push (const Event_Comm::Event &event,
for (MAP_ENTRY *me = 0; mi.next (me) != 0; mi.advance ())
{
Event_Comm::Consumer *receiver_ref = me->int_id_->receiver ();
- ACE_ASSERT (receiver_ref->_marker () != 0);
+ ACE_ASSERT (receiver_ref->marker () != 0);
const char *regexp = me->int_id_->regexp ();
const char *criteria = me->int_id_->criteria ();
ACE_ASSERT (regexp);
@@ -308,23 +312,24 @@ Notifier_i::push (const Event_Comm::Event &event,
// 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_OS::strcmp (event.tag_, regexp) == 0)
+ || ACE_OS::step (event.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
+ event.tag_, me->int_id_->criteria (),
+ receiver_ref->marker ()));
+ TAO_TRY
{
- receiver_ref->receive_notification (notification, IT_X);
+ receiver_ref->push (event, TAO_TRY_ENV);
+ TAO_CHECK_ENV;
}
- CATCHANY
+ TAO_CATCHANY
{
- cerr << "Unexpected exception " << IT_X << endl;
+ TAO_TRY_ENV.print_exception ("Unexpected exception\n");
continue;
}
- ENDTRY;
+ TAO_ENDTRY;
count++;
}
}
@@ -351,9 +356,9 @@ Consumer_i::~Consumer_i (void)
void
Consumer_i::push (const Event_Comm::Event &event,
- CORBA::Environment &IT_env)
+ CORBA::Environment &TAO_TRY_ENV)
{
- const char *tmpstr = notification.tag_;
+ const char *tmpstr = event.tag_;
ACE_DEBUG ((LM_DEBUG,
"**** got notification = %s\n",
@@ -365,7 +370,7 @@ Consumer_i::push (const Event_Comm::Event &event,
void
Consumer_i::disconnect (const char *reason,
- CORBA::Environment &IT_env)
+ CORBA::Environment &TAO_TRY_ENV)
{
ACE_DEBUG ((LM_DEBUG,
"**** got disconnected due to %s\n",
diff --git a/TAO/examples/Event_Comm/Event_Comm_i.h b/TAO/examples/Event_Comm/Event_Comm_i.h
index a68d3fb9c31..3ccf5191d88 100644
--- a/TAO/examples/Event_Comm/Event_Comm_i.h
+++ b/TAO/examples/Event_Comm/Event_Comm_i.h
@@ -24,8 +24,9 @@
#include "ace/Map_Manager.h"
#include "ace/Synch.h"
#include "ace/SString.h"
+#include "Event_CommS.h"
-class Consumer_i
+class Consumer_i : public POA_Event_Comm :: Consumer
{
// = TITLE
// Defines the implementation class for event <Consumers>.
@@ -37,12 +38,14 @@ public:
~Consumer_i (void);
// Destructor.
- virtual void push (const Event_Comm::Event &event,
- CORBA::Environment &IT_env);
+ virtual void push (
+ const Event_Comm::Event & event,
+ CORBA::Environment &TAO_TRY_ENV);
// Pass the <event> to the <Consumer>.
- virtual void disconnect (const char *reason,
- CORBA::Environment &IT_env);
+ virtual void disconnect (
+ const char * reason,
+ CORBA::Environment &TAO_TRY_ENV);
// Disconnect the <Consumer> from the <Notifier>,
// giving it the <reason>.
};
@@ -50,7 +53,7 @@ public:
// Forward reference.
class Consumer_Entry;
-class Notifier_i
+class Notifier_i : public POA_Event_Comm :: Notifier
{
// = TITLE
// Defines the implementation class for event <Notifiers>.
@@ -63,24 +66,25 @@ public:
Notifier_i (size_t size_hint = Notifier_i::DEFAULT_SIZE);
// Initialize a Notifier_i object with the specified size hint.
- void disconnect (const char *reason,
- CORBA::Environment &IT_env);
+ virtual void disconnect (const char *reason,
+ CORBA::Environment &TAO_TRY_ENV);
// Disconnect all the receivers, giving them the <reason>.
- void push (const Event_Comm::Event &event,
- CORBA::Environment &IT_env);
+ virtual void push (const Event_Comm::Event &event,
+ CORBA::Environment &TAO_TRY_ENV);
// Send the <event> to all the consumers who have subscribed
// and who match the filtering criteria.
- void subscribe (Event_Comm::Consumer *consumer,
- const char *filtering_criteria,
- CORBA::Environment &IT_env);
+ virtual void subscribe (
+ Event_Comm::Consumer_ptr Consumer,
+ const char * filtering_criteria,
+ CORBA::Environment &TAO_TRY_ENV);
// Subscribe the <Consumer> to receive events that match
// <filtering_criteria> applied by the <Notifier>.
- void unsubscribe (Event_Comm::Consumer *consumer,
+ void unsubscribe (Event_Comm::Consumer *consumer,
const char *filtering_criteria,
- CORBA::Environment &IT_env);
+ CORBA::Environment &TAO_TRY_ENV);
// Unsubscribe the <Consumer>.
private:
diff --git a/TAO/examples/Event_Comm/Makefile b/TAO/examples/Event_Comm/Makefile
index 5241bc3f727..6f5a4ffc51d 100644
--- a/TAO/examples/Event_Comm/Makefile
+++ b/TAO/examples/Event_Comm/Makefile
@@ -28,20 +28,25 @@ LSRC = $(IDL_SRC) $(PROG_SRCS)
CONSUMER_OBJS = Event_CommC.o \
Event_CommS.o \
- Consumer_Handler.o \
- Consumer_Input_Handler.o \
- Event_Comm_i.o
+ Consumer_Handler.o \
+ Consumer_Input_Handler.o \
+ Event_Comm_i.o \
+ consumer.o
SUPPLIER_OBJS = Event_CommC.o \
Event_CommS.o \
Supplier_Input_Handler.o \
- Event_Comm_i.o
+ Event_Comm_i.o \
+ Notifier_Handler.o \
+ supplier.o
NOTIFIER_OBJS = Notifier_Handler.o \
+ notifier.o
-BIN = consumer \
+BIN = supplier \
notifier \
- supplier
+ consumer
+
BUILD = $(BIN)
VLDLIBS = $(LDLIBS:%=%$(VAR))
VBIN = $(BIN:%=%$(VAR))
diff --git a/TAO/examples/Event_Comm/Notifier_Handler.cpp b/TAO/examples/Event_Comm/Notifier_Handler.cpp
index 5fedf385a0e..a3abcf5a6f2 100644
--- a/TAO/examples/Event_Comm/Notifier_Handler.cpp
+++ b/TAO/examples/Event_Comm/Notifier_Handler.cpp
@@ -36,17 +36,24 @@ Notifier_Handler::notifier (Event_Comm::Notifier *notifier)
}
}
-// Create and initialize a Notifier target object.
+Notifier_Handler::Notifier_Handler()
+{
+ // get the notifier from the naming service.
+}
+// Create and initialize a Notifier target object.
Notifier_Handler::Notifier_Handler (const char *service_location,
const char *marker,
int putit)
{
// Create a notifier object using the implementation class
// Notifier_i.
- ACE_NEW (this->notifier_,
+ /*ACE_NEW (this->notifier_,
TIE_Event_Comm_Notifier (Notifier_i) (new Notifier_i,
marker));
+ */
+ //@@ declare and orb and a notifir_var in the .h
+ // init the orb, register the object with the orb and the naming service
}
// Destroy a Notifier target object.
diff --git a/TAO/examples/Event_Comm/Notifier_Handler.h b/TAO/examples/Event_Comm/Notifier_Handler.h
index 1a7571a4e1e..e4b0ddd0b9a 100644
--- a/TAO/examples/Event_Comm/Notifier_Handler.h
+++ b/TAO/examples/Event_Comm/Notifier_Handler.h
@@ -25,9 +25,14 @@ class Notifier_Handler
// Integrate CORBA with the ACE ACE_Reactor.
{
public:
+ Notifier_Handler ();
+ // This constructor gets the notifier object from the Naming Service.
+
Notifier_Handler (const char *service_location,
const char *marker = "notifier",
int putit = 1); // Default marker name.
+ // This constructor starts up the ORB etc and
+ // registers the notifier object with the Naming Sxervice.
Event_Comm::Notifier *notifier (void);
void notifier (Event_Comm::Notifier *);
diff --git a/TAO/examples/Event_Comm/Supplier_Input_Handler.cpp b/TAO/examples/Event_Comm/Supplier_Input_Handler.cpp
index 3b8db05c62b..fba76cd857c 100644
--- a/TAO/examples/Event_Comm/Supplier_Input_Handler.cpp
+++ b/TAO/examples/Event_Comm/Supplier_Input_Handler.cpp
@@ -17,16 +17,17 @@ Supplier_Input_Handler::handle_close (ACE_HANDLE, ACE_Reactor_Mask)
ACE_OS::fclose (this->fp_);
- TRY
+ TAO_TRY
{
// Disconnect all the consumers gracefully.
- notifier->disconnect ("quit", IT_X);
+ notifier->disconnect ("quit", TAO_TRY_ENV);
+ TAO_CHECK_ENV;
}
- CATCHANY
+ TAO_CATCHANY
{
- cerr << IT_X << endl;
+ TAO_TRY_ENV.print_exception ("Error:Supplier_Input_Handler::handle_close\n ");
}
- ENDTRY;
+ TAO_ENDTRY;
// Don't execute a callback here otherwise we'll recurse
// indefinitely!
@@ -113,7 +114,7 @@ Supplier_Input_Handler::handle_input (ACE_HANDLE h)
else
{
// Use the notifier to notify Consumers.
- TRY
+ TAO_TRY
{
Event_Comm::Event event;
@@ -124,13 +125,14 @@ Supplier_Input_Handler::handle_input (ACE_HANDLE h)
// reference... event.value_ = ...
// Forward <Event> to all <Consumers>.
- notifier->push (event, IT_X);
+ notifier->push (event, TAO_TRY_ENV);
+ TAO_CHECK_ENV;
}
- CATCHANY
+ TAO_CATCHANY
{
- cerr << "unexpected exception " << IT_X << endl;
+ TAO_TRY_ENV.print_exception ("Unexpected Error\n");
}
- ENDTRY;
+ TAO_ENDTRY;
}
return 0;
}
diff --git a/TAO/examples/Event_Comm/Supplier_Input_Handler.h b/TAO/examples/Event_Comm/Supplier_Input_Handler.h
index 8f06be607f8..ded79677c6b 100644
--- a/TAO/examples/Event_Comm/Supplier_Input_Handler.h
+++ b/TAO/examples/Event_Comm/Supplier_Input_Handler.h
@@ -25,7 +25,7 @@
// Forward declaration.
class Notifier_Handler;
-class Input_Handler : public ACE_Service_Object
+class Supplier_Input_Handler : public ACE_Service_Object
{
// = TITLE
// Handles input events generated from a keyboard.
diff --git a/TAO/examples/Event_Comm/notifier.cpp b/TAO/examples/Event_Comm/notifier.cpp
index 0e7fa7803f0..a676f546e58 100644
--- a/TAO/examples/Event_Comm/notifier.cpp
+++ b/TAO/examples/Event_Comm/notifier.cpp
@@ -26,6 +26,8 @@ private:
Notifier_Handler *nh_;
// Handler for CORBA Notifier.
+
+ // Notifier_Input_Handler *ih_;
};
int
@@ -48,6 +50,7 @@ Notifier::handle_signal (int signum, siginfo_t *, ucontext_t *)
void
Notifier::run (void)
+
{
if (ACE_Reactor::run_event_loop () == -1)
ACE_ERROR ((LM_ERROR,
@@ -56,7 +59,7 @@ Notifier::run (void)
}
Notifier::Notifier (int argc, char *argv[])
- : ih_ (0),
+ : //ih_ (0),
nh_ (0)
{
ACE_DEBUG ((LM_DEBUG,
@@ -66,8 +69,8 @@ Notifier::Notifier (int argc, char *argv[])
ACE_NEW (this->nh_,
Notifier_Handler (argv[0],
"notifier"));
- ACE_NEW (this->ih_,
- Notifier_Input_Handler (this->nh_));
+ //ACE_NEW (this->ih_,
+ // Notifier_Input_Handler (this->nh_));
if (ACE_Reactor::instance ()->register_handler (SIGINT, this) == -1)
ACE_ERROR ((LM_ERROR,
diff --git a/TAO/examples/Event_Comm/supplier.cpp b/TAO/examples/Event_Comm/supplier.cpp
index 204ab7cb998..7cc760626c5 100644
--- a/TAO/examples/Event_Comm/supplier.cpp
+++ b/TAO/examples/Event_Comm/supplier.cpp
@@ -27,6 +27,9 @@ private:
Supplier_Input_Handler *ih_;
// Handler for keyboard input.
+
+ Notifier_Handler *nh_;
+ // The notifier handler.
};
int
@@ -62,6 +65,7 @@ Supplier::Supplier (int argc, char *argv[])
ACE_DEBUG ((LM_DEBUG,
"no config file, using static binding\n"));
+ ACE_NEW (this->nh_, Notifier_Handler());
ACE_NEW (this->ih_,
Supplier_Input_Handler (this->nh_));