📄 central.c
字号:
#include "Central.h"//--------------------------------------------------------// Implementation of stubs//--------------------------------------------------------// Stub interface DepotCentralOffice::Depot::~Depot(){}CentralOffice::Depot_ptr CentralOffice::Depot::_duplicate( Depot_ptr _obj ){ if( !CORBA::is_nil( _obj ) ) _obj->_ref(); return _obj;}void *CentralOffice::Depot::_narrow_helper( const char *_repoid ){ if( strcmp( _repoid, "IDL:CentralOffice/Depot:1.0" ) == 0 ) return (void *)this; return NULL;}bool CentralOffice::Depot::_narrow_helper2( CORBA::Object_ptr _obj ){ if( strcmp( _obj->_repoid(), "IDL:CentralOffice/Depot:1.0" ) == 0) { return true; } for( vector<CORBA::Narrow_proto>::size_type _i = 0; _narrow_helpers && _i < _narrow_helpers->size(); _i++ ) { bool _res = (*(*_narrow_helpers)[ _i ])( _obj ); if( _res ) return true; } return false;}CentralOffice::Depot_ptr CentralOffice::Depot::_narrow( CORBA::Object_ptr _obj ){ CentralOffice::Depot_ptr _o; if( !CORBA::is_nil( _obj ) ) { void *_p; if( (_p = _obj->_narrow_helper( "IDL:CentralOffice/Depot:1.0" ))) return _duplicate( (CentralOffice::Depot_ptr) _p ); if( _narrow_helper2( _obj ) ) { _o = new CentralOffice::Depot_stub; _o->MICO_SCOPE(CORBA,Object::operator=)( *_obj ); return _o; } } return _nil();}CentralOffice::Depot_ptr CentralOffice::Depot::_nil(){ return NULL;}CentralOffice::Depot_stub::~Depot_stub(){}void CentralOffice::Depot_stub::FindItemInfo( AStore::AStoreId StoreId, const char* Item, CORBA::Long Quantity, AStore::ItemInfo*& IInfo ){ CORBA::Request_var _req = this->_request( "FindItemInfo" ); _req->add_in_arg( "StoreId" ) <<= StoreId; _req->add_in_arg( "Item" ) <<= CORBA::Any::from_string( (char *) Item, 0 ); _req->add_in_arg( "Quantity" ) <<= Quantity; _req->add_out_arg( "IInfo" ); _req->arguments()->item( 3 )->value()->type( AStore::_tc_ItemInfo ); _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 ) { if( !strcmp( _uuex->_except_repoid(), "IDL:AStore/BarcodeNotFound:1.0" ) ) { CORBA::Any &_a = _uuex->exception( ::AStore::_tc_BarcodeNotFound ); ::AStore::BarcodeNotFound _user_ex; _a >>= _user_ex; mico_throw( _user_ex ); } mico_throw( CORBA::UNKNOWN() ); } else { mico_throw( *_ex ); } } #else { CORBA::Exception *_ex; if( (_ex = _req->env()->exception()) ) CORBA::Exception::_throw_failed( _ex ); } #endif IInfo = new ::AStore::ItemInfo; *_req->arguments()->item( 3 )->value() >>= *IInfo;}#ifdef HAVE_NAMESPACEnamespace CentralOffice { vector<CORBA::Narrow_proto> * Depot::_narrow_helpers; };#elsevector<CORBA::Narrow_proto> * CentralOffice::Depot::_narrow_helpers;#endif#ifdef HAVE_NAMESPACEnamespace CentralOffice { CORBA::TypeCodeConst _tc_Depot; };#elseCORBA::TypeCodeConst CentralOffice::_tc_Depot;#endifCORBA::Booleanoperator<<=( CORBA::Any &_a, const CentralOffice::Depot_ptr _obj ){ return (_a <<= CORBA::Any::from_object( _obj, "Depot" ));}CORBA::Booleanoperator>>=( const CORBA::Any &_a, CentralOffice::Depot_ptr &_obj ){ CORBA::Object_ptr _o; if( !(_a >>= CORBA::Any::to_object( _o )) ) return FALSE; if( CORBA::is_nil( _o ) ) { _obj = ::CentralOffice::Depot::_nil(); return TRUE; } _obj = ::CentralOffice::Depot::_narrow( _o ); CORBA::release( _o ); return TRUE;}struct __tc_init_CENTRAL { __tc_init_CENTRAL() { CentralOffice::_tc_Depot = "000000000000000e0000002e000000000000001c49444c3a43656e747261" "6c4f66666963652f4465706f743a312e3000000000064465706f7400"; }};static __tc_init_CENTRAL __init_CENTRAL;//--------------------------------------------------------// Implementation of skeletons//--------------------------------------------------------// Dynamic Implementation Routine for interface DepotCentralOffice::Depot_skel::Depot_skel( const CORBA::BOA::ReferenceData &_id ){ CORBA::ImplementationDef_var _impl = _find_impl( "IDL:CentralOffice/Depot:1.0", "Depot" ); assert( !CORBA::is_nil( _impl ) ); _create_ref( _id, CORBA::InterfaceDef::_nil(), _impl, "IDL:CentralOffice/Depot:1.0" ); register_dispatcher( new InterfaceDispatcherWrapper<Depot_skel>( this ) );}CentralOffice::Depot_skel::Depot_skel( CORBA::Object_ptr _obj ){ CORBA::ImplementationDef_var _impl = _find_impl( "IDL:CentralOffice/Depot:1.0", "Depot" ); assert( !CORBA::is_nil( _impl ) ); _restore_ref( _obj, CORBA::BOA::ReferenceData(), CORBA::InterfaceDef::_nil(), _impl ); register_dispatcher( new InterfaceDispatcherWrapper<Depot_skel>( this ) );}CentralOffice::Depot_skel::~Depot_skel(){}bool CentralOffice::Depot_skel::dispatch( CORBA::ServerRequest_ptr _req, CORBA::Environment & /*_env*/ ){ if( strcmp( _req->op_name(), "FindItemInfo" ) == 0 ) { AStore::AStoreId StoreId; POS::Barcode_var Item; CORBA::Long Quantity; AStore::ItemInfo* IInfo; CORBA::NVList_ptr _args = new CORBA::NVList (4); _args->add( CORBA::ARG_IN ); _args->item( 0 )->value()->type( AStore::_tc_AStoreId ); _args->add( CORBA::ARG_IN ); _args->item( 1 )->value()->type( POS::_tc_Barcode ); _args->add( CORBA::ARG_IN ); _args->item( 2 )->value()->type( CORBA::_tc_long ); _args->add( CORBA::ARG_OUT ); _args->item( 3 )->value()->type( AStore::_tc_ItemInfo ); if (!_req->params( _args )) return true; *_args->item( 0 )->value() >>= StoreId; *_args->item( 1 )->value() >>= CORBA::Any::to_string( Item, 0 ); *_args->item( 2 )->value() >>= Quantity; #ifdef HAVE_EXCEPTIONS try { #endif FindItemInfo( StoreId, Item, Quantity, IInfo ); #ifdef HAVE_EXCEPTIONS } catch( ::AStore::BarcodeNotFound_var &_ex ) { _req->exception( _ex->_clone() ); return true; } catch( CORBA::SystemException_var &_ex ) { _req->exception( _ex->_clone() ); return true; } catch( ... ) { assert( 0 ); return true; } #endif *_args->item( 3 )->value() <<= *IInfo; delete IInfo; return true; } return false;}CentralOffice::Depot_ptr CentralOffice::Depot_skel::_this(){ return CentralOffice::Depot::_duplicate( this );}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -