summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/examples/FaultTolerance/RolyPoly/RolyPoly_i.cpp
blob: 2115454097cc70c05242173e68ad844a1cde81f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// file      : RolyPoly/RolyPoly_i.cpp
// author    : Boris Kolpackov <boris@dre.vanderbilt.edu>
// cvs-id    : $Id$

#include "RolyPoly_i.h"
#include "StateUpdate.h"
#include "tao/AnyTypeCode/Any.h"

RolyPoly_i::RolyPoly_i (CORBA::ORB_ptr orb)
  : number_ (0)
  , orb_ (CORBA::ORB::_duplicate (orb))
{
}

RolyPoly_i::~RolyPoly_i (void)
{
}

CORBA::Any* RolyPoly_i::
get_state ()
{
  /*
  CORBA::Any_var state (new CORBA::Any);

  *state <<= this->number_;

  return state._retn ();
  */

  return 0;
}


void RolyPoly_i::
set_state (CORBA::Any const& state)
{
  state >>= this->number_;
}


CORBA::Short
RolyPoly_i::number (char *&str)
{
  CORBA::string_free (str);

  str = CORBA::string_dup ("Greetings from RolyPoly.");

  ++this->number_;


  // Preppare state update.
  //

  CORBA::Any a;

  a <<= this->number_;

  associate_state (orb_.in (), a);

  return this->number_;
}

void
RolyPoly_i::shutdown (void)
{
  ACE_DEBUG ((LM_DEBUG, "Server is shutting down.\n"));

  this->orb_->shutdown (0);
}