summaryrefslogtreecommitdiff
path: root/TAO/IIOP/test/cubit_i.cpp
blob: 31ca107132f585b7af57ae0acc92b70974e7b911 (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
// $Id$

// @(#)cubit_i.cpp 05/14/97
// Copyright 1994-1995 by Sun Microsystems Inc.
// All Rights Reserved
//
// TEST:	hand-written Cubit Implementation
//
// Modified version of Cubit Example written by Sun Microsystems Inc.
// Modified by: Brian Mendel

#include	"cubit_i.h"

#include	<corba/boa.h>    // ... and skeletons
#include	<corba/debug.h>  // ... and debugging

#include "connect.h"
#include "params.h"

ACE_RCSID(test, cubit_i, "$Id$")

Cubit_i::Cubit_i(const char* obj_name)
: _skel_Cubit(obj_name)
{
}

Cubit_i::~Cubit_i()
{
}

CORBA_Octet
Cubit_i::Cubit_cube_octet (CORBA_Octet       o,
                           CORBA_Environment &env)
{

   return (CORBA_Octet) (o * o * o);
}

CORBA_Short
Cubit_i::Cubit_cube_short (CORBA_Short       s, 
                           CORBA_Environment &env)
{
   return (CORBA_Short) (s * s * s);
}


CORBA_Long
Cubit_i::Cubit_cube_long (CORBA_Long        l,
                          CORBA_Environment &env)
{
   return (CORBA_Long) (l * l * l);
}

Cubit_Many*
Cubit_i::Cubit_cube_struct (Cubit_Many        &values,
                            CORBA_Environment &env)
{
   values.o = values.o * values.o * values.o;
   values.s = values.s * values.s * values.s;
   values.l = values.l * values.l * values.l;
   
   return &values;
}

Cubit_oneof*
Cubit_i::Cubit_cube_union (Cubit_oneof       &values,
                           CORBA_Environment &env)
{
   switch (values._disc) {
   case e_0th:
      values.o = (CORBA_Octet) (values.o * values.o * values.o);
      break;
   case e_1st:
      values.s = (CORBA_Short) (values.s * values.s * values.s);
      break;
   case e_2nd:
      values.l = values.l * values.l * values.l;
      break;
   case e_3rd:
   default:
      values.cm.o = (CORBA_Octet) (values.cm.o * values.cm.o * values.cm.o);
      values.cm.s = (CORBA_Short) (values.cm.s * values.cm.s * values.cm.s);
      values.cm.l = values.cm.l * values.cm.l * values.cm.l;
   }
   return &values;
}

void Cubit_i::Cubit_please_exit (CORBA_Environment &env)
{
   TAO_OA_Parameters* params = TAO_OA_PARAMS::instance();
   
   dmsg ("I've been asked to shut down...");
   params->oa()->please_shutdown(env);
   dexc (env, "please_exit, please_shutdown");
}