summaryrefslogtreecommitdiff
path: root/TAO/performance-tests/Cubit/Hardpack/IDL_Cubit/cubit_impl.cc
blob: 24e38720f87ce82512119417da53d4c943ca8568 (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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
// $Id$
#include "cubit_impl.hh"

// This file is a skeleton of the implementation of the _impl class.


//============== Cubit implementation ==============
Cubit_impl::Cubit_impl() : _sk_Cubit(0) {
// Do not change the signature for this constructor

}

Cubit_impl::~Cubit_impl() {

}

void Cubit_impl::cube_oneway(
  ) {
}


void Cubit_impl::cube_void(
  ) {
}

CORBA::Octet Cubit_impl::cube_octet(
          CORBA::Octet o
  ) {
    return o * o * o;
}


CORBA::Short Cubit_impl::cube_short(
          CORBA::Short s
  ) {
  return s * s * s;
}


CORBA::Long Cubit_impl::cube_long(
          CORBA::Long l
  ) {
  return l * l * l;
}


Cubit::Many Cubit_impl::cube_struct(
          const Cubit::Many& values
  ) {
  Cubit::Many temp;

  temp.o = values.o * values.o * values.o;
  temp.s = values.s * values.s * values.s;
  temp.l = values.l * values.l * values.l;

  return temp;

}

// Cubit::oneof Cubit_impl::cube_union(
//           const Cubit::oneof& values
//   ) {
//   Cubit::oneof temp;

//   ACE_UNUSED_ARG (env);
//   switch (values._d ())
//     {
//     case Cubit::e_0th:
//       temp.o (values.o () * values.o () * values.o ());
//       break;
//     case Cubit::e_1st:
//       temp.s (values.s () * values.s () * values.s ());
//       break;
//     case Cubit::e_2nd:
//       temp.l (values.l () * values.l () * values.l ());
//       break;
//     case Cubit::e_3rd:
//     default:
//       temp._d (values._d ()); // set the discriminant
//       // use the read/write accessor
//       temp.cm ().o  = values.cm ().o * values.cm ().o * values.cm ().o;
//       temp.cm ().s  = values.cm ().s * values.cm ().s * values.cm ().s;
//       temp.cm ().l  = values.cm ().l * values.cm ().l * values.cm ().l;

//     }
//   return temp;
// }

void Cubit_impl::cube_long_sequence(
          const Cubit::long_seq& input,
         Cubit::long_seq*& output
  ) {

  if (output == 0)
    output = new Cubit::long_seq (input.length ());

  output->length (input.length ());
  CORBA::ULong i = 0;
  CORBA::Long x = input[0];
  output[i] = x * x * x;

}


void Cubit_impl::cube_octet_sequence(
          const Cubit::octet_seq& input,
         Cubit::octet_seq*& output
  ) {
  if (output == 0)
    {
      output = new Cubit::octet_seq (input.length ());
    }
  // We don't want to cube all the elements on the sequence because
  // that will take too long and will affect the performance. Further,
  // we want to show that octet sequences have constant marshalling
  // time, but making a copy of each element will hide that.
  CORBA::ULong i = 0;
  CORBA::Octet x = input[0];
  output[i] = x * x * x;

}


void Cubit_impl::shutdown(
  ) {

}



// //============== Cubit_Shutdown implementation ==============
// Cubit_Shutdown_impl::Cubit_Shutdown_impl() : _sk_Cubit_Shutdown(0) {
// // Do not change the signature for this constructor

// }

// Cubit_Shutdown_impl::~Cubit_Shutdown_impl() {

// }

// void Cubit_Shutdown_impl::shutdown(
//   ) {

// }



// //============== Cubit_Factory implementation ==============
// Cubit_Factory_impl::Cubit_Factory_impl() : _sk_Cubit_Factory(0) {
// // Do not change the signature for this constructor

// }

// Cubit_Factory_impl::~Cubit_Factory_impl() {

// }

// Cubit_ptr Cubit_Factory_impl::make_cubit(
//   ) {
//   return this->my_cubit_;
// }