OpenCPN Partial API docs
Loading...
Searching...
No Matches
observable.h File Reference

General observable pattern implementation built on top of wxWidgets event handling. More...

#include <functional>
#include <memory>
#include <mutex>
#include <string>
#include <utility>
#include <vector>
#include <wx/event.h>
#include "event.h"

Go to the source code of this file.

Classes

interface  obs::KeyProvider
 Interface implemented by classes which listens. More...
class  obs::ListenersByKey
 Private helper class. More...
class  obs::Observable
 The observable notify/listen basic nuts and bolts. More...
class  ObservableListener
 Manages listening to an Observable instance. More...
class  obs::Listener
 Define an action to be performed when a KeyProvider is notified. More...

Functions

std::string obs::PtrKey (const void *ptr)
 Return address as printable string.
template<typename T>
std::shared_ptr< const T > obs::UnpackEvtPointer (const ObservedEvt &ev)
 Shorthand for accessing ObservedEvt.SharedPtr().

Detailed Description

General observable pattern implementation built on top of wxWidgets event handling.

Based on Notify() / Listen() with several specializations with a general EventVar and more specific solutions for configuration variables and globals. Easily extended for other use cases.

Definition in file observable.h.

Macro Definition Documentation

◆ DECL_EXP

#define DECL_EXP

Definition at line 51 of file observable.h.

Function Documentation

◆ PtrKey()

std::string obs::PtrKey ( const void * ptr)

Return address as printable string.

Definition at line 36 of file observable.cpp.

◆ UnpackEvtPointer()

template<typename T>
std::shared_ptr< const T > obs::UnpackEvtPointer ( const ObservedEvt & ev)

Shorthand for accessing ObservedEvt.SharedPtr().

Definition at line 355 of file observable.h.