# VectorNav C++ Library: include/vn/signal.h Source File

signal.h
#ifndef _VNXPLAT_SIGNAL_H_
#define _VNXPLAT_SIGNAL_H_
namespace vn {
namespace xplat {
class Signal
{
// Types //////////////////////////////////////////////////////////////////
public:
enum SignalType
{
UNKNOWN,
CTRL_C
};
typedef bool (*HandleSignalFunc)(Signal signal);
class Observer
{
public:
virtual ~Observer() { }
virtual bool XSignalHandleSingle(SignalType signal) = 0;
protected:
Observer() { }
};
// Public Methods /////////////////////////////////////////////////////////
public:
static void RegisterForSignalNotifications(
HandleSignalFunc handleFunc);
static void UnregisterForSignalNotifications(
HandleSignalFunc handleFunc);
static void RegisterSignalObserver(
Observer* observer);
static void UnregisterSignalObserver(
Observer* observer);
// Private Members ////////////////////////////////////////////////////////
private:
// Contains internal data, mainly stuff that is required for cross-platform
// support.
struct Impl;
};
}
}
#endif
vn::xplat::Signal::Observer
Allows for other objects to listen for signal events.
Definition: signal.h:31
vn::xplat::Signal::CTRL_C
User pressed Ctrl-C.
Definition: signal.h:21
vn::xplat::Signal::RegisterForSignalNotifications
static void RegisterForSignalNotifications(HandleSignalFunc handleFunc)
Allows registering to receive notifications of system signals.
vn::xplat::Signal
Provides access to system signals.
Definition: signal.h:8
vn::xplat::Signal::SignalType
SignalType
The available signals.
Definition: signal.h:15
vn::xplat::Signal::Observer::XSignalHandleSingle
virtual bool XSignalHandleSingle(SignalType signal)=0
If an observer is registered via RegisterSignalObserver, whenever a signal is received, this method will be called to alert the observer.
xplat
Definition: mock.h:4
vn::xplat::Signal::UnregisterForSignalNotifications
static void UnregisterForSignalNotifications(HandleSignalFunc handleFunc)
Allows unregistering from receiving signal notifications.
vn::xplat::Signal::RegisterSignalObserver
static void RegisterSignalObserver(Observer *observer)
Allows registering an observer for notification when a signal is received.
vn::xplat::Signal::HandleSignalFunc
bool(* HandleSignalFunc)(Signal signal)
Typedef for a function that can handle signal notifications.
Definition: signal.h:28
vn
Definition: attitude.h:8
vn::xplat::Signal::UnregisterSignalObserver
static void UnregisterSignalObserver(Observer *observer)
Allows unregistering of an observer from being notified when a signal is received.
vn::xplat::Signal::UNKNOWN
Unknown type of signal.
Definition: signal.h:18