|
Goby3 3.6.1
2026.09.15
|
The class exposed to Python; user application classes subclass this. More...
#include <goby/middleware/languages/python/application.h>
Public Member Functions | |
| ApplicationWrapper (double loop_frequency_hertz=0) | |
| Constructs the underlying Goby application. | |
| virtual | ~ApplicationWrapper ()=default |
| ApplicationWrapper (const ApplicationWrapper &)=delete | |
| ApplicationWrapper & | operator= (const ApplicationWrapper &)=delete |
| virtual void | loop () |
| Override in Python to do work at loop_frequency Hz. | |
| virtual void | initialize () |
| Override in Python for work that can't be done in the constructor. | |
| virtual void | finalize () |
| Override in Python for cleanup just before the application exits. | |
| virtual std::string | health (py::bytes serialized) |
| Override in Python to answer goby_coroner's health request. | |
| int | run () |
| Runs the Goby event loop until quit() is called or the application is terminated. | |
| void | quit (int return_value=0) |
| Requests a clean exit. | |
| std::string | app_name () |
| The application name, as set by –app_name or derived from argv[0]. | |
| py::bytes | cfg_serialized () |
| The configuration the application was started with, serialized as Protobuf. | |
| void | set_loop_frequency_hertz (double loop_frequency_hertz) |
| void | publish (int layer, const std::string &type_name, int scheme, const std::string &group, const std::string &data) |
| Publishes already-marshalled bytes; dispatched by the generated glue code. | |
| void | subscribe (int layer, const std::string &type_name, int scheme, const std::string &group, py::object callback) |
| Subscribes a Python callable; dispatched by the generated glue code. | |
Static Public Member Functions | |
| static py::bytes | configure (const std::vector< std::string > &argv) |
| Reads the command line into the application configuration. | |
| static py::bytes | configure_from_text (const std::string &config_text) |
| Reads the application configuration from a Protobuf TextFormat string. | |
| static py::bytes | configure_from_serialized (const std::string &config_bytes) |
| Reads the application configuration from a serialized Protobuf message. | |
The class exposed to Python; user application classes subclass this.
| App | the generated glue class, which derives from python::Application |
Definition at line 246 of file application.h.
|
inline |
Constructs the underlying Goby application.
configure() must have been called first (goby.run does this), as the Goby application reads its configuration during construction.
| loop_frequency_hertz | frequency at which to call loop(); zero means never |
Definition at line 255 of file application.h.
|
virtualdefault |
|
delete |
|
inline |
The application name, as set by –app_name or derived from argv[0].
Definition at line 398 of file application.h.
|
inline |
The configuration the application was started with, serialized as Protobuf.
Definition at line 401 of file application.h.
|
inlinestatic |
Reads the command line into the application configuration.
Mirrors the configuration handling in goby::run, so Python applications accept the same command line as C++ applications (–help, –example_config, -v, per-field overrides, ...).
| argv | the full command line, including argv[0] |
| goby::middleware::ConfigException | translated to goby.ConfigError in Python |
Definition at line 306 of file application.h.
|
inlinestatic |
Reads the application configuration from a serialized Protobuf message.
| goby::middleware::ConfigException | translated to goby.ConfigError in Python |
Definition at line 372 of file application.h.
|
inlinestatic |
Reads the application configuration from a Protobuf TextFormat string.
Intended for embedding a Goby application in a larger Python program, and for tests that shouldn't need a command line or a configuration file.
| goby::middleware::ConfigException | translated to goby.ConfigError in Python |
Definition at line 353 of file application.h.
|
inlinevirtual |
Override in Python for cleanup just before the application exits.
Reimplemented in goby::middleware::python::ApplicationWrapperTrampoline< App >.
Definition at line 290 of file application.h.
|
inlinevirtual |
Override in Python to answer goby_coroner's health request.
| serialized | the ThreadHealth Goby filled in |
Reimplemented in goby::middleware::python::ApplicationWrapperTrampoline< App >.
Definition at line 296 of file application.h.
|
inlinevirtual |
Override in Python for work that can't be done in the constructor.
Reimplemented in goby::middleware::python::ApplicationWrapperTrampoline< App >.
Definition at line 287 of file application.h.
|
inlinevirtual |
Override in Python to do work at loop_frequency Hz.
Reimplemented in goby::middleware::python::ApplicationWrapperTrampoline< App >.
Definition at line 280 of file application.h.
|
delete |
|
inline |
Publishes already-marshalled bytes; dispatched by the generated glue code.
Definition at line 414 of file application.h.
|
inline |
Requests a clean exit.
Definition at line 395 of file application.h.
|
inline |
Runs the Goby event loop until quit() is called or the application is terminated.
The GIL is released for the duration, and reacquired for each callback into Python.
Definition at line 387 of file application.h.
|
inline |
Definition at line 408 of file application.h.
|
inline |
Subscribes a Python callable; dispatched by the generated glue code.
Definition at line 422 of file application.h.