瀏覽代碼

Added basic model_render function (no error handling yet)

Yentl Van Tendeloo 8 年之前
父節點
當前提交
f70a78d6ad
共有 1 個文件被更改,包括 20 次插入3 次删除
  1. 20 3
      wrappers/modelverse.py

+ 20 - 3
wrappers/modelverse.py

@@ -5,7 +5,7 @@ import random
 from urllib2 import URLError
 import sys
 
-# Bind to the compiler
+# Bind to the compiler (might have to update path manually!)
 sys.path.append("../interface/HUTN")
 from hutn_compiler.compiler import main as do_compile
 
@@ -329,6 +329,25 @@ def user_delete():
     _input("self-destruct")
     mode = 0
 
+def model_render(model, mapper):
+    """Fetch a rendered verion of a model."""
+    # return JSON_representation
+    # raises UnknownException
+    # raises UnknownIdentifier
+    # raises InterfaceMismatch
+    global mode
+    if mode != 2:
+        raise InvalidMode()
+
+    _input("model_render")
+    _output()
+    _input(model)
+    _output()
+    _input(mapper)
+    rendered = _output()
+    _output("Ready for command...")
+    return rendered
+
 def transformation_add_MT_language():
     """Create a new Model Transformation language out of a set of metamodels."""
     raise NotImplementedError()
@@ -752,7 +771,6 @@ def read_incoming(ID, typename):
 
 def read_association_source(ID):
     """Returns the source of an association."""
-    pass
     # returns name
     # raises UnknownError
     # raises UnknownIdentifier
@@ -775,7 +793,6 @@ def read_association_source(ID):
 
 def read_association_destination(ID):
     """Returns the destination of an association."""
-    pass
     # returns name
     # raises UnknownError
     # raises UnknownIdentifier