📄 template.py
字号:
if ( omni::strMatch(repoId, @repoID_str@) ) { @exname@ _ex; _ex <<= s; if (iop_client) iop_client->RequestCompleted(); throw _ex;}"""interface_operation = """\@call_descriptor@ _call_desc(@call_desc_args@);@assign_args@@assign_context@_invoke(_call_desc);@assign_res@"""interface_operation_shortcut = """\@impl_type@* _s = _shortcut;if (_s) { if (!*_invalid) { @callreturn@_s->@name@(@args@);@voidreturn@ } else { _enableShortcut(0,0); // drop through to normal invoke }}\"""interface_pof = """\@pof_name@::~@uname@() {}omniObjRef*@pof_name@::newObjRef(omniIOR* ior, omniIdentity* id){ return new ::@objref_fqname@(ior, id);}CORBA::Boolean@pof_name@::is_a(const char* id) const{ if( omni::ptrStrMatch(id, ::@name@::_PD_repoId) ) return 1; @Other_repoIDs@ return 0;}const @pof_name@ _the_pof_@idname@;"""interface_pof_repoID = """\if( omni::ptrStrMatch(id, @inherited@::_PD_repoId) ) return 1;"""interface_ALIAS = """\typedef @fqname@ @flat_fqname@;typedef @impl_fqname@ @impl_flat_fqname@;typedef @objref_fqname@ @objref_flat_fqname@;"""interface_impl = """\@impl_fqname@::~_impl_@uname@() {}CORBA::Boolean@impl_fqname@::_dispatch(omniCallHandle& _handle){ @getopname@ @dispatch@ return 0;}void*@impl_fqname@::_ptrToInterface(const char* id){ if( id == ::@name@::_PD_repoId ) return (::@impl_fqname@*) this; @_ptrToInterface_ptr@ if( id == ::CORBA::Object::_PD_repoId ) return (void*) 1; if( omni::strMatch(id, ::@name@::_PD_repoId) ) return (::@impl_fqname@*) this; @_ptrToInterface_str@ if( omni::strMatch(id, ::CORBA::Object::_PD_repoId) ) return (void*) 1; return 0;}const char*@impl_fqname@::_mostDerivedRepoId(){ return ::@name@::_PD_repoId;}"""interface_impl_inherit_dispatch = """\#ifndef _MSC_VERif( @impl_inherited_name@::_dispatch(_handle) ) { return 1;}#else// Work-around for incorrect MSVC code generation.if( ((@impl_inherited_name@*)this)-> @impl_inherited_name@::_dispatch(_handle) ) { return 1;}#endif"""interface_impl_repoID_ptr = """\if( id == ::@inherited_name@::_PD_repoId ) return (::@impl_inherited_name@*) this;"""interface_impl_repoID_str = """\if( omni::strMatch(id, ::@inherited_name@::_PD_repoId) ) return (::@impl_inherited_name@*) this;"""interface_sk = """\@sk_fqname@::@sk_name@(const omniOrbBoaKey& k) { pd_key = k; }@sk_fqname@::~@sk_name@() {}"""interface_operation_catch_exn = """\catch(@exname@& ex) { throw omniORB::StubUserException(ex._NP_duplicate());}"""interface_operation_context = """\CORBA::Context_var _ctxt;_ctxt = CORBA::Context::unmarshalContext(iop_s);"""interface_operation_dispatch = """\if( omni::strMatch(op, "@idl_operation_name@") ) { @call_descriptor@ _call_desc(@call_desc_args@); @prepare_out_args@ _handle.upcall(this,_call_desc); return 1;}"""#### Struct##struct = """\void@name@::operator>>= (cdrStream &_n) const{ @marshall_code@}void@name@::operator<<= (cdrStream &_n){ @unmarshall_code@}"""#### Unions##union_default_bool = """\#ifndef HAS_Cplusplus_Bool default: break;#endif"""union_default = """\default: break;"""union_operators = """\void@name@::operator>>= (cdrStream& _n) const{ @marshal_discriminator@ @marshal_cases@}void@name@::operator<<= (cdrStream& _n){ @unmarshal_discriminator@ switch(_pd__d) { @unmarshal_cases@ } _pd__initialised = 1;}"""union_operators_nonexhaustive = """\if (_pd__default) { @default@}else { switch(_pd__d) { @cases@ }}"""union_operators_exhaustive = """\switch(_pd__d) { @cases@}"""#### const##const_namespace = """\#if defined(HAS_Cplusplus_Namespace) && defined(_MSC_VER)// MSVC++ does not give the constant external linkage othewise.@open_namespace@ extern const @type@ @simple_name@ = @value@;@close_namespace@#elseconst @type@ @name@ = @value@;#endif"""const_simple = """\const @type@ @name@ = @value@;"""const_in_interface = """\const @type@ @name@ _init_in_cldef_( = @value@ );"""const_init_in_def = """\_init_in_def_( const @type@ @name@ = @value@; )"""#### Exception##exception = """\CORBA::Exception::insertExceptionToAny @scoped_name@::insertToAnyFn = 0;CORBA::Exception::insertExceptionToAnyNCP @scoped_name@::insertToAnyFnNCP = 0;@scoped_name@::@name@(const @scoped_name@& _s) : CORBA::UserException(_s){ @copy_ctor_body@}@default_ctor@@scoped_name@& @scoped_name@::operator=(const @scoped_name@& _s){ ((CORBA::UserException*) this)->operator=(_s); @assign_op_body@ return *this;}@scoped_name@::~@name@() {}void @scoped_name@::_raise() const { throw *this; }const char* @scoped_name@::_PD_repoId = "@repoID@";const char* @scoped_name@::_PD_typeId = "Exception/UserException/@scoped_name@";@scoped_name@* @scoped_name@::_downcast(CORBA::Exception* _e) { return (@name@*) _NP_is_a(_e, _PD_typeId);}const @scoped_name@* @scoped_name@::_downcast(const CORBA::Exception* _e) { return (const @name@*) _NP_is_a(_e, _PD_typeId);}CORBA::Exception* @scoped_name@::_NP_duplicate() const { return new @name@(*this);}const char* @scoped_name@::_NP_typeId() const { return _PD_typeId;}const char* @scoped_name@::_NP_repoId(int* _size) const { *_size = sizeof("@repoID@"); return _PD_repoId;} void @scoped_name@::_NP_marshal(cdrStream& _s) const { *this >>= _s;}"""exception_default_ctor = """\@scoped_name@::@name@(@ctor_args@){ pd_insertToAnyFn = @scoped_name@::insertToAnyFn; pd_insertToAnyFnNCP = @scoped_name@::insertToAnyFnNCP; @default_ctor_body@}"""exception_operators = """\void@scoped_name@::operator>>= (cdrStream& _n) const{ @marshal@}void@scoped_name@::operator<<= (cdrStream& _n){ @unmarshal@}"""#### Sequence of forward declared struct/union##sequence_forward_unbounded_defns = """\@fqname@::@name@(const ::@fqname@& _s) : @derived@(_s.pd_max, 0, 0, 1){ length(_s.pd_len); for (_CORBA_ULong _i=0; _i < pd_len; _i++) { pd_buf[_i] = _s.pd_buf[_i]; }}void@fqname@::operator<<= (cdrStream& _s){ _CORBA_ULong _l; _l <<= _s; if (!_s.checkInputOverrun(1,_l)) { _CORBA_marshal_sequence_range_check_error(_s); // never reach here } length(_l); for( _CORBA_ULong _i = 0; _i < _l; _i++ ) pd_buf[_i] <<= _s;}"""sequence_forward_bounded_defns = """\@fqname@::@name@(const ::@fqname@& _s) : @derived@(0,0,1){ length(_s.pd_len); for (_CORBA_ULong _i=0; _i < pd_len; _i++) { pd_buf[_i] = _s.pd_buf[_i]; }}void@fqname@::operator<<= (cdrStream& _s){ _CORBA_ULong _l; _l <<= _s; if (!_s.checkInputOverrun(1,_l) || (_l > @bound@)) { _CORBA_marshal_sequence_range_check_error(_s); // never reach here } length(_l); for( _CORBA_ULong _i = 0; _i < _l; _i++ ) pd_buf[_i] <<= _s;}"""sequence_forward_defns = """\void@fqname@::operator>>= (cdrStream& _s) const{ ::operator>>=(_CORBA_ULong(pd_len), _s); for( _CORBA_ULong _i = 0; _i < pd_len; _i++ ) pd_buf[_i] >>= _s;}@fqname@&@fqname@::operator=(const ::@fqname@& _s){ length(_s.pd_len); for (unsigned long _i=0; _i < pd_len; _i++) { pd_buf[_i] = _s.pd_buf[_i]; } return *this;}@element@&@fqname@::operator[](_CORBA_ULong _index){ if (_index >= pd_len) _CORBA_bound_check_error(); return pd_buf[_index];}const @element@&@fqname@::operator[](_CORBA_ULong _index) const{ if (_index >= pd_len) _CORBA_bound_check_error(); return pd_buf[_index];}@element@*@fqname@::allocbuf(_CORBA_ULong _nelems){ ::@element@* _tmp = 0; if (_nelems) { _tmp = new ::@element@[_nelems]; } return _tmp;}void@fqname@::freebuf(::@element@* _b){ if (_b) delete [] _b;}void@fqname@::NP_freebuf(){ if (pd_buf) delete [] pd_buf;}@fqname@::~@name@(){ if (pd_rel && pd_buf) delete [] pd_buf; pd_buf = 0;}void@fqname@::NP_copybuffer(_CORBA_ULong _newmax){ // replace pd_data with a new buffer of size newmax. // Invariant: pd_len <= newmax // ::@element@* _newbuf = allocbuf(_newmax); if (!_newbuf) { _CORBA_new_operator_return_null(); // never reach here } for (unsigned long _i=0; _i < pd_len; _i++) { _newbuf[_i] = pd_buf[_i]; } if (pd_rel && pd_buf) { freebuf(pd_buf); } else { pd_rel = 1; } pd_buf = _newbuf; pd_max = _newmax;}"""
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -