Struct ControlMessageProxy
Defined in File control.hpp
-
struct ControlMessageProxy
-
Public Static Functions
-
static std::shared_ptr<ControlMessage> create(pybind11::dict &config)
Creates a new ControlMessage instance from a configuration dictionary.
- Parameters
- Returns
config – A pybind11::dict representing the configuration for the ControlMessage.
A shared_ptr to a newly created ControlMessage instance.
Creates a new ControlMessage instance as a copy of an existing one.
- Parameters
- Returns
other – A shared_ptr to another ControlMessage instance to copy.
A shared_ptr to the newly copied ControlMessage instance.
-
static std::shared_ptr<ControlMessage> copy(ControlMessage &self)
Creates a deep copy of the ControlMessage instance.
- Parameters
- Returns
self – Reference to the underlying ControlMessage object.
A shared_ptr to the copied ControlMessage instance.
-
static pybind11::object get_metadata(ControlMessage &self, const pybind11::object &key, pybind11::object default_value)
Retrieves a metadata value by key, with an optional default value.
- Parameters
self – Reference to the underlying ControlMessage object.
key – The key for the metadata entry. If not provided, retrieves all metadata.
default_value – An optional default value to return if the key does not exist.
- Returns
The value associated with the key, the default value if the key is not found, or all metadata if the key is not provided.
-
static pybind11::list list_metadata(ControlMessage &self)
Lists all metadata keys of the ControlMessage.
- Parameters
- Returns
self – Reference to the underlying ControlMessage object.
A pybind11::list containing all metadata keys.
-
static void payload_from_python_meta(ControlMessage &self, const pybind11::object &meta)
Set the payload object given a Python instance of MessageMeta.
- Parameters
meta –
-
static void set_timestamp(ControlMessage &self, const std::string &key, pybind11::object timestamp)
Sets a timestamp for a given key.
This method directly takes a datetime.datetime object from Python and sets the corresponding std::chrono::system_clock::time_point for the specified key in the ControlMessage object.
- Parameters
self – Reference to the underlying ControlMessage object.
key – The key associated with the timestamp.
timestamp – A datetime.datetime object representing the timestamp.
-
static pybind11::object get_timestamp(ControlMessage &self, const std::string &key, bool fail_if_nonexist = false)
Retrieves the timestamp for a specific key from the ControlMessage object.
This method fetches the timestamp associated with the specified key and returns it as a datetime.datetime object in Python. If the timestamp does not exist and fail_if_nonexist is true, an exception is raised.
- Parameters
self – Reference to the underlying ControlMessage object.
key – The specific key for which the timestamp is requested.
fail_if_nonexist – Determines the behavior when the requested timestamp does not exist. If true, an exception is thrown. If false, py::none is returned.
- Returns
A datetime.datetime object representing the timestamp if found, or py::none if not found and fail_if_nonexist is false.
-
static pybind11::dict filter_timestamp(ControlMessage &self, const std::string ®ex_filter)
Retrieves timestamps for all keys that match a regex pattern from the ControlMessage object.
This method retrieves all timestamps within the ControlMessage object that match a specified regex pattern. Each key and its associated timestamp are returned in a Python dictionary, with timestamps represented as datetime.datetime objects.
- Parameters
self – Reference to the underlying ControlMessage object.
regex_filter – The regex pattern that keys must match to be included in the result.
- Returns
A Python dictionary of matching keys and their timestamps as datetime.datetime objects.
-
static std::shared_ptr<ControlMessage> create(pybind11::dict &config)