Switchboard SDK
Loading...
Searching...
No Matches
Switchboard.hpp
1//
2// Switchboard.hpp
3// SwitchboardSDK
4//
5// Copyright © 2026 Synervoz. All rights reserved.
6//
7
8#pragma once
9
10#include "Event.hpp"
11#include "Result.hpp"
12#include "export.h"
13
14#include <any>
15#include <functional>
16#include <map>
17#include <string>
18
19namespace switchboard {
20
24class SWITCHBOARDSDK_EXPORT Switchboard {
25public:
26 using ObjectID = std::string;
27 using ObjectURI = std::string;
28
36 static Result<ObjectURI> initialize(const SBAnyMap& config);
37
44
55
65 static Result<void> destroyEngine(const ObjectURI& engineURI);
66
76 static Result<SBAny>
77 callAction(const ObjectURI& objectURI, const std::string& actionName, const SBAnyMap& params = {});
78
88 static Result<void> setValue(const ObjectURI& objectURI, const std::string& key, const SBAny& value);
89
98 static Result<SBAny> getValue(const ObjectURI& objectURI, const std::string& key);
99
110 const ObjectURI& objectURI,
111 const std::string& eventName,
112 const std::function<void(const Event&)>& callback
113 );
114
123 static Result<void> removeEventListener(const ObjectURI& objectURI, unsigned int listenerID);
124
125private:
126 class Impl;
127 static Impl* pImpl;
128};
129
130}
Represents the result of an operation that can either succeed or fail.
Definition Result.hpp:39
A versatile container class that can hold values of various types.
Definition SBAny.hpp:52
Map class to store and retrieve values.
Definition SBAny.hpp:275
The main Switchboard SDK interface.
Definition Switchboard.hpp:24
static Result< void > deinitialize()
Deinitializes the Switchboard SDK.
static Result< ObjectURI > createEngine(const SBAnyMap &config)
Creates a new Switchboard engine.
static Result< SBAny > getValue(const ObjectURI &objectURI, const std::string &key)
Gets a value of a property from a Switchboard object.
static Result< ObjectURI > initialize(const SBAnyMap &config)
Initializes the Switchboard SDK.
static Result< void > removeEventListener(const ObjectURI &objectURI, unsigned int listenerID)
Removes an event listener from a Switchboard object.
static Result< SBAny > callAction(const ObjectURI &objectURI, const std::string &actionName, const SBAnyMap &params={})
Calls an action on a Switchboard object.
static Result< unsigned int > addEventListener(const ObjectURI &objectURI, const std::string &eventName, const std::function< void(const Event &)> &callback)
Adds a new event listener to a Switchboard object.
static Result< void > destroyEngine(const ObjectURI &engineURI)
Destroys a Switchboard engine.
static Result< void > setValue(const ObjectURI &objectURI, const std::string &key, const SBAny &value)
Sets a value of a property on a Switchboard object.
Represents an event that can be emitted and listened to.
Definition Event.hpp:23