Node
Spinnaker uses GenICam to declare and make available the system and camera properties as well-defined nodes with a clear API.
Each node represents a camera or system property, and they
can be e.g. a SpinIntNode
, SpinFloatNode
,
SpinBoolNode
, SpinStrNode
, SpinCommandNode
etc. E.g.
a SpinIntNode
supports getting and setting a value, getting
the optionally allowed increments, and getting the unit etc.
All nodes inherit from SpinBaseNode
, but some nodes have additional
inheritance adding more functionality. E.g. SpinIntNode
inherits from
SpinSelectorNode
, SpinNode
, and SpinValueNode
.
Node access
There are two approaches to getting access to the nodes: using the pre-listed
nodes or getting it by name/index from a NodeMap
.
You can get the pre-listed nodes for the system, interface, and camera from
system_nodes
,
interface_nodes
,
camera_nodes
,
tl_dev_nodes
, and
tl_stream_nodes
, respectively.
To use a NodeMap
, you first have to get an instance and then
look up a node by name. Like the pre-listed nodes, you can get the node map
for the system, interface, and camera from
get_tl_node_map()
,
get_tl_node_map()
,
get_node_map()
,
get_tl_dev_node_map()
, and
get_tl_stream_node_map()
, respectively.
Pre-listed nodes operate identically as getting the node from a
NodeMap
, except it provides these nodes as named properties with the
same name as the node.
E.g. to select whether the system enumerates USB devices, you have to get the
node that controls this property and then set its value. Using the pre-listed
approach on EnumerateUSBInterfaces
you’d do:
>>> from rotpy.system import SpinSystem
>>> system = SpinSystem()
>>> system.system_nodes.EnumerateUSBInterfaces
<rotpy.node.SpinBoolNode at 0x26822c20d68>
>>> # first make sure this node is actually available for this system
>>> system.system_nodes.EnumerateUSBInterfaces.is_available()
True
>>> system.system_nodes.EnumerateUSBInterfaces.get_node_value()
True
>>> system.system_nodes.EnumerateUSBInterfaces.set_node_value(False)
Similarly, using a NodeMap
from
get_tl_node_map()
you’d do:
>>> from rotpy.system import SpinSystem
>>> system = SpinSystem()
>>> node_map = system.get_tl_node_map()
>>> node = node_map.get_node_by_name('EnumerateUSBInterfaces')
>>> node is not None and node.is_available()
True
>>> node.get_node_value()
True
>>> node.set_node_value(False)
You can use these approaches interchangeably and on the same system.
Warning
Remember to always check whether the node is available and readable/writeable as needed. Even pre-listed nodes need to be checked, and being pre-listed does not mean they are implemented for the specific system/camera.
Classes:
Provides access to nodes of a camera or system. |
|
The base node class that provides functionality for checking the state of the node. |
|
Provides selection functionality to the node, if the node can be used to select other nodes (e.g. |
|
Provides basic node functionality for nodes that have additional functionality such as values etc. |
|
A node that represents a value e.g. |
|
Node that represents an integer. |
|
Node that represents a floating point number. |
|
Node that represents boolean. |
|
Node that represents a string. |
|
Node that represents a command to be executed. |
|
Node that represents a register that can be set to some bytes representing a value. |
|
Node that represents an enum class. |
|
Same as |
|
Represents an entry (item) of a |
|
Node that is a parent and contains other nodes as children. |
|
Node that represents a pure data port. |
- class NodeMap
Bases:
object
Provides access to nodes of a camera or system.
See
node
for details.Methods:
Connects a port to another port.
Returns the device name.
Gets a node from the node map using a zero-based index that is less than
get_num_nodes()
.Gets a node from the node map by name.
Returns a list of all the nodes in the map.
Gets the number of nodes in the map.
Invalidates all nodes.
Fires nodes which have a polling time.
- connect_port(self, SpinPortNode node, unicode name=u'')
Connects a port to another port.
- Parameters
node – The
SpinPortNode
node to connect.name – The name of the node to connect to. If not specified (the default), it connects to the standard port “Device”.
- Returns
bool, whether it connected.
- get_dev_name(self)
Returns the device name.
The device name identifies a device instance, e.g. for debugging purposes.
- get_node_by_index(self, size_t index)
Gets a node from the node map using a zero-based index that is less than
get_num_nodes()
.- Parameters
index – The index of the node.
- Returns
A
SpinBaseNode
derived instance.
- get_node_by_name(self, unicode name)
Gets a node from the node map by name.
- Parameters
name – The string name of the node.
- Returns
A
SpinBaseNode
derived instance or None if there isn’t one with that name.
- get_nodes(self)
Returns a list of all the nodes in the map.
It only returns direct nodes of the map. If the nodes have children (e.g. enum class or tree) it is not recursed.
- get_num_nodes(self)
Gets the number of nodes in the map.
- invalidate_nodes(self)
Invalidates all nodes.
- poll(self, int64_t elapsed)
Fires nodes which have a polling time.
- Parameters
elapsed – The elapsed time.
- class SpinBaseNode
Bases:
object
The base node class that provides functionality for checking the state of the node.
Methods:
Gets the access mode of the node as a string from
AccessMode_names
.Returns whether the node is available (i.e.
Returns whether the node is implemented (i.e.
Returns whether the node is readable (i.e.
Returns whether the visibility level is less than or equal than the maximum visibility according to the visibility levels of
Visibility_names
.Returns whether the node is writable (i.e.
- get_access_mode(self)
Gets the access mode of the node as a string from
AccessMode_names
.
- is_available(self)
Returns whether the node is available (i.e. it’s implemented and available - not NI and not NA).
- is_implemented(self)
Returns whether the node is implemented (i.e. not NI).
- is_readable(self)
Returns whether the node is readable (i.e. RW or RO).
- is_visible(self, unicode visibility, unicode max_visibility)
Returns whether the visibility level is less than or equal than the maximum visibility according to the visibility levels of
Visibility_names
.
- is_writable(self)
Returns whether the node is writable (i.e. RW or WO).
- class SpinSelectorNode
Bases:
SpinBaseNode
Provides selection functionality to the node, if the node can be used to select other nodes (e.g. as a category) or if it’s selectable by another node.
Methods:
Returns a list of newly created node instances selected by this node.
Returns a list of newly created node instances that select this node.
Returns whether this feature selects a group of features.
- get_selected_nodes(self)
Returns a list of newly created node instances selected by this node.
- get_selecting_nodes(self)
Returns a list of newly created node instances that select this node.
- is_selector(self)
Returns whether this feature selects a group of features.
- class SpinNode
Bases:
SpinSelectorNode
Provides basic node functionality for nodes that have additional functionality such as values etc.
Methods:
Gets a alias node which describes the same feature in a different way.
Gets the caching mode of the node as a string from
CachingMode_names
.Gets a alias node which describes the same feature so that it can be casted.
Gets a longer description of the node.
Gets the name of the device.
Gets the display name of the node (whitespace possible).
Gets a URL pointing to the documentation of that feature.
Gets the event ID of the node.
Returns a dict of metadata of the node.
Gets the name of the node (no whitespace).
Gets the namespace of the node as a string from
NameSpace_names
.Gets the node type of the node as a string from
InterfaceType_values
.Gets recommended polling time (for non-cacheable nodes).
Gets the property value by name plus any additional attributes.
Returns a list of the names of all properties set during initialization.
Gets a short description of the node.
Gets the recommended visibility of the node as a string from
Visibility_names
.Indicates that the node's value may have changed.
Gets whether the AccessMode can be cached, as a string from
YesNo_names
.Checks whether the node value is cacheable.
Checks whether the node should not be used any more.
Checks whether the node can be reached via category nodes from a category node named "Root".
Checks whether the node value is streamable.
Imposes an access mode to the natural access mode of the node.
Sets the implementation to a reference node.
Imposes a visibility to the natural visibility of the node.
- get_alias_node(self)
Gets a alias node which describes the same feature in a different way.
- Returns
A
SpinBaseNode
derived instance or None if there isn’t one.
- get_caching_mode(self)
Gets the caching mode of the node as a string from
CachingMode_names
.
- get_cast_alias_node(self)
Gets a alias node which describes the same feature so that it can be casted.
- Returns
A
SpinBaseNode
derived instance or None if there isn’t one.
- get_description(self)
Gets a longer description of the node.
- get_dev_name(self)
Gets the name of the device.
- get_display_name(self)
Gets the display name of the node (whitespace possible).
- get_doc_url(self)
Gets a URL pointing to the documentation of that feature.
- get_event_id(self)
Gets the event ID of the node.
- get_metadata(self) dict
Returns a dict of metadata of the node.
The items are the various info on the node as accessible from the node’s methods (e.g. whether it’s readable etc.).
- get_name(self, bool fully_qualified=False)
Gets the name of the node (no whitespace).
Optionally fully qualified
- get_namespace(self)
Gets the namespace of the node as a string from
NameSpace_names
.
- get_node_type(self)
Gets the node type of the node as a string from
InterfaceType_values
.
- get_polling_time(self)
Gets recommended polling time (for non-cacheable nodes).
- get_property(self, unicode name)
Gets the property value by name plus any additional attributes.
If the property has multiple values/attribute they come with Tabs as delimiters.
It returns a 3-tuple of
(result, value, attributes)
, where result is a bool indicating the result of the call and the others are strings.
- get_property_names(self)
Returns a list of the names of all properties set during initialization.
- get_short_description(self)
Gets a short description of the node.
- get_visibility(self)
Gets the recommended visibility of the node as a string from
Visibility_names
.
- invalidate(self)
Indicates that the node’s value may have changed.
Fires the callback on this and all dependent nodes
- is_access_cachable(self)
Gets whether the AccessMode can be cached, as a string from
YesNo_names
.
- is_cachable(self)
Checks whether the node value is cacheable.
- is_deprecated(self)
Checks whether the node should not be used any more.
- is_feature(self)
Checks whether the node can be reached via category nodes from a category node named “Root”.
- is_streamable(self)
Checks whether the node value is streamable.
- set_access_mode(self, unicode mode)
Imposes an access mode to the natural access mode of the node.
mode
is s string fromAccessMode_names
.
- set_ref(self, SpinNode node)
Sets the implementation to a reference node.
- set_visibility(self, unicode visibility)
Imposes a visibility to the natural visibility of the node.
mode
is s string fromVisibility_names
.
- class SpinValueNode
Bases:
SpinNode
A node that represents a value e.g. a string, an integer etc.
Methods:
Gets the value of the node, independent of the type, as a string.
Checks if the value comes from cache or is requested from another node.
Sets the value of the node, independent of the type, from a string.
- get_node_value_as_str(self, bool verify=False, bool ignore_cache=False)
Gets the value of the node, independent of the type, as a string.
- Parameters
verify – Whether to verify the Range verification. The access mode is always checked.
ignore_cache – If true the value is read ignoring any caches.
- Returns
A string representing the node’s value.
- is_value_cached(self)
Checks if the value comes from cache or is requested from another node.
- set_node_value_from_str(self, unicode value, bool verify=True)
Sets the value of the node, independent of the type, from a string.
- Parameters
value – The value to which to set the node. It is important to ensure that the value of the string is appropriate to the node type.
verify – Whether to verify the node access mode and range.
- class SpinIntNode
Bases:
SpinValueNode
Node that represents an integer.
Methods:
Gets the increment value of the node.
Gets the increment mode string of the node as listed in :attr:`~rotpy.names.geni.IncMode_names.
Gets the maximum allowed value of the node.
Gets the minimum allowed value of the node.
Gets the value of the node.
Gets the name of the representation that this node represents.
Gets the physical unit name as a string.
Gets list of valid values.
Sets the maximum allowed value of the node.
Sets the minimum allowed value of the node.
Sets the value of the node.
- get_increment(self)
Gets the increment value of the node. All possible values must be divisible by this.
- get_increment_mode(self)
Gets the increment mode string of the node as listed in :attr:`~rotpy.names.geni.IncMode_names.
- get_max_value(self)
Gets the maximum allowed value of the node.
- get_min_value(self)
Gets the minimum allowed value of the node.
- get_node_value(self, bool verify=False, bool ignore_cache=False)
Gets the value of the node.
- Parameters
verify – Enables Range verification. The access mode is always checked.
ignore_cache – If true the value is read ignoring any caches.
- Returns
The node’s integer value.
- get_representation(self)
Gets the name of the representation that this node represents. E.g. linear, logarithmic, hexidecimal, MAC etc.
It returns a name from
Representation_names
- get_unit(self)
Gets the physical unit name as a string.
- get_valid_values(self, bool bounded=True)
Gets list of valid values.
- Parameters
bounded – Whether to bound the values.
- set_max_value(self, int64_t value)
Sets the maximum allowed value of the node.
- set_min_value(self, int64_t value)
Sets the minimum allowed value of the node.
- set_node_value(self, int64_t value, bool verify=True)
Sets the value of the node.
- Parameters
value – The value to which to set the node.
verify – Enables access mode and range verification.
- class SpinFloatNode
Bases:
SpinValueNode
Node that represents a floating point number.
Methods:
Gets the way the float should be converted to a string.
Gets the precision to be used when converting the float to a string.
Gets the increment value of the node.
Gets the increment mode string of the node as listed in :attr:`~rotpy.names.geni.IncMode_names.
Gets the maximum allowed value of the node.
Gets the minimum allowed value of the node.
Gets the value of the node as a float.
Gets the name of the representation that this node represents.
Gets the physical unit name as a string.
Gets list of valid values.
Gets whether the float has a constant increment.
Sets the maximum allowed value of the node.
Sets the minimum allowed value of the node.
Sets the value of the node.
- get_display_notation(self)
Gets the way the float should be converted to a string.
It returns a name from
DisplayNotation_names
- get_display_precision(self)
Gets the precision to be used when converting the float to a string.
- get_increment(self)
Gets the increment value of the node. All possible values must be divisible by this.
- get_increment_mode(self)
Gets the increment mode string of the node as listed in :attr:`~rotpy.names.geni.IncMode_names.
- get_max_value(self)
Gets the maximum allowed value of the node.
- get_min_value(self)
Gets the minimum allowed value of the node.
- get_node_value(self, bool verify=False, bool ignore_cache=False)
Gets the value of the node as a float.
- Parameters
verify – Enables Range verification. The access mode is always checked.
ignore_cache – If true the value is read ignoring any caches.
- Returns
The node’s floating point value.
- get_representation(self)
Gets the name of the representation that this node represents. E.g. linear, logarithmic, hexidecimal, MAC etc.
It returns a name from
Representation_names
- get_unit(self)
Gets the physical unit name as a string.
- get_valid_values(self, bool bounded=True)
Gets list of valid values.
- Parameters
bounded – Whether to bound the values.
- has_increment(self)
Gets whether the float has a constant increment.
- set_max_value(self, double value)
Sets the maximum allowed value of the node.
- set_min_value(self, double value)
Sets the minimum allowed value of the node.
- set_node_value(self, double value, bool verify=True)
Sets the value of the node.
- Parameters
value – The value to which to set the node.
verify – Enables access mode and range verification.
- class SpinBoolNode
Bases:
SpinValueNode
Node that represents boolean.
Methods:
Gets the value of the node as a bool.
Sets the value of the node.
- get_node_value(self, bool verify=False, bool ignore_cache=False)
Gets the value of the node as a bool.
- Parameters
verify – Enables Range verification. The access mode is always checked.
ignore_cache – If true the value is read ignoring any caches.
- Returns
The node’s boolean value.
- set_node_value(self, bool value, bool verify=True)
Sets the value of the node.
- Parameters
value – The value to which to set the node.
verify – Enables access mode and range verification.
- class SpinStrNode
Bases:
SpinValueNode
Node that represents a string.
Methods:
Gets the maximum length of the node's string in bytes.
Gets the value of the node as a string.
Sets the value of the node.
- get_max_len(self)
Gets the maximum length of the node’s string in bytes.
- get_node_value(self, bool verify=False, bool ignore_cache=False)
Gets the value of the node as a string.
- Parameters
verify – Enables Range verification. The access mode is always checked.
ignore_cache – If true the value is read ignoring any caches.
- Returns
The node’s string value.
- set_node_value(self, unicode value, bool verify=True)
Sets the value of the node.
- Parameters
value – The value to which to set the node.
verify – Enables access mode and range verification.
- class SpinCommandNode
Bases:
SpinValueNode
Node that represents a command to be executed.
Methods:
Execute the command.
Gets whether the command is executed.
- execute_node(self, bool verify=True)
Execute the command.
- Parameters
verify – Enables access mode and range verification.
- is_done(self, bool verify=True)
Gets whether the command is executed.
- Parameters
verify – Enables Range verification. The access mode is always checked.
- class SpinRegisterNode
Bases:
SpinValueNode
Node that represents a register that can be set to some bytes representing a value.
Methods:
Gets the address of the register node.
Gets the register value of the node as a bytes object.
Sets the register's contents.
- get_address(self)
Gets the address of the register node.
- get_node_value(self, bool verify=False, bool allow_cache=False)
Gets the register value of the node as a bytes object.
- Parameters
verify – Whether to range verify the node. Access is always checked.
allow_cache – Whether to allow getting the register value from cache.
- Returns
The bytes object representing the node value.
- set_node_value(self, buffer, bool verify=True)
Sets the register’s contents.
- Parameters
buffer – A array/bytes type buffer to which to set the node.
verify – Whether to range and access verify the node.
- class SpinEnumNode
Bases:
SpinValueNode
Node that represents an enum class.
This node can be set to a specific value from the children of this node, each represented by a
SpinEnumItemNode
. Each item also is associated with a symbolic string name and an integer value. In addition, some enums (e.g.SpinEnumDefNode
) will also have a secondary name and integer associated with it that is defined by the Spinnaker API innames
.Methods:
Returns a list of
SpinEnumItemNode
instances that are the entries (items) of this enum class.Returns a list of the enum entries (items) symbolic string names.
Gets a enum entry (item) node from this enum class by its int value.
Gets a enum entry (item) node from the enum class by its symbolic string name.
Gets the int value of the enum entry (item) that this enum is currently set to.
Gets the
SpinEnumItemNode
entry that the enum is currently set to.Gets the number of entries (items) of this enum class.
Sets the enum's current value to a enum entry (item) using the entry's int value.
Sets the enum's current value to a
SpinEnumItemNode
entry.- get_entries(self)
Returns a list of
SpinEnumItemNode
instances that are the entries (items) of this enum class.Note
Every call to this function creates a list of new
SpinEnumItemNode
representing the items.
- get_entries_names(self)
Returns a list of the enum entries (items) symbolic string names.
- get_entry_by_int_value(self, int64_t value)
Gets a enum entry (item) node from this enum class by its int value.
- Parameters
value – The int value of the entry to get. This int value is the node int value, not the int associated with the enum by the Spinnaker API in
names
for some enums.- Returns
A
SpinEnumItemNode
instance or None if not found.
Note
Every call to this function creates a new
SpinEnumItemNode
.
- get_entry_by_name(self, unicode name)
Gets a enum entry (item) node from the enum class by its symbolic string name.
- Parameters
name – The symbolic string name of the enum entry to get.
- Returns
A
SpinEnumItemNode
instance or None if not found.
Note
Every call to this function creates a new
SpinEnumItemNode
.
- get_node_int_value(self, bool verify=False, bool ignore_cache=False)
Gets the int value of the enum entry (item) that this enum is currently set to.
- Parameters
verify – Enables Range verification. The access mode is always checked.
ignore_cache – If true the value is read ignoring any caches.
- Returns
An integer. This int value is the node int value, not the int associated with the enum by the Spinnaker API in
names
for some enums.
- get_node_value(self, bool verify=False, bool ignore_cache=False)
Gets the
SpinEnumItemNode
entry that the enum is currently set to.- Parameters
verify – Enables Range verification. The access mode is always checked.
ignore_cache – If true the value is read ignoring any caches.
- Returns
Note
Every call to this function creates a new
SpinEnumItemNode
.
- get_num_entries(self)
Gets the number of entries (items) of this enum class.
- set_node_int_value(self, int64_t value, bool verify=True)
Sets the enum’s current value to a enum entry (item) using the entry’s int value.
- Parameters
value – The int value to which to set the node. This int value is the node int value, not the int associated with the enum by the Spinnaker API in
names
for some enums.verify – Enables access mode and range verification.
- set_node_value(self, SpinEnumItemNode item, bool verify=True)
Sets the enum’s current value to a
SpinEnumItemNode
entry.- Parameters
item – The
SpinEnumItemNode
item to which to set the node.verify – Enables access mode and range verification.
- class SpinEnumDefNode
Bases:
SpinEnumNode
Same as
SpinEnumNode
, except that these enum instances have an associated name and integer additionally defined for its entries (items) innames
by the Spinnaker API.This class is also used for enum instances that are pre-listed e.g. in
system_nodes
orcamera_nodes
. These pre-listed enum nodes have associated names innames
hence the additional functionality.Attributes:
enum_names: dict The
xxx_names
dictionary innames
that maps the Spinnaker API given name to Spinnaker API given value for all the entries (items) of this enum.enum_values: dict The
xxx_names
dictionary innames
that maps the Spinnaker API given value to Spinnaker API given name for all the entries (items) of this enum.Methods:
Gets a enum entry (item) node from this enum class by its Spinnaker API string value as listed in
enum_names
.Gets the Spinnaker API string value of the enum entry that this enum is currently set to as listed in
enum_names
.Sets the int value corresponding to a enum item.
Sets the value of this enum to a enum entry (item) using its Spinnaker API string as listed in
enum_names
.Sets the number of enum entries (items) of this node.
- enum_names
enum_names: dict The
xxx_names
dictionary innames
that maps theSpinnaker API given name to Spinnaker API given value for all the entries (items) of this enum.
- enum_values
enum_values: dict The
xxx_names
dictionary innames
that maps theSpinnaker API given value to Spinnaker API given name for all the entries (items) of this enum.
- get_entry_by_api_str(self, unicode value)
Gets a enum entry (item) node from this enum class by its Spinnaker API string value as listed in
enum_names
.- Parameters
value – The string value of the entry to get as listed in
enum_names
.- Returns
A
SpinEnumItemNode
instance or None if not found.
Note
Every call to this function creates a new
SpinEnumItemNode
.
- get_node_api_str_value(self, bool verify=False, bool ignore_cache=False)
Gets the Spinnaker API string value of the enum entry that this enum is currently set to as listed in
enum_names
.- Parameters
verify – Enables Range verification. The access mode is always checked.
ignore_cache – If true the value is read ignoring any caches.
- set_enum_ref(self, int index, unicode name)
Sets the int value corresponding to a enum item.
- set_node_api_str_value(self, unicode value, bool verify=True)
Sets the value of this enum to a enum entry (item) using its Spinnaker API string as listed in
enum_names
.- Parameters
value – The Spinnaker API string value to which to set the node.
verify – Enables access mode and range verification.
- set_num_enums(self, int num)
Sets the number of enum entries (items) of this node.
- class SpinEnumItemNode
Bases:
SpinValueNode
Represents an entry (item) of a
SpinEnumNode
orSpinEnumDefNode
to which that node can be set to.Attributes:
enum_name: unicode For
SpinEnumItemNode
created as entries ofSpinEnumDefNode
usingSpinEnumDefNode.get_entry_by_api_str()
, it's the Spinnaker API given name of this entry as listed inSpinEnumDefNode.enum_names
.enum_value: 'int' For
SpinEnumItemNode
created as entries ofSpinEnumDefNode
usingSpinEnumDefNode.get_entry_by_api_str()
, it's the Spinnaker API given value of this entry as listed inSpinEnumDefNode.enum_values
.Methods:
Gets the enum entry (item) int value.
Gets the string symbolic representation of the item.
Gets the double (floating point) number value associated with the entry.
Returns whether the corresponding entry is self clearing.
- enum_name
enum_name: unicode For
SpinEnumItemNode
created as entries ofSpinEnumDefNode
usingSpinEnumDefNode.get_entry_by_api_str()
, it’s the Spinnaker API given name of this entry as listed inSpinEnumDefNode.enum_names
.
- enum_value
enum_value: ‘int’ For
SpinEnumItemNode
created as entries ofSpinEnumDefNode
usingSpinEnumDefNode.get_entry_by_api_str()
, it’s the Spinnaker API given value of this entry as listed inSpinEnumDefNode.enum_values
.
- get_enum_int_value(self)
Gets the enum entry (item) int value.
Note
This int value is the node int value, not the
enum_value
int associated with the enum by the Spinnaker API innames
for some enums.
- get_enum_name(self)
Gets the string symbolic representation of the item.
- get_enum_num(self)
Gets the double (floating point) number value associated with the entry.
- is_self_clearing(self)
Returns whether the corresponding entry is self clearing.
- class SpinTreeNode
Bases:
SpinValueNode
Node that is a parent and contains other nodes as children.
Methods:
Returns a list of children nodes of the tree, including sub-trees.
Gets a node from the tree by index using a zero-based index that is less than
get_num_nodes()
..Gets the number of children nodes in the tree.
- get_children(self)
Returns a list of children nodes of the tree, including sub-trees.
Note
Every call to this method creates a list of new
SpinBaseNode
representing the children.
- get_node_by_index(self, size_t index)
Gets a node from the tree by index using a zero-based index that is less than
get_num_nodes()
..- Parameters
index – The index of the child node.
- Returns
A new
SpinBaseNode
derived instance representing the child.
- get_num_nodes(self)
Gets the number of children nodes in the tree.
- class SpinPortNode
Bases:
SpinBaseNode
Node that represents a pure data port.
Methods:
Reads a chunk of bytes from the port.
Writes a chunk of bytes to the port.
- read_port(self, int64_t address, int64_t n)
Reads a chunk of bytes from the port.
- Parameters
address – The port address.
n – The number of bytes to read
- Returns
Bytes object.
- write_port(self, buffer, int64_t address)
Writes a chunk of bytes to the port.
- Parameters
buffer – A array/bytes type buffer to write.
address – The port address.