File: structServer.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 (104 lines) | stat: -rw-r--r-- 3,212 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
/*
 * 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  
test_FixedLengthStruct
StructServer_opFixed(PortableServer_Servant _servant,
					 const test_FixedLengthStruct *inArg,
					 test_FixedLengthStruct *inoutArg,
					 test_FixedLengthStruct *outArg,
					 CORBA_Environment * ev){
  test_FixedLengthStruct retval;
  g_assert(inArg->a == constants_SHORT_IN);
  g_assert(inoutArg->a == constants_SHORT_INOUT_IN);
  
  inoutArg->a = constants_SHORT_INOUT_OUT;
  outArg->a = constants_SHORT_OUT;
  retval.a = constants_SHORT_RETN;
  return retval;
}



static  
test_VariableLengthStruct*
StructServer_opVariable(PortableServer_Servant _servant,
					 const test_VariableLengthStruct *inArg,
					 test_VariableLengthStruct *inoutArg,
					 test_VariableLengthStruct **outArg,
					 CORBA_Environment * ev){
  test_VariableLengthStruct *retval;
  g_assert(strcmp(inArg->a,constants_STRING_IN) == 0);
  g_assert(strcmp(inoutArg->a,constants_STRING_INOUT_IN)==0);
  
  *outArg = test_VariableLengthStruct__alloc();
  retval = test_VariableLengthStruct__alloc();
  
  CORBA_free(inoutArg->a);

  inoutArg->a = CORBA_string_dup(constants_STRING_INOUT_OUT);
  (*outArg)->a = CORBA_string_dup(constants_STRING_OUT);
  retval->a = CORBA_string_dup(constants_STRING_RETN);
  
  return retval;
}


static  
test_CompoundStruct*
StructServer_opCompound(PortableServer_Servant _servant,
					 const test_CompoundStruct *inArg,
					 test_CompoundStruct *inoutArg,
					 test_CompoundStruct **outArg,
					 CORBA_Environment * ev){
  test_CompoundStruct *retval;
  g_assert(strcmp(inArg->a.a,constants_STRING_IN) == 0);
  g_assert(strcmp(inoutArg->a.a,constants_STRING_INOUT_IN)==0);
  
  *outArg = test_CompoundStruct__alloc();
  retval = test_CompoundStruct__alloc();
  
  CORBA_free(inoutArg->a.a);

  inoutArg->a.a = CORBA_string_dup(constants_STRING_INOUT_OUT);
  (*outArg)->a.a = CORBA_string_dup(constants_STRING_OUT);
  retval->a.a = CORBA_string_dup(constants_STRING_RETN);
  
  return retval;
}


PortableServer_ServantBase__epv StructServer_base_epv = {NULL,NULL,NULL};

POA_test_StructServer__epv StructServer_epv = {
  NULL,
  StructServer_opFixed,
  StructServer_opVariable,
  StructServer_opCompound,
};

POA_test_StructServer__vepv StructServer_vepv = {&StructServer_base_epv,&StructServer_epv};

POA_test_StructServer StructServer_servant = {NULL,&StructServer_vepv};  /* Singleton */