Skip to content
Snippets Groups Projects
Commit 6be6c793 authored by Jan David Mol's avatar Jan David Mol
Browse files

Merge branch 'L2SS-300-add-comms-id' into 'master'

L2SS-300: Allow annotation about the class of attribute the comms_annotation...

Closes L2SS-300

See merge request !76
parents 3f3a8836 11fb0574
No related branches found
No related tags found
1 merge request!76L2SS-300: Allow annotation about the class of attribute the comms_annotation...
...@@ -14,11 +14,12 @@ class attribute_wrapper(attribute): ...@@ -14,11 +14,12 @@ class attribute_wrapper(attribute):
Wraps all the attributes in a wrapper class to manage most of the redundant code behind the scenes Wraps all the attributes in a wrapper class to manage most of the redundant code behind the scenes
""" """
def __init__(self, comms_annotation=None, datatype=None, dims=(1,), access=AttrWriteType.READ, init_value=None, **kwargs): def __init__(self, comms_id=None, comms_annotation=None, datatype=None, dims=(1,), access=AttrWriteType.READ, init_value=None, **kwargs):
""" """
wraps around the tango Attribute class. Provides an easier interface for 1d or 2d arrays. Also provides a way to abstract wraps around the tango Attribute class. Provides an easier interface for 1d or 2d arrays. Also provides a way to abstract
managing the communications interface. managing the communications interface.
comms_id: user-supplied identifier that is attached to this object, to identify which communication class will need to be attached
comms_annotation: data passed along to the attribute. can be given any form of data. handling is up to client implementation comms_annotation: data passed along to the attribute. can be given any form of data. handling is up to client implementation
datatype: any numpy datatype datatype: any numpy datatype
dims: dimensions of the attribute as a tuple, or (1,) for a scalar. dims: dimensions of the attribute as a tuple, or (1,) for a scalar.
...@@ -31,6 +32,7 @@ class attribute_wrapper(attribute): ...@@ -31,6 +32,7 @@ class attribute_wrapper(attribute):
if "numpy" not in str(datatype) and datatype != str: if "numpy" not in str(datatype) and datatype != str:
raise TypeError("Attribute needs to be a Tango-supported numpy or str type, but has type \"%s\"" % (datatype,)) raise TypeError("Attribute needs to be a Tango-supported numpy or str type, but has type \"%s\"" % (datatype,))
self.comms_id = comms_id # store data that can be used to identify the comms interface to use. not used by the wrapper itself
self.comms_annotation = comms_annotation # store data that can be used by the comms interface. not used by the wrapper itself self.comms_annotation = comms_annotation # store data that can be used by the comms interface. not used by the wrapper itself
self.numpy_type = datatype # tango changes our attribute to their representation (E.g numpy.int64 becomes "DevLong64") self.numpy_type = datatype # tango changes our attribute to their representation (E.g numpy.int64 becomes "DevLong64")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment