Bifrost SDK
Bifrost SDK documentation
BifrostGraph::Executor::Callbacks Class Referenceabstract

BifrostGraph Executor Callbacks. More...

#include <Callbacks.h>

Public Types

using CreateFunc = BifrostGraph::Executor::Callbacks *(*)()
 The signature of the function used to create an instance of class Callbacks. More...
 

Public Member Functions

 Callbacks () noexcept
 Constructor. More...
 
virtual ~Callbacks () noexcept
 Destructor. More...
 
virtual void deleteThis () noexcept=0
 Instruct this class instance to delete itself. More...
 
virtual void onStateValuesTornDown () noexcept
 The notification method called when the feedback port values have been cleared. More...
 

Static Public Member Functions

static const char * createFuncName () noexcept
 Get the name of the function used to create new instance of class Callbacks. More...
 

Detailed Description

BifrostGraph Executor Callbacks.

An instance of class Callbacks can be used by the host to be notified by Bifrost upon specific events.

An instance of class Callbacks should be allocated on the heap, not on the stack. The Workspace will manage its lifetime and delete it by calling Callbacks::deleteThis when the Workspace gets unloaded.

Definition at line 35 of file Callbacks.h.

Member Typedef Documentation

◆ CreateFunc

The signature of the function used to create an instance of class Callbacks.

Definition at line 44 of file Callbacks.h.

Constructor & Destructor Documentation

◆ Callbacks()

BifrostGraph::Executor::Callbacks::Callbacks ( )
noexcept

Constructor.

◆ ~Callbacks()

virtual BifrostGraph::Executor::Callbacks::~Callbacks ( )
virtualnoexcept

Destructor.

Member Function Documentation

◆ createFuncName()

static const char * BifrostGraph::Executor::Callbacks::createFuncName ( )
staticnoexcept

Get the name of the function used to create new instance of class Callbacks.

This function is the C entry point used to register new instance of class Callbacks from a shared library.

The client code must declare and define the entry point. The function must have the CreateFunc signature.

Note that BIFROSTGRAPH_EXECUTOR_SHARED_DECL is for symbol visiblity, see ExecutorExport.h file.

extern "C" {
BIFROSTGRAPH_EXECUTOR_SHARED_DECL BifrostGraph::Executor::Callbacks*
registerBifrostCallbacks(void);
BIFROSTGRAPH_EXECUTOR_SHARED_DECL BifrostBoardExecutorCallbacks*
registerBifrostCallbacks(void) {
// Return a pointer to my class that implements
// BifrostGraph::Executor::Callbacks interface.
return new MyCallbacks());
}
BifrostGraph Executor Callbacks.
Definition: Callbacks.h:35

The Callbacks shared library is exposed to Bifrost via a config file. The JSON config file will need a callbackLibs section. Note that, to be portable and depending on the platform, Bifrost config file parsing will automatically add the prefix "lib" and suffix "dll", "so", or "dylib".

{
"AminoConfigurations": [
{
"vendorName": "MyCompany",
"libraryVersion": "0.0.1",
"libraryName": "MyPackName",
"callbackLibs": [
{
"path": "Directory containing the shared lib",
"files": [
"MyCallbacks"
]
}
]
}
]
}
Returns
"registerBifrostCallbacks"

◆ deleteThis()

virtual void BifrostGraph::Executor::Callbacks::deleteThis ( )
pure virtualnoexcept

Instruct this class instance to delete itself.

◆ onStateValuesTornDown()

virtual void BifrostGraph::Executor::Callbacks::onStateValuesTornDown ( )
virtualnoexcept

The notification method called when the feedback port values have been cleared.