コード例 #1
0
    def copy(self, src, dest, environment=None):
        """Copies an entity from src to dest"""

        if self.array():
            name = id.Name(self.type().decl().scopedName()).suffix("_dup")
            return dest + " = " + name.unambiguous(
                environment) + "(" + src + ");"

        d_T = self.deref()
        if d_T.typecode():
            return dest + " = ::CORBA::TypeCode::_duplicate(" + src + ");"
        if d_T.interface():
            # Use the internal omniORB duplicate function in case the
            # normal one isn't available
            name = id.Name(self.type().decl().scopedName()).suffix("_Helper")
            return name.unambiguous(environment) + "::duplicate" +\
                   "(" + src + ");\n" + dest + " = " + src + ";"
        if d_T.string():
            return dest + " = ::CORBA::string_dup(" + src + ");"
        if d_T.wstring():
            return dest + " = ::CORBA::wstring_dup(" + src + ");"
        if d_T.any():
            return dest + " = new ::CORBA::Any(" + src + ");"

        if d_T.struct() or d_T.union() or d_T.exception() or d_T.sequence():
            name = id.Name(self.type().decl().scopedName()).\
                   unambiguous(environment)
            if d_T.variable():
                return dest + " = new " + name + "(" + src + ");"
            return dest + " = " + src + ";"

        if d_T.enum() or self.is_basic_data_types():
            return dest + " = " + src + ";"

        raise "Don't know how to copy type, kind = " + str(d_T.kind())
コード例 #2
0
    def _var(self, environment=None):
        """Returns a representation of the type which is responsible for its
           own destruction. Assigning a heap allocated thing to this type
           should allow the user to forget about deallocation."""
        d_T = self.deref()

        if self.array() or d_T.struct()    or d_T.union() or \
                           d_T.exception() or d_T.sequence() or \
                           d_T.interface() or d_T.value() or \
                           d_T.valuebox():
            name = id.Name(self.type().decl().scopedName()).suffix("_var")
            return name.unambiguous(environment)

        if d_T.typecode(): return "::CORBA::TypeCode_var"
        if d_T.any(): return "::CORBA::Any_var"
        if d_T.string(): return "::CORBA::String_var"
        if d_T.wstring(): return "::CORBA::WString_var"
        if d_T.enum():
            name = id.Name(self.type().decl().scopedName())
            return name.unambiguous(environment)

        if self.is_basic_data_types():
            return basic_map[d_T.kind()]

        if d_T.void():
            raise NotImplementedError("No such thing as a void _var type")

        raise "Unknown _var type, kind = " + str(d_T.kind())
コード例 #3
0
    def visitInterface(self, node):
        idlScopedName = id.Name(node.scopedName())
        servantScope = hpp_servant_scope(idlScopedName)
        scopedName = hpp_servant_name(idlScopedName)

        base, depth = get_base_class(node, retDepth=True)
        baseScopedName = hpp_servant_name(id.Name(base.scopedName()),
                                          servantScope)

        if depth == 0:
            self.methods.out(
                template.definition_object_downcast,
                servant_class=servantScope.fullyQualify(),
            )

        openns, closens = namespaces(servantScope, self.environment)
        self.adders.out(
            template.definition_add_object_downcast,
            #class_name = scopedName,
            #base_class_name = baseScopedName,
            class_name=idlScopedName.simple(),
            base_class_name=baseScopedName,
            open_namespaces=openns,
            close_namespaces=closens,
            depth=depth)
コード例 #4
0
ファイル: main.py プロジェクト: stjordanis/hpp-corbaserver
    def visitStruct(self, node):
        if not node.identifier().endswith("Storage"): return
        if not node.members(): return

        class Storage(object):
            pass

        storage = Storage()

        storage.members = []
        for m in node.members():
            type = self.toCppNamespace(id.Name(m.memberType().scopedName())).suffix("Ptr_t")
            for d in m.declarators():
                storage.members.append ((type, d.identifier()))

        storage.sc = hpp_servant_scope(id.Name(node.scopedName()))

        sc = node.scopedName()
        sc[-1] = sc[-1][:-7]
        storage.class_sc = hpp_servant_scope(id.Name(sc))

        st = output.StringStream()
        st.out (template.storage_decl,
                storage_class_name       = storage.sc.simple(),
                hpp_base_class           = storage.class_sc.simple(),
                storage_attributes       = "\n".join([ t.fullyQualify() + " " + n for t,n in storage.members ]),
                storage_constr_attr_decl = ", ".join([ t.fullyQualify() + " _" + n for t,n in storage.members ]) + ", ",
                storage_constr_attr_defs = ", " + ", ".join([ n + " (_" + n + ")" for t,n in storage.members ]),
                storage_attr_call        = ", ".join([ n for t,n in storage.members ]) + ", ",
                )
        storage.decl = str(st)

        self.storages[storage.class_sc.fullyQualify(cxx=0)] = storage
コード例 #5
0
ファイル: main.py プロジェクト: ylabbe/hpp-corbaserver
 def argConversion(self, name, _type, _in, _out, param):
     tmp = "_" + name
     if _type.char() or _type.floating() or _type.boolean(
     ) or _type.integer():
         return name, ""
     if _type.string():
         if _out:
             raise makeError("out string is currently not supported",
                             param.file(), param.line())
         return tmp, "std::string {} ({});".format(tmp, name)
     if _type.typedef():
         if _type.type().name() in ("size_t", "size_type", "value_type"):
             return name, ""
         elif _type.type().name() == "floatSeq":
             if _out:
                 raise makeError("out floatSeq is currently not supported",
                                 param.file(), param.line())
             return tmp, "hpp::core::vector_t {} = hpp::corbaServer::floatSeqToVector ({});".format(
                 tmp, name)
         print("typedef", _type.type().name())
         return name, ""
     if _type.objref():
         if _out:
             raise makeError("out objects is currently not supported",
                             param.file(), param.line())
         conv = "{type} {tmp} = reference_to_servant<{servanttype}>(server_, {name})->getT();" \
                 .format(type=self.toCppNamespace(id.Name(_type.type().scopedName()).suffix("Ptr_t")).fullyQualify(cxx=1),
                         servanttype=hpp_servant_name(id.Name(_type.type().scopedName())),
                         tmp=tmp, name=name)
         return tmp, conv
     print(_type.type(), _type.kind())
     return name, ""
コード例 #6
0
ファイル: poa.py プロジェクト: gmwu/corba_examples
def visitInterface(node):
    if node.local():
        # No POA class for local interfaces
        return

    iname = id.mapID(node.identifier())
    environment = id.lookup(node)
    scopedName = id.Name(node.scopedName())
    impl_scopedName = scopedName.prefix("_impl_")
    scopedID = scopedName.fullyQualify()
    impl_scopedID = impl_scopedName.fullyQualify()

    POA_name = POA_prefix() + iname

    # deal with inheritance
    inherits = []
    for i in map(ast.remove_ast_typedefs, node.inherits()):
        name = id.Name(i.scopedName())
        i_POA_name = name.unambiguous(environment)

        if name.relName(environment) == None:
            # we need to fully qualify from the root
            i_POA_name = "::POA_" + name.fullyQualify(environment)

        elif name.relName(environment) == i.scopedName():
            # fully qualified (but not from root) POA name has a POA_ on the
            # front
            i_POA_name = "POA_" + i_POA_name

        inherits.append("public virtual " + i_POA_name)

    # Note that RefCountServantBase is a mixin class specified by the
    # implementor, not generated by the idl compiler.
    if node.inherits() == []:
        inherits.append("public virtual ::PortableServer::ServantBase")

    inherits_str = ",\n  ".join(inherits)

    # build the normal POA class first
    stream.out(template.POA_interface,
               POA_name=POA_name,
               scopedID=scopedID,
               impl_scopedID=impl_scopedID,
               inherits=inherits_str)

    if config.state['Normal Tie']:
        # Normal tie templates, inline (so already in relevant POA_
        # module)
        poa_name = ""
        if len(scopedName.fullName()) == 1:
            poa_name = "POA_"
        poa_name = poa_name + scopedName.simple()
        tie_name = poa_name + "_tie"

        tie.write_template(tie_name, poa_name, node, stream)

    return
