source: trunk/ORBit2-2.14.0/test/everything/lifeCycle.c

Last change on this file was 92, checked in by cinc, 19 years ago

Orbit2 modified for use with NOM

File size: 2.2 KB
Line 
1/*
2 * CORBA C language mapping tests
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2, or (at your option) any
7 * later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 *
18 * Author: Mark McLoughlin <mark@skynet.ie>
19 */
20
21#include "everything.h"
22
23static void
24LifeCycleServer_deactivateOnReturn (PortableServer_Servant servant,
25 CORBA_Environment *ev)
26{
27 PortableServer_ObjectId *oid;
28
29 oid = PortableServer_POA_servant_to_id (global_poa, servant, ev);
30 g_assert (ev->_major == CORBA_NO_EXCEPTION);
31
32 PortableServer_POA_deactivate_object (global_poa, oid, ev);
33 g_assert (ev->_major == CORBA_NO_EXCEPTION);
34
35 CORBA_free (oid);
36}
37
38static void
39LifeCycleServer_deactivateUnrefOnReturn (PortableServer_Servant servant,
40 CORBA_Environment *ev)
41{
42 CORBA_Object self_ref;
43
44 /* Will only 'work' in-proc */
45 PortableServer_ObjectId *oid;
46
47 oid = PortableServer_POA_servant_to_id (global_poa, servant, ev);
48 g_assert (ev->_major == CORBA_NO_EXCEPTION);
49
50 PortableServer_POA_deactivate_object (global_poa, oid, ev);
51 g_assert (ev->_major == CORBA_NO_EXCEPTION);
52
53 CORBA_free (oid);
54
55 self_ref = PortableServer_POA_servant_to_reference (global_poa, servant, ev);
56 g_assert (ev->_major == CORBA_NO_EXCEPTION);
57
58 CORBA_Object_release (self_ref, ev);
59 CORBA_Object_release (self_ref, ev);
60}
61
62static POA_test_LifeCycleServer__epv LifeCycleServer_epv = {
63 NULL,
64 LifeCycleServer_deactivateOnReturn,
65 LifeCycleServer_deactivateUnrefOnReturn
66};
67
68static PortableServer_ServantBase__epv LifeCycleServer_base_epv = {
69 NULL,
70 simple_finalize,
71 NULL
72};
73static POA_test_LifeCycleServer__vepv LifeCycleServer_vepv = {
74 &LifeCycleServer_base_epv,
75 &LifeCycleServer_epv
76};
Note: See TracBrowser for help on using the repository browser.