Observables Declaration

Table of Contents

About

An interface can declare one or many observables. Such an observable can be used to receive a signal on certain events within that interface.

Declaration

Observables are declared within an interface:

// This example shows an interface declaring an observable.
namespace maxon
{
class ObserveMeInterface : MAXON_INTERFACE_BASES(maxon::ObserverObjectInterface)
{
MAXON_INTERFACE(ObserveMeInterface, MAXON_REFERENCE_NORMAL, "net.maxonexample.interfaces.observeme");
public:
//----------------------------------------------------------------------------------------
// Function makes "Ping".
//----------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------
// Signal fired when Ping() is called.
//----------------------------------------------------------------------------------------
MAXON_OBSERVABLE(Result<void>, ObservablePing, (maxon::Int32 count), maxon::ObservableCombinerRunAllComponent);
};
}
Py_ssize_t count
Definition: abstract.h:640
MAXON_INTERFACE(ObserveMeInterface, MAXON_REFERENCE_NORMAL, "net.maxonexample.interfaces.observeme")
MAXON_METHOD void Ping()
MAXON_OBSERVABLE(Result< void >, ObservablePing,(maxon::Int32 count), maxon::ObservableCombinerRunAllComponent)
int32_t Int32
32 bit signed integer datatype.
Definition: apibase.h:190
#define MAXON_REFERENCE_NORMAL(FREEIMPL)
Definition: interfacebase.h:1184
#define MAXON_METHOD
Definition: interfacebase.h:1012
#define MAXON_INTERFACE_BASES(...)
Definition: objectbase.h:1049
The maxon namespace contains all declarations of the MAXON API.
Definition: autoweight.h:14

The MAXON_OBSERVABLE() attribute defines the following options:

  • the return value of the callback function
  • the name of the observable
  • the argument list of the callback function

Further Reading