コード例 #7
0
def visitEnum(node):
    cxx_fqname = id.Name(node.scopedName()).fullyQualify()
    last_item = id.Name(node.enumerators()[-1].scopedName()).fullyQualify()

    stream.out(template.enum_operators,
               name=cxx_fqname,
               private_prefix=config.state['Private Prefix'],
               last_item=last_item)

    # Typecode and Any
    if config.state['Typecode']:
        stream.out(template.any_enum, name=cxx_fqname)
コード例 #8
0
ファイル: main.py プロジェクト: stjordanis/hpp-corbaserver
    def argConversion(self, name, _type, _in, _out, param):
        assert _in or _out
        tmp = "_" + name
        in_conv_str = None
        out_conv_str = None

        if _type.string():
            if _in:
                in_conv_str = "std::string {} ({});".format (tmp,name)
            else  :
                in_conv_str =  "std::string {};".format (tmp)
            if _out:
                out_conv_str = "{} = hpp::corbaServer::c_str ({});".format (name, tmp)
            return tmp, in_conv_str, out_conv_str
        elif _type.typedef():
            if _type.type().name() in ("size_t", "size_type", "value_type"):
                return name, "", out_conv_str
            elif _type.type().name() == "floatSeq":
                if _in:
                    in_conv_str  = "hpp::core::vector_t {} = hpp::corbaServer::floatSeqToVector ({});".format (tmp,name)
                else: # !_in => _out
                    in_conv_str  = "hpp::core::vector_t {};".format (tmp,name)
                if _out:
                    out_conv_str = "hpp::corbaServer::vectorToFloatSeq ({}, {});".format (tmp,name)
                return tmp, in_conv_str, out_conv_str
            elif _type.type().name() == "Transform_":
                if _out: raise makeError("out Transform_ is currently not supported", param.file(), param.line())
                return tmp, "hpp::core::Transform3f {} = hpp::corbaServer::toTransform3f ({});".format (tmp,name), out_conv_str
            elif _type.type().name() == "Names_t":
                in_conv_str  = "typedef std::vector<std::string> strings_t;"
                if _in:
                    in_conv_str  += "strings_t {} = hpp::corbaServer::toStrings<strings_t> ({});".format (tmp,name)
                else:
                    in_conv_str  += "strings_t {};".format (tmp,name)
                if _out:
                    out_conv_str  = "hpp::corbaServer::toNames_t ({var}.begin(), {var}.end());".format (var=tmp)
                return tmp, in_conv_str, out_conv_str;
            print ("typedef", _type.type().name())
            return name, "", out_conv_str
        elif _type.is_basic_data_types():
            return name, "", out_conv_str
        elif _type.objref():
            if _out: raise makeError("out objects is currently not supported", param.file(), param.line())
            conv = "{typeptr} {tmp} = reference_to_servant_base<{type}>(server_, {name})->get();" \
                    .format(type   =self.toCppNamespace(id.Name(_type.type().scopedName())                ).fullyQualify(cxx=1),
                            typeptr=self.toCppNamespace(id.Name(_type.type().scopedName()).suffix("Ptr_t")).fullyQualify(cxx=1),
                            servanttype=hpp_servant_name(id.Name(_type.type().scopedName())),
                            tmp=tmp, name=name)
            return tmp, conv, out_conv_str
        print (_type.type(), _type.kind())
        return name, "", out_conv_str
コード例 #9
0
    def free(self, thing, environment=None):
        """Ensures that any heap allocated storage associated with this type
           has been deallocated."""

        if self.array():
            name = id.Name(self.type().decl().scopedName()).suffix("_free")
            return name.unambiguous(environment) + "(" + thing + ");"

        d_T = self.deref()

        if d_T.interface() or d_T.typecode():
            return "::CORBA::release(" + thing + ");"
        if d_T.string(): return "::CORBA::string_free(" + thing + ");"

        if d_T.wstring(): return "::CORBA::wstring_free(" + thing + ");"

        if d_T.struct() or d_T.union() or d_T.exception() or \
           d_T.sequence() or d_T.any():
            if d_T.variable():
                return "delete " + thing + ";"
            return ""  # stored by value

        if d_T.enum() or d_T.void() or (self.is_basic_data_types()):
            return ""

        raise "Don't know how to free type, kind = " + str(d_T.kind())
