OpenCPN Partial API docs
Loading...
Searching...
No Matches
Observable Class Reference

The observable notify/listen basic nuts and bolts. More...

#include <observable.h>

Inheritance diagram for Observable:
KeyProvider ConfigVar< T > EventVar GlobalVar< T >

Public Member Functions

 Observable (const std::string &_key)
 
 Observable (const KeyProvider &kp)
 
virtual const void Notify ()
 Notify all listeners about variable change.
 
const void Notify (std::shared_ptr< const void > p)
 
bool Unlisten (wxEvtHandler *listener, wxEventType ev)
 Remove window listening to ev from list of listeners.
 
std::string GetKey () const
 

Public Attributes

const std::string key
 The key used to create and clone.
 

Protected Member Functions

const void Notify (std::shared_ptr< const void > ptr, const std::string &s, int num, void *client_data)
 Notify all listeners: send them a 'type' ObservedEvt message as defined by listen() with optional data available using GetString() and/or GetClientData().
 
const void Notify (const std::string &s, void *client_data)
 

Friends

class ObservableListener
 

Detailed Description

The observable notify/listen basic nuts and bolts.


Definition at line 81 of file observable.h.

Constructor & Destructor Documentation

◆ Observable() [1/2]

Observable::Observable ( const std::string &  _key)
inline

Definition at line 85 of file observable.h.

◆ Observable() [2/2]

Observable::Observable ( const KeyProvider kp)
inline

Definition at line 88 of file observable.h.

Member Function Documentation

◆ GetKey()

std::string Observable::GetKey ( ) const
inlinevirtual

Implements KeyProvider.

Definition at line 101 of file observable.h.

◆ Notify() [1/4]

const void Observable::Notify ( )
virtual

Notify all listeners about variable change.

Reimplemented in EventVar.

Definition at line 94 of file observable.cpp.

◆ Notify() [2/4]

const void Observable::Notify ( const std::string &  s,
void *  client_data 
)
inlineprotected

Definition at line 115 of file observable.h.

◆ Notify() [3/4]

const void Observable::Notify ( std::shared_ptr< const void >  p)
inline

Definition at line 93 of file observable.h.

◆ Notify() [4/4]

const void Observable::Notify ( std::shared_ptr< const void >  ptr,
const std::string &  s,
int  num,
void *  client_data 
)
protected

Notify all listeners: send them a 'type' ObservedEvt message as defined by listen() with optional data available using GetString() and/or GetClientData().

Definition at line 78 of file observable.cpp.

◆ Unlisten()

bool Observable::Unlisten ( wxEvtHandler *  listener,
wxEventType  ev 
)

Remove window listening to ev from list of listeners.

Returns
true if such a listener existed, else false.

Definition at line 67 of file observable.cpp.

Friends And Related Symbol Documentation

◆ ObservableListener

friend class ObservableListener
friend

Definition at line 82 of file observable.h.

Member Data Documentation

◆ key

const std::string Observable::key

The key used to create and clone.

Definition at line 104 of file observable.h.


The documentation for this class was generated from the following files: