sources:
Aufgabe2.cpp (5.5k)
Aufgabe2.h (2.0k)
Aufgabe2.idl (85 bytes)
Client.cpp (1020 bytes)
Server.cpp (1.8k)


website:
more info here
studies/corba/Corba-Code2/Aufgabe2.cpp
download file

  1 /* * MICO --- an Open Source CORBA implementation * Copyright (c) 1997-2001 by The Mico Team * * This file was automatically generated. DO NOT EDIT! */
  2
  3 #include "Aufgabe2.h"
  4
  5
  6 using namespace std;
  7
  8 //--------------------------------------------------------
  9 // Implementation of stubs
 10 //--------------------------------------------------------
 11
 12 /* * Base interface for class Server */
 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 /* * Stub interface for class Server */
 95
 96 Aufgabe2::Server_stub::~Server_stub()
 97 {
 98 }
 99
100 char* Aufgabe2::Server_stub::reverse( const char* _par_message )
101 {
102   CORBA::StaticAny _sa_message( CORBA::_stc_string, &_par_message );
103   char* _res;
104   CORBA::StaticAny __res( CORBA::_stc_string, &_res );
105
106   CORBA::StaticRequest __req( this, "reverse" );
107   __req.add_in_arg( &_sa_message );
108   __req.set_result( &__res );
109
110   __req.invoke();
111
112   mico_sii_throw( &__req,
113     0)
;
114   return _res;
115 }
116
117
118 struct __tc_init_AUFGABE2 {
119   __tc_init_AUFGABE2()
120   {
121     _marshaller_Aufgabe2_Server = new _Marshaller_Aufgabe2_Server;
122   }
123 };
124
125 static __tc_init_AUFGABE2 __init_AUFGABE2;
126
127 //--------------------------------------------------------
128 // Implementation of skeletons
129 //--------------------------------------------------------
130
131 Aufgabe2::Server_skel::Server_skel( const CORBA::BOA::ReferenceData &_id )
132 {
133   CORBA::ImplementationDef_var _impl =
134     _find_impl( "IDL:Aufgabe2/Server:1.0", "Server" );
135   _create_ref( _id,
136     0,
137     _impl,
138     "IDL:Aufgabe2/Server:1.0" )
;
139   register_dispatcher( new StaticInterfaceDispatcherWrapper< Server_skel>( this ) );
140 }
141
142 Aufgabe2::Server_skel::Server_skel( CORBA::Object_ptr _obj )
143 {
144   CORBA::ImplementationDef_var _impl =
145     _find_impl( "IDL:Aufgabe2/Server:1.0", "Server" );
146   assert( !CORBA::is_nil( _impl ) );
147   _restore_ref( _obj,
148     CORBA::BOA::ReferenceData(),
149     0,
150     _impl )
;
151   register_dispatcher( new StaticInterfaceDispatcherWrapper< Server_skel>( this ) );
152 }
153
154 Aufgabe2::Server_skel::~Server_skel()
155 {
156 }
157
158 bool Aufgabe2::Server_skel::dispatch( CORBA::StaticServerRequest_ptr __req, CORBA::Environment & /*_env*/ )
159 {
160   #ifdef HAVE_EXCEPTIONS
161   try {
162   #endif
163     if( strcmp( __req->op_name(), "reverse" ) == 0 ) {
164       CORBA::String_var _par_message;
165       CORBA::StaticAny _sa_message( CORBA::_stc_string, &_par_message._for_demarshal() );
166
167       char* _res;
168       CORBA::StaticAny __res( CORBA::_stc_string, &_res );
169       __req->add_in_arg( &_sa_message );
170       __req->set_result( &__res );
171
172       if( !__req->read_args() )
173         return true;
174
175       _res = reverse( _par_message.inout() );
176       __req->write_results();
177       CORBA::string_free( _res );
178       return true;
179     }
180   #ifdef HAVE_EXCEPTIONS
181   } catch( CORBA::SystemException_catch &_ex ) {
182     __req->set_exception( _ex->_clone() );
183     __req->write_results();
184     return true;
185   } catch( ... ) {
186     assert( 0 );
187     return true;
188   }
189   #endif
190   return false;
191 }
192
193 Aufgabe2::Server_ptr Aufgabe2::Server_skel::_this()
194 {
195   return Aufgabe2::Server::_duplicate( this );
196 }
197
198
199