1
2
3 #include "aufgabe2.h"
4
5
6 using namespace std;
7
8
9
10
11
12
13
14 Aufgabe2::Server::~Server()
15 {
16 }
17
18 void *
19 Aufgabe2::Server::_narrow_helper( const char *_repoid )
20 {
21 if( strcmp( _repoid, "IDL:Aufgabe2/Server:1.0" ) == 0 )
22 return (void *)this;
23 return NULL;
24 }
25
26 Aufgabe2::Server_ptr
Aufgabe2::Server::_narrow( CORBA::Object_ptr _obj )
27 {
28 Aufgabe2::Server_ptr _o;
29 if( !CORBA::is_nil( _obj ) ) {
30 void *_p;
31 if( (_p = _obj->_narrow_helper( "IDL:Aufgabe2/Server:1.0" )))
32 return _duplicate( (Aufgabe2::Server_ptr) _p );
33 if (!strcmp (_obj->_repoid(), "IDL:Aufgabe2/Server:1.0") || _obj->_is_a_remote ("IDL:Aufgabe2/Server:1.0")) {
34 _o = new Aufgabe2::Server_stub;
35 _o->MICO_SCOPE(CORBA,Object::operator=)( *_obj );
36 return _o;
37 }
38 }
39 return _nil();
40 }
41
42 Aufgabe2::Server_ptr
Aufgabe2::Server::_narrow( CORBA::AbstractBase_ptr _obj )
43 {
44 return _narrow (_obj->_to_object());
45 }
46
47 class _Marshaller_Aufgabe2_Server : public CORBA::StaticTypeInfo {
48 typedef Aufgabe2::Server_ptr _MICO_T;
49 public:
50 StaticValueType create () const;
51 void assign (StaticValueType dst, const StaticValueType src) const;
52 void free (StaticValueType) const;
53 void release (StaticValueType) const;
54 CORBA::Boolean demarshal (CORBA::DataDecoder&, StaticValueType) const;
55 void marshal (CORBA::DataEncoder &, StaticValueType) const;
56 };
57
58
59 CORBA::StaticValueType _Marshaller_Aufgabe2_Server::create() const
{
60 return (StaticValueType) new _MICO_T( 0 );
61 }
62
63 void _Marshaller_Aufgabe2_Server::assign( StaticValueType d, const StaticValueType s ) const
{
64 *(_MICO_T*) d = ::Aufgabe2::Server::_duplicate( *(_MICO_T*) s );
65 }
66
67 void _Marshaller_Aufgabe2_Server::free( StaticValueType v ) const
{
68 CORBA::release( *(_MICO_T *) v );
69 delete (_MICO_T*) v;
70 }
71
72 void _Marshaller_Aufgabe2_Server::release( StaticValueType v ) const
{
73 CORBA::release( *(_MICO_T *) v );
74 }
75
76 CORBA::Boolean _Marshaller_Aufgabe2_Server::demarshal( CORBA::DataDecoder &dc, StaticValueType v ) const
{
77 CORBA::Object_ptr obj;
78 if (!CORBA::_stc_Object->demarshal(dc, &obj))
79 return FALSE;
80 *(_MICO_T *) v = ::Aufgabe2::Server::_narrow( obj );
81 CORBA::Boolean ret = CORBA::is_nil (obj) || !CORBA::is_nil (*(_MICO_T *)v);
82 CORBA::release (obj);
83 return ret;
84 }
85
86 void _Marshaller_Aufgabe2_Server::marshal( CORBA::DataEncoder &ec, StaticValueType v ) const
{
87 CORBA::Object_ptr obj = *(_MICO_T *) v;
88 CORBA::_stc_Object->marshal( ec, &obj );
89 }
90
91 CORBA::StaticTypeInfo *_marshaller_Aufgabe2_Server;
92
93
94
95
96 Aufgabe2::Server_stub::~Server_stub()
97 {
98 }
99
100 #ifndef MICO_CONF_NO_POA
101
102 void *
103 POA_Aufgabe2::Server::_narrow_helper (const char * repoid)
104 {
105 if (strcmp (repoid, "IDL:Aufgabe2/Server:1.0") == 0) {
106 return (void *) this;
107 }
108 return NULL;
109 }
110
111 POA_Aufgabe2::Server *
112 POA_Aufgabe2::Server::_narrow (PortableServer::Servant serv)
113 {
114 void * p;
115 if ((p = serv->_narrow_helper ("IDL:Aufgabe2/Server:1.0")) != NULL) {
116 serv->_add_ref ();
117 return (POA_Aufgabe2::Server *) p;
118 }
119 return NULL;
120 }
121
122 Aufgabe2::Server_stub_clp::Server_stub_clp ()
123 {
124 }
125
126 Aufgabe2::Server_stub_clp::Server_stub_clp (PortableServer::POA_ptr poa, CORBA::Object_ptr obj)
127 : MICO_SCOPE(PortableServer,StubBase) (poa), MICO_SCOPE(CORBA,Object) (*obj)
128 {
129 }
130
131 Aufgabe2::Server_stub_clp::~Server_stub_clp ()
132 {
133 }
134
135 #endif // MICO_CONF_NO_POA
136
137 char* Aufgabe2::Server_stub::reverse( const char* _par_message )
138 {
139 CORBA::StaticAny _sa_message( CORBA::_stc_string, &_par_message );
140 char* _res;
141 CORBA::StaticAny __res( CORBA::_stc_string, &_res );
142
143 CORBA::StaticRequest __req( this, "reverse" );
144 __req.add_in_arg( &_sa_message );
145 __req.set_result( &__res );
146
147 __req.invoke();
148
149 mico_sii_throw( &__req,
150 0);
151 return _res;
152 }
153
154
155 #ifndef MICO_CONF_NO_POA
156
157 char*
158 Aufgabe2::Server_stub_clp::reverse( const char* _par_message )
159 {
160 PortableServer::Servant _serv = _preinvoke ();
161 if (_serv) {
162 POA_Aufgabe2::Server * _myserv = POA_Aufgabe2::Server::_narrow (_serv);
163 if (_myserv) {
164 char* __res;
165
166 #ifdef HAVE_EXCEPTIONS
167 try {
168 #endif
169 __res = _myserv->reverse(_par_message);
170 #ifdef HAVE_EXCEPTIONS
171 }
172 catch (...) {
173 _myserv->_remove_ref();
174 _postinvoke();
175 throw;
176 }
177 #endif
178
179 _myserv->_remove_ref();
180 _postinvoke ();
181 return __res;
182 }
183 _postinvoke ();
184 }
185
186 typedef Aufgabe2::Server_stub _VCHACK__classname;
187 return _VCHACK__classname::reverse(_par_message);
188 }
189
190 #endif // MICO_CONF_NO_POA
191
192 struct __tc_init_AUFGABE2 {
193 __tc_init_AUFGABE2()
194 {
195 _marshaller_Aufgabe2_Server = new _Marshaller_Aufgabe2_Server;
196 }
197 };
198
199 static __tc_init_AUFGABE2 __init_AUFGABE2;
200
201
202
203
204
205
206 POA_Aufgabe2::Server::~Server()
207 {
208 }
209
210 ::Aufgabe2::Server_ptr
POA_Aufgabe2::Server::_this ()
211 {
212 CORBA::Object_var obj = MICO_SCOPE(PortableServer,ServantBase::_this) ();
213 return ::Aufgabe2::Server::_narrow (obj);
214 }
215
216 CORBA::Boolean
POA_Aufgabe2::Server::_is_a (const char * repoid)
217 {
218 if (strcmp (repoid, "IDL:Aufgabe2/Server:1.0") == 0) {
219 return TRUE;
220 }
221 return FALSE;
222 }
223
224 CORBA::InterfaceDef_ptr
POA_Aufgabe2::Server::_get_interface ()
225 {
226 CORBA::InterfaceDef_ptr ifd = MICO_SCOPE(PortableServer,ServantBase)::_get_interface ("IDL:Aufgabe2/Server:1.0");
227
228 if (CORBA::is_nil (ifd)) {
229 mico_throw (CORBA::OBJ_ADAPTER (0, CORBA::COMPLETED_NO));
230 }
231
232 return ifd;
233 }
234
235 CORBA::RepositoryId
POA_Aufgabe2::Server::_primary_interface (const PortableServer::ObjectId &, PortableServer::POA_ptr)
236 {
237 return CORBA::string_dup ("IDL:Aufgabe2/Server:1.0");
238 }
239
240 CORBA::Object_ptr
POA_Aufgabe2::Server::_make_stub (PortableServer::POA_ptr poa, CORBA::Object_ptr obj)
241 {
242 return new ::Aufgabe2::Server_stub_clp (poa, obj);
243 }
244
245 bool
POA_Aufgabe2::Server::dispatch (CORBA::StaticServerRequest_ptr __req)
246 {
247 #ifdef HAVE_EXCEPTIONS
248 try {
249 #endif
250 if( strcmp( __req->op_name(), "reverse" ) == 0 ) {
251 CORBA::String_var _par_message;
252 CORBA::StaticAny _sa_message( CORBA::_stc_string, &_par_message._for_demarshal() );
253
254 char* _res;
255 CORBA::StaticAny __res( CORBA::_stc_string, &_res );
256 __req->add_in_arg( &_sa_message );
257 __req->set_result( &__res );
258
259 if( !__req->read_args() )
260 return true;
261
262 _res = reverse( _par_message.inout() );
263 __req->write_results();
264 CORBA::string_free( _res );
265 return true;
266 }
267 #ifdef HAVE_EXCEPTIONS
268 } catch( CORBA::SystemException_catch &_ex ) {
269 __req->set_exception( _ex->_clone() );
270 __req->write_results();
271 return true;
272 } catch( ... ) {
273 CORBA::UNKNOWN _ex (CORBA::OMGVMCID | 1, CORBA::COMPLETED_MAYBE);
274 __req->set_exception (_ex->_clone());
275 __req->write_results ();
276 return true;
277 }
278 #endif
279
280 return false;
281 }
282
283 void
POA_Aufgabe2::Server::invoke (CORBA::StaticServerRequest_ptr __req)
284 {
285 if (dispatch (__req)) {
286 return;
287 }
288
289 CORBA::Exception * ex =
290 new CORBA::BAD_OPERATION (0, CORBA::COMPLETED_NO);
291 __req->set_exception (ex);
292 __req->write_results();
293 }
294
295
296