summaryrefslogtreecommitdiff
path: root/ACE/TAO/tests/CSD_Strategy_Tests/TP_Foo_C/Foo_C_i.cpp
blob: d9e11bfad32a979ddf1ca03fdf66e6a11215e173 (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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
// $Id$
#include "Foo_C_i.h"
#include "AppShutdown.h"
#include "CustomExceptionC.h"


Foo_C_i::Foo_C_i()
{
  for (unsigned i = 0; i < 10; i++)
    {
      this->count_[i] = 0;
    }
}


Foo_C_i::~Foo_C_i()
{
}


void
Foo_C_i::op1(void)
{
  ++this->count_[0];
}


void
Foo_C_i::op2(CORBA::Long value)
{
  this->in_values_[1].push_back (value);
  ++this->count_[1];
}


CORBA::Long
Foo_C_i::op3(CORBA::Long value)
{
  this->in_values_[2].push_back (value);
  ++this->count_[2];
  return value;
}


void
Foo_C_i::op4(CORBA::Long value)
{
  this->in_values_[3].push_back (value);
  ++this->count_[3];
}


void
Foo_C_i::op5(void)
{
  ++this->count_[4];
  throw FooException();
}


void
Foo_C_i::done(void)
{
  TheAppShutdown->client_done();
}


void
Foo_C_i::cust_op1(void)
{
  ++this->count_[5];
}


void
Foo_C_i::cust_op2(long value)
{
  this->in_values_[6].push_back (value);
  ++this->count_[6];
}


long
Foo_C_i::cust_op3(long value)
{
  this->in_values_[7].push_back (value);
  ++this->count_[7];
  return value;
}


void
Foo_C_i::cust_op4(long value)
{
  this->in_values_[8].push_back (value);
  ++this->count_[8];
}


void
Foo_C_i::cust_op5(void)
{
  ++this->count_[9];
  throw CustomException();
}


void
Foo_C_i::gather_stats(Foo_C_Statistics& stats)
{
  for (unsigned i = 0; i < 10; i++)
    {
      stats.actual (i + 1, this->count_[i]);
      stats.actual_in_values (i + 1, this->in_values_[i]);
    }
}


void
Foo_C_i::dump()
{
  static unsigned id = 0;

  ++id;

  ACE_DEBUG((LM_DEBUG, "Servant %d Stats:\n", id));
  ACE_DEBUG((LM_DEBUG, "------------------\n"));

  unsigned i;

  for (i = 0; i < 5; i++)
    {
      ACE_DEBUG((LM_DEBUG, "op%d     : %d\n", i+1, this->count_[i]));
    }

  for (i = 5; i < 10; i++)
    {
      ACE_DEBUG((LM_DEBUG, "cust_op%d: %d\n", i+1, this->count_[i]));
    }

  ACE_DEBUG((LM_DEBUG, "------------------\n"));
}