Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / tests / OBV / Simple / Server_i.cpp
blob602d0f9efab466cc40e4a624709069e6a01b19bb
1 #include "Server_i.h"
2 #include "OBV_impl.h"
3 #include "tao/ORB_Core.h"
5 // Set the ORB pointer, register OBV factories and init the
6 // lists declared above.
8 void
9 Checkpoint_i::orb (CORBA::ORB_ptr o)
11 this->orb_ = CORBA::ORB::_duplicate (o);
13 TAO_OBV_REGISTER_FACTORY (Event_factory, Event);
17 // Sidebar on assignment from pointer to _var type.
19 // Event_var e_var (event);
20 // This is fatal because the reference counter in *event is not increased
21 // when a pointer is assigned to a _var. (This happens only
22 // in assignments from another Event_var;
23 // But Assignment from new is fine, the referencecount is yet one.)
25 // ok is
26 // CORBA::add_ref (event);
27 // Event_var e_var (event);
29 // but possibly easier to read it a macro
30 #define DUP_REF(vt_ptr) (CORBA::add_ref (vt_ptr), vt_ptr)
31 // then it reads: Event_var e_var (DUP_REF (event));
32 // (But it may cause desaster if vt_ptr is a function call.)
34 // Be careful with assignments from T1_var to T2_var, if T1 and T2 are
35 // related through inheritance. Because there are many implicit casts
36 // between pointer and _var types possible, the reference counter of
37 // the duplicated reference is not increased.
39 // Is there any general solution with faulty reference counting ?
42 void
43 Checkpoint_i::put_event (Event *event)
45 // Let us see what event has arrived
46 event->do_print ();
49 // Shutdown the server application.
51 void
52 Checkpoint_i::shutdown ()
54 ACE_DEBUG ((LM_DEBUG,
55 "\nThe Checkpoint server is shutting down\n"));
57 // Instruct the ORB to shutdown.
58 this->orb_->shutdown ();
61 // Constructor.
62 Checkpoint_i::Checkpoint_i ()
66 // Destructor.
67 Checkpoint_i::~Checkpoint_i ()