Merge pull request #2258 from likema/log-msg-reset-ostream
[ACE_TAO.git] / TAO / orbsvcs / examples / FaultTolerance / RolyPoly / RolyPoly_i.cpp
blob35c4ad95c2152acda31cf1e1ef19c144d27ab65f
1 // file : RolyPoly/RolyPoly_i.cpp
2 // author : Boris Kolpackov <boris@dre.vanderbilt.edu>
3 #include "RolyPoly_i.h"
4 #include "StateUpdate.h"
5 #include "tao/AnyTypeCode/Any.h"
7 RolyPoly_i::RolyPoly_i (CORBA::ORB_ptr orb)
8 : number_ (0)
9 , orb_ (CORBA::ORB::_duplicate (orb))
13 CORBA::Any* RolyPoly_i::
14 get_state ()
17 CORBA::Any_var state (new CORBA::Any);
19 *state <<= this->number_;
21 return state._retn ();
24 return 0;
28 void RolyPoly_i::
29 set_state (CORBA::Any const& state)
31 state >>= this->number_;
35 CORBA::Short
36 RolyPoly_i::number (char *&str)
38 CORBA::string_free (str);
40 str = CORBA::string_dup ("Greetings from RolyPoly.");
42 ++this->number_;
45 // Preppare state update.
48 CORBA::Any a;
50 a <<= this->number_;
52 associate_state (orb_.in (), a);
54 return this->number_;
57 void
58 RolyPoly_i::shutdown ()
60 ACE_DEBUG ((LM_DEBUG, "Server is shutting down.\n"));
62 this->orb_->shutdown (false);