Switchboard SDK
Loading...
Searching...
No Matches
switchboard::Switchboard Class Reference

The main Switchboard SDK interface. More...

#include <Switchboard.hpp>

Public Types

using ObjectID = std::string

Static Public Member Functions

static Result< Switchboard::ObjectID > initialize (const Config &config)
 Initializes the Switchboard SDK.
static Result< void > deinitialize ()
 Deinitializes the Switchboard SDK.
static Result< ObjectID > createEngine (const Config &config)
 Creates a new Switchboard engine.
static Result< void > destroyEngine (ObjectID engineID)
 Destroys a Switchboard engine.
static Result< std::any > callAction (ObjectID objectID, const std::string &actionName, const std::map< std::string, std::any > &params={})
 Calls an action on a Switchboard object.
static Result< void > setValue (ObjectID objectID, const std::string &key, const std::any &value)
 Sets a value of a property on a Switchboard object.
static Result< std::any > getValue (ObjectID objectID, const std::string &key)
 Gets a value of a property from a Switchboard object.
static Result< unsigned int > addEventListener (ObjectID objectID, const std::string &eventName, const std::function< void(const std::any &)> &callback)
 Adds a new event listener to a Switchboard object.
static Result< void > removeEventListener (ObjectID objectID, unsigned int listenerID)
 Removes an event listener from a Switchboard object.

Detailed Description

The main Switchboard SDK interface.

Member Function Documentation

◆ addEventListener()

Result< unsigned int > switchboard::Switchboard::addEventListener ( ObjectID objectID,
const std::string & eventName,
const std::function< void(const std::any &)> & callback )
static

Adds a new event listener to a Switchboard object.

Parameters
objectIDThe ID of the object.
eventNameThe name of the event to listen to.
callbackThe callback function to call when the event is fired.
Returns
The ID of the listener.

◆ callAction()

Result< std::any > switchboard::Switchboard::callAction ( ObjectID objectID,
const std::string & actionName,
const std::map< std::string, std::any > & params = {} )
static

Calls an action on a Switchboard object.

Parameters
objectIDThe ID of the object.
actionNameThe name of the action.
paramsThe parameters of the action.
Returns
The result of the action.

◆ createEngine()

Result< ObjectID > switchboard::Switchboard::createEngine ( const Config & config)
static

Creates a new Switchboard engine.

This method calls "createEngine" action on the SDK Instance (object ID: "switchboard").

Parameters
configConfiguration map.
Returns
The ID of the created engine.

◆ deinitialize()

Result< void > switchboard::Switchboard::deinitialize ( )
static

Deinitializes the Switchboard SDK.

Returns
A successful result if the SDK was deinitialized successfully, an error result otherwise.

◆ destroyEngine()

Result< void > switchboard::Switchboard::destroyEngine ( ObjectID engineID)
static

Destroys a Switchboard engine.

This method calls "destroyEngine" action on the SDK Instance (object ID: "switchboard").

Parameters
objectIDThe ID of the engine object.
Returns
A successful result if the object was destroyed successfully, an error result otherwise.

◆ getValue()

Result< std::any > switchboard::Switchboard::getValue ( ObjectID objectID,
const std::string & key )
static

Gets a value of a property from a Switchboard object.

Parameters
objectIDThe ID of the object.
keyThe name of the property.
Returns
The value.

◆ initialize()

Result< Switchboard::ObjectID > switchboard::Switchboard::initialize ( const Config & config)
static

Initializes the Switchboard SDK.

Parameters
configConfiguration map.
Returns
The ID of the initialized Switchboard SDK.

◆ removeEventListener()

Result< void > switchboard::Switchboard::removeEventListener ( ObjectID objectID,
unsigned int listenerID )
static

Removes an event listener from a Switchboard object.

Parameters
objectIDThe ID of the object.
listenerIDThe ID of the listener to remove.
Returns
A successful result if the listener was removed successfully, an error result otherwise.

◆ setValue()

Result< void > switchboard::Switchboard::setValue ( ObjectID objectID,
const std::string & key,
const std::any & value )
static

Sets a value of a property on a Switchboard object.

Parameters
objectIDThe ID of the object.
keyThe name of the property.
valueThe value to set.
Returns
A successful result if the value was set successfully, an error result otherwise.

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