/* * MICO --- a free CORBA implementation * Copyright (C) 1997-98 Kay Roemer & Arno Puder * * This file was automatically generated. DO NOT EDIT! */ #include "account.h" //-------------------------------------------------------- // Implementation of stubs //-------------------------------------------------------- // Stub interface Account Account::~Account() { } Account_ptr Account::_duplicate( Account_ptr _obj ) { if( !CORBA::is_nil( _obj ) ) _obj->_ref(); return _obj; } void *Account::_narrow_helper( const char *_repoid ) { if( strcmp( _repoid, "IDL:Account:1.0" ) == 0 ) return (void *)this; return NULL; } bool Account::_narrow_helper2( CORBA::Object_ptr _obj ) { if( strcmp( _obj->_repoid(), "IDL:Account:1.0" ) == 0) { return true; } for( vector::size_type _i = 0; _narrow_helpers && _i < _narrow_helpers->size(); _i++ ) { bool _res = (*(*_narrow_helpers)[ _i ])( _obj ); if( _res ) return true; } return false; } Account_ptr Account::_narrow( CORBA::Object_ptr _obj ) { Account_ptr _o; if( !CORBA::is_nil( _obj ) ) { void *_p; if( (_p = _obj->_narrow_helper( "IDL:Account:1.0" ))) return _duplicate( (Account_ptr) _p ); if( _narrow_helper2( _obj ) ) { _o = new Account_stub; _o->MICO_SCOPE(CORBA,Object::operator=)( *_obj ); return _o; } } return _nil(); } Account_ptr Account::_nil() { return NULL; } Account_stub::~Account_stub() { } void Account_stub::deposit( CORBA::ULong amount ) { CORBA::Request_var _req = this->_request( "deposit" ); _req->add_in_arg( "amount" ) <<= amount; _req->result()->value()->type( CORBA::_tc_void ); _req->invoke(); #ifdef HAVE_EXCEPTIONS if( _req->env()->exception() ) { CORBA::Exception *_ex = _req->env()->exception(); CORBA::UnknownUserException *_uuex = CORBA::UnknownUserException::_narrow( _ex ); if( _uuex ) { mico_throw( CORBA::UNKNOWN() ); } else { mico_throw( *_ex ); } } #else { CORBA::Exception *_ex; if( (_ex = _req->env()->exception()) ) CORBA::Exception::_throw_failed( _ex ); } #endif } void Account_stub::withdraw( CORBA::ULong amount ) { CORBA::Request_var _req = this->_request( "withdraw" ); _req->add_in_arg( "amount" ) <<= amount; _req->result()->value()->type( CORBA::_tc_void ); _req->invoke(); #ifdef HAVE_EXCEPTIONS if( _req->env()->exception() ) { CORBA::Exception *_ex = _req->env()->exception(); CORBA::UnknownUserException *_uuex = CORBA::UnknownUserException::_narrow( _ex ); if( _uuex ) { mico_throw( CORBA::UNKNOWN() ); } else { mico_throw( *_ex ); } } #else { CORBA::Exception *_ex; if( (_ex = _req->env()->exception()) ) CORBA::Exception::_throw_failed( _ex ); } #endif } CORBA::Long Account_stub::balance() { CORBA::Request_var _req = this->_request( "balance" ); _req->result()->value()->type( CORBA::_tc_long ); _req->invoke(); #ifdef HAVE_EXCEPTIONS if( _req->env()->exception() ) { CORBA::Exception *_ex = _req->env()->exception(); CORBA::UnknownUserException *_uuex = CORBA::UnknownUserException::_narrow( _ex ); if( _uuex ) { mico_throw( CORBA::UNKNOWN() ); } else { mico_throw( *_ex ); } } #else { CORBA::Exception *_ex; if( (_ex = _req->env()->exception()) ) CORBA::Exception::_throw_failed( _ex ); } #endif CORBA::Long _res; *_req->result()->value() >>= _res; return _res; } vector * Account::_narrow_helpers; CORBA::TypeCodeConst _tc_Account; CORBA::Boolean operator<<=( CORBA::Any &_a, const Account_ptr _obj ) { return (_a <<= CORBA::Any::from_object( _obj, "Account" )); } CORBA::Boolean operator>>=( const CORBA::Any &_a, Account_ptr &_obj ) { CORBA::Object_ptr _o; if( !(_a >>= CORBA::Any::to_object( _o )) ) return FALSE; if( CORBA::is_nil( _o ) ) { _obj = ::Account::_nil(); return TRUE; } _obj = ::Account::_narrow( _o ); CORBA::release( _o ); return TRUE; } struct __tc_init_ACCOUNT { __tc_init_ACCOUNT() { _tc_Account = "010000000e00000024000000010000001000000049444c3a4163636f756e" "743a312e3000080000004163636f756e7400"; } }; static __tc_init_ACCOUNT __init_ACCOUNT; //-------------------------------------------------------- // Implementation of skeletons //-------------------------------------------------------- // Dynamic Implementation Routine for interface Account Account_skel::Account_skel( const CORBA::BOA::ReferenceData &_id ) { CORBA::ImplementationDef_var _impl = _find_impl( "IDL:Account:1.0", "Account" ); assert( !CORBA::is_nil( _impl ) ); _create_ref( _id, CORBA::InterfaceDef::_nil(), _impl, "IDL:Account:1.0" ); register_dispatcher( new InterfaceDispatcherWrapper( this ) ); } Account_skel::Account_skel( CORBA::Object_ptr _obj ) { CORBA::ImplementationDef_var _impl = _find_impl( "IDL:Account:1.0", "Account" ); assert( !CORBA::is_nil( _impl ) ); _restore_ref( _obj, CORBA::BOA::ReferenceData(), CORBA::InterfaceDef::_nil(), _impl ); register_dispatcher( new InterfaceDispatcherWrapper( this ) ); } Account_skel::~Account_skel() { } bool Account_skel::dispatch( CORBA::ServerRequest_ptr _req, CORBA::Environment & /*_env*/ ) { if( strcmp( _req->op_name(), "deposit" ) == 0 ) { CORBA::ULong amount; CORBA::NVList_ptr _args = new CORBA::NVList (1); _args->add( CORBA::ARG_IN ); _args->item( 0 )->value()->type( CORBA::_tc_ulong ); if (!_req->params( _args )) return true; *_args->item( 0 )->value() >>= amount; #ifdef HAVE_EXCEPTIONS try { #endif deposit( amount ); #ifdef HAVE_EXCEPTIONS } catch( CORBA::SystemException_var &_ex ) { _req->exception( _ex->_clone() ); return true; } catch( ... ) { assert( 0 ); return true; } #endif return true; } if( strcmp( _req->op_name(), "withdraw" ) == 0 ) { CORBA::ULong amount; CORBA::NVList_ptr _args = new CORBA::NVList (1); _args->add( CORBA::ARG_IN ); _args->item( 0 )->value()->type( CORBA::_tc_ulong ); if (!_req->params( _args )) return true; *_args->item( 0 )->value() >>= amount; #ifdef HAVE_EXCEPTIONS try { #endif withdraw( amount ); #ifdef HAVE_EXCEPTIONS } catch( CORBA::SystemException_var &_ex ) { _req->exception( _ex->_clone() ); return true; } catch( ... ) { assert( 0 ); return true; } #endif return true; } if( strcmp( _req->op_name(), "balance" ) == 0 ) { CORBA::NVList_ptr _args = new CORBA::NVList (0); if (!_req->params( _args )) return true; CORBA::Long _res; #ifdef HAVE_EXCEPTIONS try { #endif _res = balance(); #ifdef HAVE_EXCEPTIONS } catch( CORBA::SystemException_var &_ex ) { _req->exception( _ex->_clone() ); return true; } catch( ... ) { assert( 0 ); return true; } #endif CORBA::Any *_any_res = new CORBA::Any; *_any_res <<= _res; _req->result( _any_res ); return true; } return false; } Account_ptr Account_skel::_this() { return Account::_duplicate( this ); }