Commit 51427967 authored by payno's avatar payno

[scheme] rework SubScheme and relative functions.

- add id to SubScheme
- add rlinks, rnodes and rsub_schemes which allows you to access to all links, nodes and sub_schemes recursively
- rework from / to json functions to fit the new description
- move some function to static for conveniance

warning: for now the rnodes and rlinks are created once for all. Only a call to _reset can apply modification to them once created
parent 7cf70c6e
......@@ -225,13 +225,13 @@ class Node(object):
}
@staticmethod
def from_json(json_data):
def load_node_info_from_json(json_data):
"""
load fom json stream the Node Information
:param json_data: node description
:return: New node created from the json description
:rtype: Node
:raise ValueError: if properties or id or processing_pt missing
:return: node id, properties, pointer to the process to run
:rtype: tuple
"""
# load properties
if Node._JSON_PROPERTIES not in json_data:
......@@ -253,7 +253,18 @@ class Node(object):
_process_pt = None
else:
_process_pt = json_data[Node._JSON_PROCESS_PT]
return _id, _properties, _process_pt
@staticmethod
def from_json(json_data):
"""
:param json_data: node description
:return: New node created from the json description
:rtype: Node
:raise ValueError: if properties or id or processing_pt missing
"""
_id, _properties, _process_pt = Node.load_node_info_from_json(json_data)
if _properties is None or _id is None or _process_pt is None:
raise ValueError('Unable to create Node from json, core information '
'are missing')
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment