Esempio n. 1
0
def domainInterface2dict(semObj):
    out = a3t.gen2dict(semObj)

    da = a3t.inTwo(semObj, "domainAdapter2domainInterface")
    if da == None:
        reportError("Domain interface must take a domain adapter on input.", semObj)
        ## Have to short-circuit to prevent weird errors from happening.
        return out
    else:
        attributes = a3t.getAttributes(da)
        out["parameters"] = attributes

    iCall = a3t.outOne(semObj, "domainInterface2Interface")
    i = a3t.outTwo(semObj, "domainInterface2Interface")
    if i == None:
        reportError("Domain interface must call a local interface.", semObj)
    else:
        name = a3t.evalAtom3Type(i.name)
        calls = a3t.gen2dict(iCall)
        iParameters = a3t.evalAtom3Type(i.parameters)
        calls["name"] = name
        out["calls"] = calls

        ## Constraints on interface call.
        testCall(calls["arguments"], out["parameters"], iParameters, iCall)

    deleteEmptyKeys(out)

    testValidName(out.get("name"), semObj)

    return out
Esempio n. 2
0
File: rosc.py Progetto: OEP/rdis
def getOutput(rosTopic):
  """
  Gets the domain output associated with this topic.
  """
  do = a3t.inTwo(rosTopic, "GenericGraphEdge")
  if do == None:
    reportError("ROS published topic must be connected to RDIS domain output!", rosTopic)
  return do
Esempio n. 3
0
File: rosc.py Progetto: OEP/rdis
def getOutputAdapter(do):
  """
  Gets domain adapter associated with domain output.
  """
  adapter = a3t.inTwo(do, "domainAdapter2domainOutput")
  if adapter == None:
    reportError("Domain output has no adapter tied to it.", do)
    return None
  return adapter
Esempio n. 4
0
File: rosc.py Progetto: OEP/rdis
def getInterfaceAdapter(di):
  """
  Gets domain adapter associated with domain interface.
  """
  dit = a3t.inTwo(di, "domainAdapter2domainInterface")
  if dit == None:
    reportError("Domain interface has no adapter tied to it.", di)
    return None
  return dit
Esempio n. 5
0
def domainOutput2dict(domainOutput):
    out = a3t.gen2dict(domainOutput)

    da = a3t.inTwo(domainOutput, "domainAdapter2domainOutput")
    if da == None:
        reportError("Domain output must take a domain adapter on input.", domainOutput)
    else:
        returns = a3t.gen2dict(da)
        testValidArgs(returns.values(), [], da)
        out["returns"] = returns

    deleteEmptyKeys(out)
    testValidName(out.get("name"), domainOutput)
    return out