Skip to navigation

hololink::module::EnumerationMetadata

View as Markdown

Encapsulates HSB device configuration.

Typical EnumerationMetadata lifecycle:

  • constructed from received network messages (e.g. BOOTP)
  • updated by a loadable module that is specific to that device
  • updated by the application layer for specific configuration changes (e.g. changing some default behavior)
  • used to initialize service objects that configure and interface to HSB functions

The framework puts no restrictions on the pairs stored here; a Module and its services are free to coordinate through fields of their own. Values are integers, strings or byte blobs, and every std::map operation is available for working with them.

#include <hololink/module/enumeration_metadata.hpp>

Example

adapter = hololink_module.Adapter.get_adapter()
# Find a data channel on an HSB device--
# this returns EnumerationMetadata configured with this channel.
hololink_ip = "192.168.0.2" # as appropriate
discovery_timeout_s = 30
metadata = adapter.wait_for_channel(hololink_ip, discovery_timeout_s)
# That channel is the first data port on a typical
# HsbLite device, which would transfer data from
# sensor 0. We can change this default and make it
# listen to sensor 1 instead:
sensor_number = 1
adapter.use_sensor(metadata, sensor_number)
# Now instantiate our device driver this way
camera = hololink_module.sensors.vb1940.Vb1940Cam(metadata)
# ...

Inherits from: std::map< std::string, std::variant< int64_t, std::string, std::vector< uint8_t > > > (public)


Methods

contains

bool hololink::module::EnumerationMetadata::contains(
const std::string &key
) const

Report whether a field is present, whatever type it holds.

Returns: True when the field is present.

Parameters

key
const std::string &

Name of the field to test.

get

template <typename T>
T hololink::module::EnumerationMetadata::get(
const std::string &key
) const

Fetch the value of a field, which must be present.

Returns: The field’s value.

Throws: std::runtime_error if the field is absent or holds another type. Use the overload taking a default value for a field that is genuinely optional.

Template parameters

T
typename

The expected type for the data.

Parameters

key
const std::string &

Name of the field to fetch.


Types

Typedefs

NameDefinitionDescription
Valuemapped_typeA stored value: an int64_t, a std::string, or a byte blob.

Member variables

NameTypeDescription
keysKSTL member.
elementsTSTL member.