summaryrefslogtreecommitdiff
path: root/TAO/tests/OBV/Simple/Server_i.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/tests/OBV/Simple/Server_i.cpp')
-rw-r--r--TAO/tests/OBV/Simple/Server_i.cpp80
1 files changed, 80 insertions, 0 deletions
diff --git a/TAO/tests/OBV/Simple/Server_i.cpp b/TAO/tests/OBV/Simple/Server_i.cpp
new file mode 100644
index 00000000000..a429ce1bc3a
--- /dev/null
+++ b/TAO/tests/OBV/Simple/Server_i.cpp
@@ -0,0 +1,80 @@
+// $Id$
+
+#include "Server_i.h"
+#include "OBV_impl.h"
+#include "tao/ORB_Core.h"
+
+// Set the ORB pointer, register OBV factories and init the
+// lists declared above.
+
+void
+Checkpoint_i::orb (CORBA::ORB_ptr o)
+{
+ this->orb_ = CORBA::ORB::_duplicate (o);
+
+ TAO_OBV_REGISTER_FACTORY (Event_factory, Event);
+}
+
+
+// Sidebar on assignment from pointer to _var type.
+//
+// Event_var e_var (event);
+// This is fatal because the reference counter in *event is not increased
+// when a pointer is assigned to a _var. (This happens only
+// in assignments from another Event_var;
+// But Assignment from new is fine, the referencecount is yet one.)
+//
+// ok is
+// CORBA::add_ref (event);
+// Event_var e_var (event);
+//
+// but possibly easier to read it a macro
+#define DUP_REF(vt_ptr) (CORBA::add_ref (vt_ptr), vt_ptr)
+// then it reads: Event_var e_var (DUP_REF (event));
+// (But it may cause desaster if vt_ptr is a function call.)
+//
+// Be careful with assignments from T1_var to T2_var, if T1 and T2 are
+// related through inheritance. Because there are many implicit casts
+// between pointer and _var types possible, the reference counter of
+// the duplicated reference is not increased.
+//
+// Is there any general solution with faulty reference counting ?
+
+
+void
+Checkpoint_i::put_event (Event *event
+ ACE_ENV_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ // Let us see what event has arrived
+ event->do_print ();
+
+ return;
+}
+
+// Shutdown the server application.
+
+void
+Checkpoint_i::shutdown (ACE_ENV_SINGLE_ARG_DECL_NOT_USED)
+ ACE_THROW_SPEC ((CORBA::SystemException))
+{
+ ACE_DEBUG ((LM_DEBUG,
+ "\n%s\n",
+ "The Checkpoint server is shutting down"));
+
+ // Instruct the ORB to shutdown.
+ this->orb_->shutdown ();
+}
+
+
+// Constructor.
+
+Checkpoint_i::Checkpoint_i (void)
+{
+}
+
+// Destructor.
+
+Checkpoint_i::~Checkpoint_i (void)
+{
+}