Symphony-DAS / symphony-matlab

Symphony Data Acquisition System
http://symphony-das.github.io
MIT License
19 stars 5 forks source link

allow optional passing of parent to source #50

Closed zfj1 closed 3 years ago

zfj1 commented 3 years ago

This is a simple pull request that extends the functionality of sources.

With this change, a source description constructor can optionally take the parent source as an input argument. This allows sources to modify themselves depending on the parent.

An example use case is to only allow creation of Cell sources under Mouse objects that have no default values. In the Cell constructor, one would check each property of the mouse object against an empty string (using parent.getProperty()), and throw an error if one is found.

This change should be fully backwards compatible, since the number of input arguments for the constructor is checked before passing the parent as an argument.

cafarm commented 3 years ago

Looks good. Thanks!