source: trunk/tests/class_c/testnomobject.c

Last change on this file was 374, checked in by cinc, 17 years ago

Use idl file includes instead of class forward declarations in idl files. This way the necessary class include files are automatically included.

File size: 5.4 KB
Line 
1/* ***** BEGIN LICENSE BLOCK *****
2 * Version: CDDL 1.0/LGPL 2.1
3 *
4 * The contents of this file are subject to the COMMON DEVELOPMENT AND
5 * DISTRIBUTION LICENSE (CDDL) Version 1.0 (the "License"); you may not use
6 * this file except in compliance with the License. You may obtain a copy of
7 * the License at http://www.sun.com/cddl/
8 *
9 * Software distributed under the License is distributed on an "AS IS" basis,
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 * for the specific language governing rights and limitations under the
12 * License.
13 *
14 * The Original Code is "NOM" Netlabs Object Model
15 *
16 * The Initial Developer of the Original Code is
17 * netlabs.org: Chris Wohlgemuth <cinc-ml@netlabs.org>.
18 * Portions created by the Initial Developer are Copyright (C) 2007
19 * the Initial Developer. All Rights Reserved.
20 *
21 * Contributor(s):
22 *
23 * Alternatively, the contents of this file may be used under the terms of
24 * the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which
25 * case the provisions of the LGPL are applicable instead of those above. If
26 * you wish to allow use of your version of this file only under the terms of
27 * the LGPL, and not to allow others to use your version of this file under
28 * the terms of the CDDL, indicate your decision by deleting the provisions
29 * above and replace them with the notice and other provisions required by the
30 * LGPL. If you do not delete the provisions above, a recipient may use your
31 * version of this file under the terms of any one of the CDDL or the LGPL.
32 *
33 * ***** END LICENSE BLOCK ***** */
34
35/*
36 * And remember, phase 3 is near...
37 */
38#ifndef NOM_TestNomObject_IMPLEMENTATION_FILE
39#define NOM_TestNomObject_IMPLEMENTATION_FILE
40#endif
41
42#if __OS2__
43#define INCL_DOS
44#include <os2.h>
45#endif /* __OS2__ */
46
47#include <nom.h>
48#include <nomtk.h>
49
50#include "testnomobject.ih"
51
52
53NOMDLLEXPORT NOM_Scope CORBA_boolean NOMLINK impl_TestNomObject_test_nomQueryClassName(TestNomObject* nomSelf,
54 CORBA_Environment *ev)
55{
56 /* TestNomObjectData* nomThis = TestNomObjectGetData(nomSelf); */
57 CORBA_boolean nomRetval=FALSE;
58
59 for(;;)
60 {
61 if(0!=strcmp(_nomQueryClassName(nomSelf, NULL), "TestNomObject"))
62 break;
63
64 if(0!=strcmp(_nomQueryClassName((NOMObject*)_queryClassMgrObject(nomSelf, NULL), NULL), "NOMClassMgr"))
65 break;
66
67 nomRetval=TRUE;
68 break;
69 }
70
71 return nomRetval;
72}
73
74
75NOMDLLEXPORT NOM_Scope CORBA_boolean NOMLINK impl_TestNomObject_test_nomIsA(TestNomObject* nomSelf,
76 CORBA_Environment *ev)
77{
78 TestNomObjectData* nomThis = TestNomObjectGetData(nomSelf);
79 CORBA_boolean nomRetval=FALSE;
80
81 for(;;)
82 {
83 /* Because we call the method without a valid class there will be a warning message on the console */
84 g_message("In %s: The following warning is expected.", __FUNCTION__);
85 if(_nomIsA(nomSelf, NULL, NULL))
86 break;
87
88 if(!_nomIsA(nomSelf, _testCaseClass, NULL))
89 break;
90
91 if(!_nomIsA(nomSelf, _nomObjectClass, NULL))
92 break;
93
94 if(!_nomIsA(nomSelf, _nClass, NULL))
95 break;
96
97 nomRetval=TRUE;
98 break;
99 }
100 return nomRetval;
101}
102
103
104NOMDLLEXPORT NOM_Scope CORBA_boolean NOMLINK impl_TestNomObject_test_nomIsInstanceOf(TestNomObject* nomSelf,
105 CORBA_Environment *ev)
106{
107 TestNomObjectData* nomThis = TestNomObjectGetData(nomSelf);
108 CORBA_boolean nomRetval=FALSE;
109
110 for(;;)
111 {
112 /* Because we call the method without a valid class there will be a warning message on the console */
113 g_message("In %s: The following warning is expected.", __FUNCTION__);
114 if(_nomIsInstanceOf(nomSelf, NULL, NULL))
115 break;
116
117 if(_nomIsInstanceOf(nomSelf, _testCaseClass, NULL))
118 break;
119
120 if(_nomIsInstanceOf(nomSelf, _nomObjectClass, NULL))
121 break;
122
123 if(!_nomIsInstanceOf(nomSelf, _nClass, NULL))
124 break;
125
126 nomRetval=TRUE;
127 break;
128 }
129 return nomRetval;
130}
131
132
133NOMDLLEXPORT NOM_Scope CORBA_boolean NOMLINK impl_TestNomObject_test_testDataInit(TestNomObject* nomSelf,
134 CORBA_Environment *ev)
135{
136 TestNomObjectData* nomThis = TestNomObjectGetData(nomSelf);
137 CORBA_boolean nomRetval=FALSE;
138
139 for(;;)
140 {
141 if(NULL==_nClass)
142 break;
143
144 if(NULL==_testCaseClass)
145 break;
146
147 if(NULL==_nomObjectClass)
148 break;
149
150 nomRetval=TRUE;
151 break;
152 }
153
154 return nomRetval;
155}
156
157NOMDLLEXPORT NOM_Scope void NOMLINK impl_TestNomObject_setUp(TestNomObject* nomSelf,
158 CORBA_Environment *ev)
159{
160 TestNomObjectData* nomThis = TestNomObjectGetData(nomSelf);
161
162 /* call parent */
163 TestNomObject_setUp_parent(nomSelf, ev);
164
165 _nClass=_nomQueryClass(nomSelf, NULL);
166
167 if(NULL!=_queryClassMgrObject(nomSelf, NULL))
168 {
169 _testCaseClass=_nomFindClassFromName( _queryClassMgrObject(nomSelf, NULL), "NOMTestCase", 0, 0, NULL);
170 _nomObjectClass=_nomFindClassFromName( _queryClassMgrObject(nomSelf, NULL), "NOMObject", 0, 0, NULL);
171 }
172}
173
174NOMDLLEXPORT NOM_Scope void NOMLINK impl_TestNomObject_tearDown(TestNomObject* nomSelf,
175 CORBA_Environment *ev)
176{
177 TestNomObjectData* nomThis = TestNomObjectGetData(nomSelf);
178
179 _nClass=NULL;
180 _testCaseClass=NULL;
181 _nomObjectClass=NULL;
182
183 /* call parent */
184 TestNomObject_tearDown_parent(nomSelf, ev);
185}
Note: See TracBrowser for help on using the repository browser.