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
27 Aufgabe2::Server::_narrow( CORBA::Object_ptr _obj )
28 {
29 Aufgabe2::Server_ptr _o;
30 if( !CORBA::is_nil( _obj ) ) {
31 void *_p;
32 if( (_p = _obj->_narrow_helper( "IDL:Aufgabe2/Server:1.0" )))
33 return _duplicate( (Aufgabe2::Server_ptr) _p );
34 if (!strcmp (_obj->_repoid(), "IDL:Aufgabe2/Server:1.0") || _obj->_is_a_remote ("IDL:Aufgabe2/Server:1.0")) {
35 _o = new Aufgabe2::Server_stub;
36 _o->MICO_SCOPE(CORBA,Object::operator=)( *_obj );
37 return _o;
38 }
39 }
40 return _nil();
41 }
42
43 Aufgabe2::Server_ptr
44 Aufgabe2::Server::_narrow( CORBA::AbstractBase_ptr _obj )
45 {
46 return _narrow (_obj->_to_object());
47 }
48
49 class _Marshaller_Aufgabe2_Server : public CORBA::StaticTypeInfo {
50 typedef Aufgabe2::Server_ptr _MICO_T;
51 public:
52 StaticValueType create () const;
53 void assign (StaticValueType dst, const StaticValueType src) const;
54 void free (StaticValueType) const;
55 void release (StaticValueType) const;
56 CORBA::Boolean demarshal (CORBA::DataDecoder&, StaticValueType) const;
57 void marshal (CORBA::DataEncoder &, StaticValueType) const;
58 };
59
60
61 CORBA::StaticValueType _Marshaller_Aufgabe2_Server::create() const
62 {
63 return (StaticValueType) new _MICO_T( 0 );
64 }
65
66 void _Marshaller_Aufgabe2_Server::assign( StaticValueType d, const StaticValueType s ) const
67 {
68 *(_MICO_T*) d = ::Aufgabe2::Server::_duplicate( *(_MICO_T*) s );
69 }
70
71 void _Marshaller_Aufgabe2_Server::free( StaticValueType v ) const
72 {
73 CORBA::release( *(_MICO_T *) v );
74 delete (_MICO_T*) v;
75 }
76
77 void _Marshaller_Aufgabe2_Server::release( StaticValueType v ) const
78 {
79 CORBA::release( *(_MICO_T *) v );
80 }
81
82 CORBA::Boolean _Marshaller_Aufgabe2_Server::demarshal( CORBA::DataDecoder &dc, StaticValueType v ) const
83 {
84 CORBA::Object_ptr obj;
85 if (!CORBA::_stc_Object->demarshal(dc, &obj))
86 return FALSE;
87 *(_MICO_T *) v = ::Aufgabe2::Server::_narrow( obj );
88 CORBA::Boolean ret = CORBA::is_nil (obj) || !CORBA::is_nil (*(_MICO_T *)v);
89 CORBA::release (obj);
90 return ret;
91 }
92
93 void _Marshaller_Aufgabe2_Server::marshal( CORBA::DataEncoder &ec, StaticValueType v ) const
94 {
95 CORBA::Object_ptr obj = *(_MICO_T *) v;
96 CORBA::_stc_Object->marshal( ec, &obj );
97 }
98
99 CORBA::StaticTypeInfo *_marshaller_Aufgabe2_Server;
100
101
102
103
104 Aufgabe2::Server_stub::~Server_stub()
105 {
106 }
107
108 char* Aufgabe2::Server_stub::reverse( const char* _par_message )
109 {
110 CORBA::StaticAny _sa_message( CORBA::_stc_string, &_par_message );
111 char* _res;
112 CORBA::StaticAny __res( CORBA::_stc_string, &_res );
113
114 CORBA::StaticRequest __req( this, "reverse" );
115 __req.add_in_arg( &_sa_message );
116 __req.set_result( &__res );
117
118 __req.invoke();
119
120 mico_sii_throw( &__req,
121 0);
122 return _res;
123 }
124
125
126 struct __tc_init_AUFGABE2 {
127 __tc_init_AUFGABE2()
128 {
129 _marshaller_Aufgabe2_Server = new _Marshaller_Aufgabe2_Server;
130 }
131 };
132
133 static __tc_init_AUFGABE2 __init_AUFGABE2;
134
135
136
137
138
139 Aufgabe2::Server_skel::Server_skel( const CORBA::BOA::ReferenceData &_id )
140 {
141 CORBA::ImplementationDef_var _impl =
142 _find_impl( "IDL:Aufgabe2/Server:1.0", "Server" );
143 _create_ref( _id,
144 0,
145 _impl,
146 "IDL:Aufgabe2/Server:1.0" );
147 register_dispatcher( new StaticInterfaceDispatcherWrapper< Server_skel>( this ) );
148 }
149
150 Aufgabe2::Server_skel::Server_skel( CORBA::Object_ptr _obj )
151 {
152 CORBA::ImplementationDef_var _impl =
153 _find_impl( "IDL:Aufgabe2/Server:1.0", "Server" );
154 assert( !CORBA::is_nil( _impl ) );
155 _restore_ref( _obj,
156 CORBA::BOA::ReferenceData(),
157 0,
158 _impl );
159 register_dispatcher( new StaticInterfaceDispatcherWrapper< Server_skel>( this ) );
160 }
161
162 Aufgabe2::Server_skel::~Server_skel()
163 {
164 }
165
166 bool Aufgabe2::Server_skel::dispatch( CORBA::StaticServerRequest_ptr __req, CORBA::Environment & )
167 {
168 #ifdef HAVE_EXCEPTIONS
169 try {
170 #endif
171 if( strcmp( __req->op_name(), "reverse" ) == 0 ) {
172 CORBA::String_var _par_message;
173 CORBA::StaticAny _sa_message( CORBA::_stc_string, &_par_message._for_demarshal() );
174
175 char* _res;
176 CORBA::StaticAny __res( CORBA::_stc_string, &_res );
177 __req->add_in_arg( &_sa_message );
178 __req->set_result( &__res );
179
180 if( !__req->read_args() )
181 return true;
182
183 _res = reverse( _par_message.inout() );
184 __req->write_results();
185 CORBA::string_free( _res );
186 return true;
187 }
188 #ifdef HAVE_EXCEPTIONS
189 } catch( CORBA::SystemException_catch &_ex ) {
190 __req->set_exception( _ex->_clone() );
191 __req->write_results();
192 return true;
193 } catch( ... ) {
194 assert( 0 );
195 return true;
196 }
197 #endif
198 return false;
199 }
200
201 Aufgabe2::Server_ptr Aufgabe2::Server_skel::_this()
202 {
203 return Aufgabe2::Server::_duplicate( this );
204 }
205
206