Goby3 3.6.1
2026.09.15
Loading...
Searching...
No Matches
application.h File Reference
#include <chrono>
#include <csignal>
#include <cstdint>
#include <cstdlib>
#include <exception>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <google/protobuf/text_format.h>
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include "goby/exception.h"
#include "goby/middleware/application/configurator.h"
#include "goby/middleware/application/detail/simulation_time.h"
#include "goby/middleware/application/interface.h"
#include "goby/middleware/group.h"
#include "goby/middleware/languages/common/interface.h"
#include "goby/middleware/marshalling/interface.h"
#include "goby/middleware/protobuf/coroner.pb.h"
#include "goby/time.h"
#include "goby/time/simulation.h"
#include "goby/util/debug_logger.h"

Go to the source code of this file.

Classes

struct  goby::middleware::python::detail::SignalState
 State used to turn SIGINT/SIGTERM into a clean Application::quit() More...
 
class  goby::middleware::python::detail::SignalGuard
 Installs the quit-on-signal handlers for the duration of a run() call. More...
 
class  goby::middleware::python::Application< AppBase >
 Base class for the generated C++ glue class, forwarding the Goby virtual methods to Python. More...
 
class  goby::middleware::python::ApplicationWrapper< App >
 The class exposed to Python; user application classes subclass this. More...
 
class  goby::middleware::python::ApplicationWrapperTrampoline< App >
 Lets Python subclasses override the Goby virtual methods. More...
 

Namespaces

namespace  goby
 The global namespace for the Goby project.
 
namespace  goby::middleware
 Objects implementing the Goby nested middleware.
 
namespace  goby::middleware::python
 Support for writing Goby applications in Python.
 
namespace  goby::middleware::python::detail
 

Macros

#define GOBY_PYTHON_IF_PUBLICATION(SCHEME, LAYER_ENUM, LAYER_FUNCTION, GROUP, GROUP_KEY, TYPE)
 
#define GOBY_PYTHON_IF_SUBSCRIPTION(SCHEME, LAYER_ENUM, LAYER_FUNCTION, GROUP, GROUP_KEY, TYPE)
 
#define GOBY_PYTHON_FAIL(PUBLISH_OR_SUBSCRIBE)
 
#define GOBY_PYTHON_QUOTE(name)   #name
 
#define GOBY_PYTHON_DEFINE_MODULE(APPLICATION_NAME, MODULE_NAME)
 

Functions

void goby::middleware::python::detail::invoke_callback (const py::object &callback, const std::vector< char > &bytes)
 Hands marshalled bytes to a Python callable, acquiring the GIL first.
 
SignalState & goby::middleware::python::detail::signal_state ()
 
void goby::middleware::python::detail::signal_handler (int signum)
 
void goby::middleware::python::detail::glog_write (int verbosity, const std::string &group, const std::string &text)
 Writes one already-formatted line to goby::glog at the given verbosity.
 
bool goby::middleware::python::detail::glog_is (int verbosity)
 Whether anything is listening at this verbosity.
 
template<typename App >
void goby::middleware::python::define_python_module (py::module_ &m, const std::string &app_name)
 Defines the contents of the generated extension module.
 

Macro Definition Documentation

◆ GOBY_PYTHON_DEFINE_MODULE

#define GOBY_PYTHON_DEFINE_MODULE (   APPLICATION_NAME,
  MODULE_NAME 
)
Value:
PYBIND11_MODULE(MODULE_NAME, goby_python_module) \
{ \
goby::middleware::python::define_python_module<APPLICATION_NAME>( \
goby_python_module, GOBY_PYTHON_QUOTE(APPLICATION_NAME)); \
}
#define GOBY_PYTHON_QUOTE(name)

Definition at line 620 of file application.h.

◆ GOBY_PYTHON_FAIL

#define GOBY_PYTHON_FAIL (   PUBLISH_OR_SUBSCRIBE)
Value:
goby::glog << PUBLISH_OR_SUBSCRIBE " not defined for these parameters: [" << id \
<< "]. Please include in interface.yml and re-generate to include them." \
<< std::endl;
util::FlexOstream glog
Access the Goby logger through this object.

Definition at line 612 of file application.h.

◆ GOBY_PYTHON_IF_PUBLICATION

#define GOBY_PYTHON_IF_PUBLICATION (   SCHEME,
  LAYER_ENUM,
  LAYER_FUNCTION,
  GROUP,
  GROUP_KEY,
  TYPE 
)
Value:
goby::middleware::python::PubSubLayer::LAYER_ENUM, TYPE::descriptor()->name(), \
goby::middleware::MarshallingScheme::SCHEME, GROUP_KEY}) \
{ \
decltype(data.end()) actual_end; \
auto msg = goby::middleware::SerializerParserHelper< \
TYPE, goby::middleware::MarshallingScheme::SCHEME>::parse(data.begin(), data.end(), \
actual_end); \
LAYER_FUNCTION().publish<GROUP>(msg); \
return; \
}
The global namespace for the Goby project.
Fully identifies a publication or subscription crossing the language boundary.
Definition interface.h:76

Definition at line 584 of file application.h.

◆ GOBY_PYTHON_IF_SUBSCRIPTION

#define GOBY_PYTHON_IF_SUBSCRIPTION (   SCHEME,
  LAYER_ENUM,
  LAYER_FUNCTION,
  GROUP,
  GROUP_KEY,
  TYPE 
)
Value:
goby::middleware::python::PubSubLayer::LAYER_ENUM, TYPE::descriptor()->name(), \
goby::middleware::MarshallingScheme::SCHEME, GROUP_KEY}) \
{ \
LAYER_FUNCTION().subscribe<GROUP>( \
[callback](const TYPE& pb) \
{ \
std::vector<char> bytes = goby::middleware::SerializerParserHelper< \
TYPE, goby::middleware::MarshallingScheme::SCHEME>::serialize(pb); \
goby::middleware::python::detail::invoke_callback(callback, bytes); \
}); \
return; \
}
Class for parsing and serializing a given marshalling scheme. Must be specialized for a particular sc...
Definition interface.h:98

Definition at line 597 of file application.h.

◆ GOBY_PYTHON_QUOTE

#define GOBY_PYTHON_QUOTE (   name)    #name

Definition at line 619 of file application.h.