File: basicServer.c

package info (click to toggle)
orbit 0.5.16-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 6,680 kB
  • ctags: 7,029
  • sloc: ansic: 59,686; sh: 7,412; yacc: 1,751; makefile: 831; lex: 366; sed: 93
file content (130 lines) | stat: -rw-r--r-- 3,606 bytes parent folder | download | duplicates (3)
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
/*
 * CORBA C language mapping tests
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2, or (at your option) any
 * later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 *
 * Author: Phil Dawes <philipd@users.sourceforge.net>
 */

#include "everything.h"
#include "constants.h"
#include <stdio.h>

static
CORBA_char *
BasicServer__get_foo(PortableServer_Servant servant,
					 CORBA_Environment *ev) {
  return CORBA_string_dup(constants_STRING_RETN);  
}


static
void
BasicServer__set_foo(PortableServer_Servant servant,
					 const CORBA_char *val,
					 CORBA_Environment *ev) {
  g_assert(strcmp(val,constants_STRING_IN)==0);
}

static
CORBA_long
BasicServer__get_bah(PortableServer_Servant servant,
					 CORBA_Environment *ev) {
  return constants_LONG_RETN;
}


static  
CORBA_char *
BasicServer_opString(PortableServer_Servant servant,
					 const CORBA_char* inArg, 
					 CORBA_char **inoutArg,
					 CORBA_char **outArg,
					 CORBA_Environment *ev) {
  g_assert(strcmp(inArg,constants_STRING_IN)==0);
  g_assert(strcmp(*inoutArg,constants_STRING_INOUT_IN)==0);
  
  CORBA_free(*inoutArg);
  *inoutArg = CORBA_string_dup(constants_STRING_INOUT_OUT);
  *outArg = CORBA_string_dup(constants_STRING_OUT);
  return CORBA_string_dup(constants_STRING_RETN);
}

static  
CORBA_long
BasicServer_opLong(PortableServer_Servant servant,
					 const CORBA_long inArg, 
					 CORBA_long *inoutArg,
					 CORBA_long *outArg,
					 CORBA_Environment *ev) {
  g_assert(inArg == constants_LONG_IN);
  g_assert(*inoutArg == constants_LONG_INOUT_IN);
  
  *inoutArg = constants_LONG_INOUT_OUT;
  *outArg = constants_LONG_OUT;;
  return constants_LONG_RETN;
}

static  
test_AnEnum
BasicServer_opEnum(PortableServer_Servant servant,
					 const test_AnEnum inArg, 
					 test_AnEnum *inoutArg,
					 test_AnEnum *outArg,
					 CORBA_Environment *ev) {
  g_assert(inArg == test_ENUM_IN);
  g_assert(*inoutArg == test_ENUM_INOUT_IN);
  
  *inoutArg = test_ENUM_INOUT_OUT;
  *outArg = test_ENUM_OUT;
  return test_ENUM_RETN;

}

static  
void
BasicServer_opException(PortableServer_Servant servant,
				   CORBA_Environment *ev) {
  test_TestException *ex = test_TestException__alloc();
  ex->reason=CORBA_string_dup(constants_STRING_IN);
  ex->number = constants_LONG_IN;
  ex->aseq._buffer = CORBA_sequence_CORBA_long_allocbuf(1);
  ex->aseq._length = 1;
  ex->aseq._buffer[0] = constants_LONG_IN;
  CORBA_sequence_set_release(&ex->aseq, CORBA_TRUE);
  ex->factory = getFactoryInstance(ev);

  CORBA_exception_set(ev,CORBA_USER_EXCEPTION,ex_test_TestException,ex);
}



PortableServer_ServantBase__epv BasicServer_base_epv = {NULL,NULL,NULL};

POA_test_BasicServer__epv BasicServer_epv = {
  NULL,
  BasicServer__get_foo,
  BasicServer__set_foo,
  BasicServer__get_bah,
  BasicServer_opString,
  BasicServer_opLong,
  BasicServer_opEnum,
  BasicServer_opException,
};

POA_test_BasicServer__vepv BasicServer_vepv = {&BasicServer_base_epv,&BasicServer_epv};

POA_test_BasicServer BasicServer_servant = {NULL,&BasicServer_vepv};  /* Singleton */