24#ifndef GOBY_MIDDLEWARE_TERMINATE_TERMINATE_H
25#define GOBY_MIDDLEWARE_TERMINATE_TERMINATE_H
47inline std::pair<bool, protobuf::TerminateResponse>
52 unsigned pid = getpid();
61 <<
"Received request matching our app name to cleanly quit() from goby_terminate"
68 goby::glog <<
"Received request matching our PID to cleanly quit() from goby_terminate"
72 return std::make_pair(match, resp);
81 static_cast<Derived*
>(
this)
90 request,
static_cast<Derived*
>(
this)->app_cfg().app().name());
93 static_cast<Derived*
>(
this)
95 .template publish<goby::middleware::groups::terminate_response>(resp);
97 static_cast<Derived*
>(
this)->quit();
bool has_target_name() const
bool has_target_pid() const
const std::string & target_name() const
uint32_t target_pid() const
void set_target_name(ArgT0 &&arg0, ArgT... args)
void set_target_pid(uint32_t value)
void subscribe_terminate(bool do_quit=true)
constexpr goby::middleware::Group terminate_request
std::pair< bool, protobuf::TerminateResponse > check_terminate(const protobuf::TerminateRequest &request, const std::string &app_name)
Checks if the terminate request is for this application, either by target_name or PID.
The global namespace for the Goby project.
util::FlexOstream glog
Access the Goby logger through this object.