Parameter tree
parameter_tree.py - classes representing a sychronous parameter tree and accessor.
This module defines a parameter tree and accessor for use in synchronous API adapters, where concurrency over blocking operations (e.g. to read/write the value of a parameter from hardware) is not required.
Tim Nicholls, STFC Detector Systems Software Group.
ParameterAccessor
Bases: BaseParameterAccessor
Synchronous container class representing accessor methods for a parameter.
This class extends the base parameter accessor class to support synchronous set and get accessors for a parameter. Read-only and writeable parameters are supported, and the same metadata fields are implemented.
Source code in src/odin_control/adapters/parameter_tree.py
__init__(path, getter=None, setter=None, **kwargs)
Initialise the ParameterAccessor instance.
This constructor initialises the ParameterAccessor instance, storing the path of the parameter, its set/get accessors and setting metadata fields based on the the specified keyword arguments.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
path of the parameter within the tree |
required | |
getter
|
get method for the parameter, or a value if read-only constant |
None
|
|
setter
|
set method for the parameter |
None
|
|
kwargs
|
keyword argument list for metadata fields to be set; these must be from the allow list specified in BaseParameterAccessor.allowed_metadata |
{}
|
Source code in src/odin_control/adapters/parameter_tree.py
ParameterTree
Bases: BaseParameterTree
Class implementing a synchronous tree of parameters and their accessors.
This lass implements an arbitrarily-structured, recursively-managed tree of parameters and the appropriate accessor methods that are used to read and write those parameters.
Source code in src/odin_control/adapters/parameter_tree.py
__init__(tree, mutable=False)
Initialise the ParameterTree object.
This constructor recursively initialises the ParameterTree object based on the specified arguments. The tree initialisation syntax follows that of the BaseParameterTree implementation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tree
|
dict representing the parameter tree |
required | |
mutable
|
Flag, setting the tree |
False
|