コード例 #10
0
    def base(self, environment=None, gscope=0):
        """base(types.Type, id.Environment option): C++ type string
           Returns a basic C++ mapped version of the type"""
        kind = self.kind()
        d_type = self.deref(1)
        d_kind = d_type.kind()

        # CORBA2.3 P1-15 1.5 Mapping for Basic Data Types
        if basic_map.has_key(kind):
            return basic_map[kind]
        if self.string() or d_type.string():
            return "char*"
        if self.wstring() or d_type.wstring():
            return "::CORBA::WChar*"
        if self.typecode():
            return "::CORBA::TypeCode_ptr"
        if self.any():
            return "::CORBA::Any"
        if self.void():
            return "void"
        if self.fixed():
            return "::CORBA::Fixed"
        if self.sequence():
            return self.sequenceTemplate(environment, gscope=gscope)

        name = id.Name(self.type().scopedName()).unambiguous(environment)
        if gscope:
            assert environment is None
            name = "::" + name

        if d_type.interface() or d_type.typecode():
            return name + "_ptr"
        else:
            return name
コード例 #11
0
    def generate_BOA_tie(self, node):
        name = id.Name(node.scopedName())
        tie_name = "_tie_" + "_".join(name.fullName())
        sk_name = name.prefix("_sk_")

        write_template(tie_name, sk_name.fullyQualify(), node, self.stream,
                       Template = template.tie_template_old)
コード例 #12
0
ファイル: typecode.py プロジェクト: SD2019-2/rodrigozago
def visitValueBox(node):
    boxedType = types.Type(node.boxedType())

    recurse(boxedType, node.constrType())

    scopedName = node.scopedName()
    mangled_name = mangleName(config.state['Private Prefix'] +\
                              "_tc_", scopedName)
    if alreadyDefined(mangled_name):
        return

    repoID = node.repoId()
    typecode = mkTypeCode(boxedType)

    scopedName = node.scopedName()
    boxed_name = id.Name(scopedName).simple()

    tophalf.out("""\
static CORBA::TypeCode_ptr @mangled_name@ = CORBA::TypeCode::PR_value_box_tc("@repoID@", "@name@", @typecode@, &@pprefix@_tcTrack);

""",
                mangled_name=mangled_name,
                repoID=repoID,
                name=boxed_name,
                typecode=typecode,
                pprefix=config.state['Private Prefix'])

    defineName(mangled_name)
    external_linkage(node)
コード例 #13
0
def visitTypedef(node):
    aliasType = types.Type(node.aliasType())
    d_type = aliasType.deref()

    if node.constrType():
        aliasType.type().decl().accept(self)

    for d in node.declarators():
        scopedName = id.Name(d.scopedName())
        
        if d_type.sequence() and not aliasType.typedef():
            seqType = types.Type(d_type.type().seqType())
            d_seqType = seqType.deref()

            if d_seqType.structforward() or d_seqType.unionforward():
                fqname  = scopedName.fullyQualify()
                name    = id.mapID(d.identifier())
                element = d_seqType.base()
                bound   = d_type.type().bound()
                derived = d_type.sequenceTemplate()
                
                if bound > 0:
                    stream.out(template.sequence_forward_bounded_defns,
                               bound=bound, fqname=fqname, name=name,
                               element=element, derived=derived)
                else:
                    stream.out(template.sequence_forward_unbounded_defns,
                               fqname=fqname, name=name,
                               element=element, derived=derived)

                stream.out(template.sequence_forward_defns,
                           fqname=fqname, name=name, element=element)
コード例 #14
0
ファイル: main.py プロジェクト: SD2019-2/rodrigozago
def visitStruct(node):

    outer_environment = id.lookup(node)
    environment = outer_environment.enter(node.identifier())

    scopedName = id.Name(node.scopedName())

    for n in node.members():
        n.accept(self)

    def marshal(stream=stream, node=node, env=environment):
        for n in node.members():
            memberType = types.Type(n.memberType())
            for d in n.declarators():
                scopedName = id.Name(d.scopedName())
                member_name = scopedName.simple()
                skutil.marshall(stream, env, memberType, d, member_name, "_n")
        return

    def unmarshal(stream=stream, node=node, env=environment):
        for n in node.members():
            memberType = types.Type(n.memberType())
            for d in n.declarators():
                scopedName = id.Name(d.scopedName())
                member_name = scopedName.simple()
                skutil.unmarshall(stream, env, memberType, d, member_name,
                                  "_n")
        return

    stream.out(template.struct,
               name=scopedName.fullyQualify(),
               marshall_code=marshal,
               unmarshall_code=unmarshal)

    stream.reset_indent()
コード例 #15
0
def hpp_servant_scope(name):
    scope = [n.replace('_idl', '_impl') for n in name.scope()] + [
        name.simple(cxx=0),
    ]
    if scope[1] != "corbaServer":
        scope.insert(1, "corbaServer")
    return id.Name(scope)
コード例 #16
0
    def typeName(type):
        assert isinstance(type, types.Type)
        d_type = type.deref()
        # dereference the type, until just -before- it becomes a
        # sequence. Since a sequence doesn't have a scopedName(),
        # we use the scopedName() of the immediately preceeding
        # typedef which is an instance of idltype.Declared
        while type.typedef() and \
              not types.Type(type.type().decl().alias().aliasType()).sequence():
            type = types.Type(type.type().decl().alias().aliasType())

        if name_map.has_key(type.type().kind()):
            return name_map[type.type().kind()]
        if type.string():
            bound = ""
            if type.type().bound() != 0:
                bound = str(type.type().bound())
            return bound + "string"
        if type.wstring():
            bound = ""
            if type.type().bound() != 0:
                bound = str(type.type().bound())
            return bound + "wstring"

        if isinstance(type.type(), idltype.Fixed):
            return str(type.type().digits()) + "_" + \
                   str(type.type().scale()) + "fixed"

        if isinstance(type.type(), idltype.Declared):
            return id.Name(type.type().scopedName()).guard()

        util.fatalError("Error generating mangled name")
コード例 #17
0
ファイル: typecode.py プロジェクト: SD2019-2/rodrigozago
def visitDeclarator(declarator):
    # this must be a typedef declarator

    node = declarator.alias()
    aliasType = types.Type(node.aliasType())

    recurse(aliasType)

    scopedName = declarator.scopedName()
    mangled_name = mangleName(config.state['Private Prefix'] + "_tc_",
                              scopedName)
    if alreadyDefined(mangled_name):
        return

    repoID = declarator.repoId()
    typecode = mkTypeCode(aliasType, declarator)

    scopedName = declarator.scopedName()
    typedef_name = id.Name(scopedName).simple()

    tophalf.out("""\
static CORBA::TypeCode_ptr @mangled_name@ = CORBA::TypeCode::PR_alias_tc("@repoID@", "@name@", @typecode@, &@pprefix@_tcTrack);

""",
                mangled_name=mangled_name,
                repoID=repoID,
                name=typedef_name,
                typecode=typecode,
                pprefix=config.state['Private Prefix'])
    defineName(mangled_name)

    external_linkage(declarator)
コード例 #18
0
ファイル: typecode.py プロジェクト: SD2019-2/rodrigozago
def buildStateMembersStructure(node):
    struct = output.StringStream()
    mangled_name = mangleName(config.state['Private Prefix'] + \
                              "_valuemember_", node.scopedName())
    if alreadyDefined(mangled_name):
        # no need to regenerate
        return struct

    defineName(mangled_name)

    members = node.statemembers()
    array = []

    if members:
        for m in members:
            memberType = types.Type(m.memberType())
            access = m.memberAccess()
            for d in m.declarators():
                this_name = id.Name(d.scopedName()).simple()
                typecode = mkTypeCode(memberType, d, node)
                array.append('{"%s", %s, %d}' % (this_name, typecode, access))

        struct.out("""\
static CORBA::PR_valueMember @mangled_name@[] = {
  @members@
};""",
                   members=",\n".join(array),
                   mangled_name=mangled_name)
    else:
        struct.out("""\
static CORBA::PR_valueMember* @mangled_name@ = 0;""",
                   mangled_name=mangled_name)

    return struct
コード例 #19
0
ファイル: typecode.py プロジェクト: SD2019-2/rodrigozago
def visitInterface(node):
    if node.builtIn(): return

    # interfaces containing members with the type of the interface
    # cause a minor (non fatal) problem with ordering of the outputted
    # declarations. This check only serves to correct this cosmetic flaw
    # and make the output of the new system identical to the old one.
    if hasattr(node, "typecode_already_been_here"):
        return

    node.typecode_already_been_here = 1

    startingNode(node)

    insideModule = self.__immediatelyInsideModule
    self.__immediatelyInsideModule = 0
    for n in node.declarations():
        n.accept(self)
    self.__immediatelyInsideModule = insideModule

    repoID = node.repoId()
    iname = id.Name(node.scopedName()).simple()

    if node.abstract():
        func = "PR_abstract_interface_tc"
    elif node.local():
        func = "PR_local_interface_tc"
    else:
        func = "PR_interface_tc"

    typecode = 'CORBA::TypeCode::' + func + '("' + repoID + '", "' +\
               iname + '", &' + config.state['Private Prefix'] + '_tcTrack)'

    external_linkage(node, typecode)
    finishingNode()
コード例 #20
0
ファイル: typecode.py プロジェクト: SD2019-2/rodrigozago
def buildMembersStructure(node):
    struct = output.StringStream()
    mangled_name = mangleName(config.state['Private Prefix'] + \
                              "_structmember_", node.scopedName())
    if alreadyDefined(mangled_name):
        # no need to regenerate
        return struct

    defineName(mangled_name)

    members = node.members()
    array = []

    for m in members:
        memberType = types.Type(m.memberType())
        for d in m.declarators():
            this_name = id.Name(d.scopedName()).simple()
            typecode = mkTypeCode(memberType, d, node)
            array.append("{\"" + this_name + "\", " + typecode + "}")

    if len(members) > 0:
        struct.out("""\
static CORBA::PR_structMember @mangled_name@[] = {
  @members@
};""",
                   members=",\n".join(array),
                   mangled_name=mangled_name)

    return struct
コード例 #21
0
def visitTypedef(node):
    if node.constrType():
        node.aliasType().decl().accept(self)

    aliasType = types.Type(node.aliasType())
    prefix = config.state['Private Prefix']

    for d in node.declarators():
        scopedName = id.Name(d.scopedName())
        guard_name = scopedName.guard()
        fqname = scopedName.fullyQualify()

        if d.sizes():
            # Array
            marshal = output.StringStream()
            skutil.marshall(marshal, None, aliasType, d, "_a", "_s")

            unmarshal = output.StringStream()
            skutil.unmarshall(unmarshal, None, aliasType, d, "_a", "_s")

            stream.out(template.array,
                       guard_name=guard_name,
                       fqname=fqname,
                       marshal=marshal,
                       unmarshal=unmarshal,
                       private_prefix=prefix)

        elif aliasType.sequence():
            stream.out(template.sequence,
                       guard_name=guard_name,
                       fqname=fqname,
                       private_prefix=prefix)
コード例 #22
0
 def __init__(self, node):
     self._node = node
     self._environment = id.lookup(node)
     self._node_name = id.Name(node.scopedName())
     self._callables = None
     self._ami_callables = None
     self._ami_handler = None
     self._ami_poller = None
コード例 #23
0
ファイル: main.py プロジェクト: SD2019-2/rodrigozago
 def marshal(stream=stream, node=node, env=environment):
     for n in node.members():
         memberType = types.Type(n.memberType())
         for d in n.declarators():
             scopedName = id.Name(d.scopedName())
             member_name = scopedName.simple()
             skutil.marshall(stream, env, memberType, d, member_name, "_n")
     return
コード例 #24
0
ファイル: main.py プロジェクト: stjordanis/hpp-corbaserver
    def __init__(self, decl, impl):
        #super(BuildInterfaceImplementations, self).__init__()
        Builder.__init__(self)
        self.interface_declarations    = decl
        self.interface_implementations = impl
        self.environment = id.Name (["hpp", "corbaServer", ""])
        self.includes = ""

        self.storages = {}
コード例 #25
0
def visitStruct(node):
    for n in node.members():
        n.accept(self)

    # TypeCode and Any
    if config.state['Typecode']:
        fqname = id.Name(node.scopedName()).fullyQualify()

        stream.out(template.any_struct, fqname=fqname)
コード例 #26
0
    def visitInterface(self, node):
        name = id.Name(node.scopedName())

        tie_name = name.simple()
        if len(node.scopedName()) == 1: tie_name = "_tie_" + tie_name
        
        sk_name = name.prefix("_sk_")
        
        write_template(tie_name, sk_name.fullyQualify(), node, self.stream,
                       Template = template.tie_template_old)
コード例 #27
0
def visitValueAbs(node):
    # Nested declarations
    for d in node.declarations():
        d.accept(self)

    # Typecode and Any
    if config.state['Typecode']:
        fqname = id.Name(node.scopedName()).fullyQualify()

        stream.out(template.any_value, fqname=fqname)
コード例 #28
0
def visitValueBox(node):
    scopedName = id.Name(node.scopedName())
    guard_name = scopedName.guard()
    fqname = scopedName.fullyQualify()
    prefix = config.state['Private Prefix']

    stream.out(template.value,
               guard_name=guard_name,
               fqname=fqname,
               private_prefix=prefix)
コード例 #29
0
ファイル: poa.py プロジェクト: SD2019-2/rodrigozago
def visitInterface(node):
    if node.local():
        return

    name = id.mapID(node.identifier())
    fqname = id.Name(node.scopedName()).fullyQualify()
    stream.out(template.interface_POA,
               POA_prefix=POA_prefix(),
               name=name,
               fqname=fqname)
コード例 #30
0
ファイル: main.py プロジェクト: Statixcinder/OMDev
def visitTypedef(node):
    environment = id.lookup(node)
    is_global_scope = not (self.__insideModule or self.__insideInterface)

    aliasType = types.Type(node.aliasType())
    d_type = aliasType.deref()

    if node.constrType():
        aliasType.type().decl().accept(self)

    fq_aliased = aliasType.base(environment)

    for d in node.declarators():
        scopedName = id.Name(d.scopedName())

        decl_dims = d.sizes()
        decl_dims_str = cxx.dimsToString(decl_dims)
        decl_first_dim_str = ""
        if decl_dims != []:
            decl_first_dim_str = cxx.dimsToString([decl_dims[0]])

        full_dims = decl_dims + aliasType.dims()
        is_array = full_dims != []
        is_array_declarator = decl_dims != []

        fq_derived = scopedName.fullyQualify()

        if d_type.sequence() and not aliasType.typedef():
            seqType = types.Type(d_type.type().seqType())
            d_seqType = seqType.deref()
            if d_seqType.structforward() or d_seqType.unionforward():
                fqname = scopedName.fullyQualify()
                name = id.mapID(d.identifier())
                element = d_seqType.base()
                bound = d_type.type().bound()
                derived = d_type.sequenceTemplate()

                if (bound > 0):
                    stream.out(template.sequence_forward_bounded_defns,
                               bound=bound,
                               fqname=fqname,
                               name=name,
                               element=element,
                               derived=derived)
                else:
                    stream.out(template.sequence_forward_unbounded_defns,
                               fqname=fqname,
                               name=name,
                               element=element,
                               derived=derived)

                stream.out(template.sequence_forward_defns,
                           fqname=fqname,
                           name=name,
                           element=element)