⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 iface.py

📁 编译工具
💻 PY
📖 第 1 页 / 共 2 页
字号:
      shortcut = ""      init_shortcut = ""    stream.out(omniidl_be.cxx.header.template.interface_objref,               name = self.interface().name().simple(),               inherits = string.join(objref_inherits, ",\n"),               operations = string.join(methods, "\n"),               shortcut = shortcut,               init_shortcut = init_shortcut)  def cc(self, stream):    def _ptrToObjRef_ptr(self = self, stream = stream):      for i in self.interface().allInherits():        stream.out(omniidl_be.cxx.skel.template.interface_objref_repoID_ptr,                   inherits_fqname = i.name().fullyQualify())    def _ptrToObjRef_str(self = self, stream = stream):      for i in self.interface().allInherits():        stream.out(omniidl_be.cxx.skel.template.interface_objref_repoID_str,                   inherits_fqname = i.name().fullyQualify())    # build the inherits list        inherits_str_list = []    for i in self.interface().inherits():      objref_name = i.name().prefix("_objref_")      objref_str = objref_name.unambiguous(self._environment)      if objref_name.needFlatName(self._environment):        objref_str = objref_name.flatName()      this_inherits_str = objref_str + "(ior, id)"      # FIXME:      # The powerpc-aix OMNIORB_BASE_CTOR workaround still works here      # (in precendence to the flattened base name) but lacking a      # powerpc-aix test machine I can't properly test it. It's probably      # not required any more.      if objref_name.relName(self._environment) != i.name().fullName():        prefix = []        for x in objref_name.fullName():          if x == "_objref_" + objref_name.relName(self._environment)[0]:            break          prefix.append(x)        inherits_scope_prefix = string.join(prefix, "::") + "::"        this_inherits_str = "OMNIORB_BASE_CTOR(" + inherits_scope_prefix +\                            ")" + this_inherits_str      inherits_str_list.append(this_inherits_str)    inherits_str = string.join(inherits_str_list, ",\n")    if inherits_str:      comma = ","    else:      comma = ""    if config.state['Shortcut']:      inherits_str  = inherits_str + ","      init_shortcut = "_shortcut(0)"    else:      init_shortcut = ""    stream.out(omniidl_be.cxx.skel.template.interface_objref,               name = self.interface().name().fullyQualify(),               fq_objref_name = self.name().fullyQualify(),               objref_name = self.name().simple(),               inherits_str = inherits_str,               comma = comma,               _ptrToObjRef_ptr = _ptrToObjRef_ptr,               _ptrToObjRef_str = _ptrToObjRef_str,               init_shortcut = init_shortcut)    if config.state['Shortcut']:      inherited = output.StringStream()      for i in self.interface().inherits():        objref_name = i.name().prefix("_objref_")        objref_str = objref_name.unambiguous(self._environment)        if objref_name.needFlatName(self._environment):          objref_str = objref_name.flatName()        inherited.out(omniidl_be.cxx.skel.template.interface_shortcut_inh,                      parent=objref_str)              stream.out(omniidl_be.cxx.skel.template.interface_shortcut,                 name = self.interface().name().fullyQualify(),                 basename = self.interface().name().simple(),                 fq_objref_name = self.name().fullyQualify(),                 inherited = str(inherited))          for method in self.methods():      callable = self._callables[method]      # signature is a text string form of the complete operation signature      signature = callable.signature()      # we only need one descriptor for each _signature_ (not operation)      if _proxy_call_descriptors.has_key(signature):        call_descriptor = _proxy_call_descriptors[signature]      else:        call_descriptor = call.CallDescriptor(signature,callable)        call_descriptor.out_desc(stream)        _proxy_call_descriptors[signature] = call_descriptor      # produce a localcall function      node_name = self.interface().name()      localcall_fn = descriptor.local_callback_fn(node_name,                                                  callable.operation_name(),                                                  signature)      call_descriptor.out_localcall(stream,node_name,callable.method_name(),                                    localcall_fn)      # produce member function for this operation/attribute.      body = output.StringStream()      argnames = method.arg_names()      if config.state['Shortcut']:        if method.return_type().kind() != idltype.tk_void:          callreturn = "return "          voidreturn = ""        else:          callreturn = ""          voidreturn = " return;"        objref_class = method.parent_class()        interface = objref_class.interface()        implname = interface.name().prefix("_impl_").unambiguous(self._environment)                body.out(omniidl_be.cxx.skel.template.interface_operation_shortcut,                 impl_type = implname,                 callreturn = callreturn,                 voidreturn = voidreturn,                 args = string.join(argnames, ", "),                 name = method.name())      call_descriptor.out_objrefcall(body,                                     callable.operation_name(),                                     argnames,                                     localcall_fn,                                     self._environment)      method.cc(stream, body)class _pof_I(Class):  def __init__(self, I):    Class.__init__(self, I)    self._name = self._name.prefix("_pof_")  def hh(self, stream):    stream.out(omniidl_be.cxx.header.template.interface_pof,               name = self.interface().name().simple())  def cc(self, stream):    inherits = output.StringStream()    for i in self.interface().allInherits():      ancestor = i.name().fullyQualify()      inherits.out(omniidl_be.cxx.skel.template.interface_pof_repoID, inherited = ancestor)    node_name = self.interface().name()    objref_name = node_name.prefix("_objref_")    pof_name = node_name.prefix("_pof_")    stream.out(omniidl_be.cxx.skel.template.interface_pof,               pof_name = pof_name.fullyQualify(),               objref_fqname = objref_name.fullyQualify(),               name = node_name.fullyQualify(),               uname = pof_name.simple(),               Other_repoIDs = inherits,               idname = node_name.guard())    class _impl_I(Class):  def __init__(self, I):    Class.__init__(self, I)    self._name = self._name.prefix("_impl_")    for callable in self.interface().callables():      method = _impl_Method(callable, self)      self._methods.append(method)      self._callables[method] = callable  def hh(self, stream):    # build the inheritance list    environment = self._environment    impl_inherits = []    for i in self.interface().inherits():      impl_inherited_name = i.name().prefix("_impl_")      uname = impl_inherited_name.unambiguous(environment)      impl_inherits.append("public virtual " + uname)    # if already inheriting, the base class will be present    # (transitivity of the inherits-from relation)    if self.interface().inherits() == []:      impl_inherits   = [ "public virtual omniServant" ]    methods = []    for method in self.methods():        methods.append(method.hh(virtual = 1, pure = 1))            stream.out(omniidl_be.cxx.header.template.interface_impl,               name = self.interface().name().simple(),               inherits = string.join(impl_inherits, ",\n"),               operations = string.join(methods, "\n"))  def cc(self, stream):    # Function to write the _impl_I::dispatch method    def dispatch(self = self, stream = stream):      # first check if method is from this interface      dispatched = []      for method in self.methods():        callable = self._callables[method]        operation_name = callable.operation_name()        if operation_name not in dispatched:          signature = callable.signature()          call_descriptor = _proxy_call_descriptors[signature]          localcall_fn = descriptor.local_callback_fn(self.interface().name(),                                                      operation_name,signature)          call_descriptor.out_implcall(stream,operation_name,localcall_fn)          dispatched.append(operation_name)      # next call dispatch methods of superclasses      for i in self.interface().inherits():        inherited_name = i.name().prefix("_impl_")        impl_inherits = inherited_name.simple()        # The MSVC workaround might be needed here again        if inherited_name.needFlatName(self._environment):          impl_inherits = inherited_name.flatName()        stream.out(omniidl_be.cxx.skel.template.interface_impl_inherit_dispatch,                   impl_inherited_name = impl_inherits)    # For each of the inherited interfaces, check their repoId strings    def _ptrToInterface_ptr(self = self, stream = stream):      for i in self.interface().allInherits():        inherited_name = i.name()        impl_inherited_name = inherited_name.prefix("_impl_")        # HERE: using the fully scoped name may fail on old MSVC        # versions, but it is required by newer MSVC versions.        # Marvellous.        inherited_str      = inherited_name.fullyQualify()        impl_inherited_str = impl_inherited_name.fullyQualify()        stream.out(omniidl_be.cxx.skel.template.interface_impl_repoID_ptr,                   inherited_name = inherited_str,                   impl_inherited_name = impl_inherited_str)    def _ptrToInterface_str(self = self, stream = stream):      for i in self.interface().allInherits():        inherited_name = i.name()        impl_inherited_name = inherited_name.prefix("_impl_")        inherited_str      = inherited_name.fullyQualify()        impl_inherited_str = impl_inherited_name.fullyQualify()        stream.out(omniidl_be.cxx.skel.template.interface_impl_repoID_str,                   inherited_name = inherited_str,                   impl_inherited_name = impl_inherited_str)    node_name = self.interface().name()    impl_name = node_name.prefix("_impl_")    if self.methods():      getopname = "const char* op = _handle.operation_name();"    else:      getopname = ""    stream.out(omniidl_be.cxx.skel.template.interface_impl,               impl_fqname = impl_name.fullyQualify(),               uname = node_name.simple(),               getopname = getopname,               dispatch = dispatch,               impl_name = impl_name.unambiguous(self._environment),               _ptrToInterface_ptr = _ptrToInterface_ptr,               _ptrToInterface_str = _ptrToInterface_str,               name = node_name.fullyQualify())          class _sk_I(Class):  def __init__(self, I):    Class.__init__(self, I)  def hh(self, stream):    # build the inheritance list    environment = self._environment    sk_inherits = []    for i in self.interface().inherits():      sk_inherited_name = i.name().prefix("_sk_")      uname = sk_inherited_name.unambiguous(environment)      sk_inherits.append("public virtual " + uname)    # if already inheriting, the base class will be present    # (transitivity of the inherits-from relation)    if self.interface().inherits() == []:      sk_inherits   = [ "public virtual omniOrbBoaServant" ]    stream.out(omniidl_be.cxx.header.template.interface_sk,               name = self.interface().name().simple(),               inherits = string.join(sk_inherits, ",\n"))

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -