diff options
Diffstat (limited to 'src-py/model/model.py')
| -rw-r--r-- | src-py/model/model.py | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src-py/model/model.py b/src-py/model/model.py index 9ee61397..701074ab 100644 --- a/src-py/model/model.py +++ b/src-py/model/model.py @@ -1,4 +1,4 @@ -class link(): +class Link(): """ documentation anchor - this class currently carries no implementation and only acts as a documentation anchor @@ -6,4 +6,25 @@ class link(): link['__src'] - meta attribute for link source link['__dst'] - meta attribute for link destination """ - pass + + class Link_Ptr(dict): + def __init__(self, src_id=None, dst_id=None): + assert None != src_id or None != dst_id + + self['__src'] = src_id + self['__dst'] = dst_id + + @property + def src_id(self): + return self['__src'] + + @property + def dst_id(self): + return self['__dst'] + + @staticmethod + def link_ptr(src_id=None, dst_id=None): + """ + init from src_id or dst_id attributes - at least one must be provided + """ + return Link.Link_Ptr(src_id, dst_id) |
