Syntalos::SyntalosLinkModule
Syntalos::SyntalosLinkModule
Convenience interface to write an OOP Syntalos module.
#include <syntaloslinkmodule.h>
Public Functions
| Name | |
|---|---|
| SyntalosLinkModule(SyntalosLink * slink) | |
| virtual | ~SyntalosLinkModule() |
| SyntalosLinkModule(const SyntalosLinkModule & ) =delete | |
| SyntalosLinkModule & | operator=(const SyntalosLinkModule & ) =delete |
| void | raiseError(const std::string & message) |
| void | raiseError(const std::string & title, const std::string & message) |
| void | awaitData(int timeoutUsec =-1) |
| ModuleState | state() const |
| void | setState(ModuleState state) |
| void | setStatusMessage(const std::string & message) |
| virtual bool | prepare() |
| virtual void | start() |
| virtual void | stop() |
| virtual void | shutdown() |
Protected Functions
| Name | |
|---|---|
| template <typename T > T | unwrapOrAbort(std::expected< T, std::string > result, std::string_view context ={}) |
| SyncTimer * | timer() const |
| const TestSubjectInfo & | testSubject() const |
| template <typename T > auto | registerOutputPort(const std::string & id, const std::string & title ={}, const MetaStringMap & metadata ={}) Register an output port for this module. |
| template <typename T > auto | registerOutputPortOrAbort(const std::string & id, const std::string & title ={}, const MetaStringMap & metadata ={}) |
| template <typename T ,typename U > auto | registerInputPort(const std::string & id, const std::string & title, U * instance, void(U::*)(const T &data) fn) Register an input port for this module. |
| template <typename T ,typename U > auto | registerInputPortOrAbort(const std::string & id, const std::string & title, U * instance, void(U::*)(const T &data) fn) |
| virtual void | saveSettings(ByteVector & settings, const fs::path & baseDir) |
| virtual bool | loadSettings(const ByteVector & settings, const fs::path & baseDir) |
Protected Attributes
| Name | |
|---|---|
| bool | m_running |
Friends
| Name | |
|---|---|
| class | OutputPortLink |
Public Functions Documentation
function SyntalosLinkModule
explicit SyntalosLinkModule(
SyntalosLink * slink
)function ~SyntalosLinkModule
virtual ~SyntalosLinkModule()function SyntalosLinkModule
SyntalosLinkModule(
const SyntalosLinkModule &
) =deletefunction operator=
SyntalosLinkModule & operator=(
const SyntalosLinkModule &
) =deletefunction raiseError
void raiseError(
const std::string & message
)function raiseError
void raiseError(
const std::string & title,
const std::string & message
)function awaitData
void awaitData(
int timeoutUsec =-1
)function state
ModuleState state() constfunction setState
void setState(
ModuleState state
)function setStatusMessage
void setStatusMessage(
const std::string & message
)function prepare
virtual bool prepare()function start
virtual void start()function stop
virtual void stop()function shutdown
virtual void shutdown()Called when Syntalos wants this module to quit.
Protected Functions Documentation
function unwrapOrAbort
template <typename T >
inline T unwrapOrAbort(
std::expected< T, std::string > result,
std::string_view context ={}
)Convenience helper for std::expected
function timer
SyncTimer * timer() constThe global experiment timer.
function testSubject
const TestSubjectInfo & testSubject() constInformation about the current test subject. Refreshed before prepare() is called.
function registerOutputPort
template <typename T >
inline auto registerOutputPort(
const std::string & id,
const std::string & title ={},
const MetaStringMap & metadata ={}
)Register an output port for this module.
Return: A reference to the output port, which can be used to submit new data
This function should be called in the module’s constructor to publish the intent to produce an output stream of type T. Other modules may subscribe to this stream.
function registerOutputPortOrAbort
template <typename T >
inline auto registerOutputPortOrAbort(
const std::string & id,
const std::string & title ={},
const MetaStringMap & metadata ={}
)function registerInputPort
template <typename T ,
typename U >
inline auto registerInputPort(
const std::string & id,
const std::string & title,
U * instance,
void(U::*)(const T &data) fn
)Register an input port for this module.
This function should be called in the module’s constructor to publish the intent to accept input stream subscriptions of type T. The user may subscribe this module to other modules which produce the data it accepts.
In order to receive data, a callback function to be called when new data is available must also be provided.
function registerInputPortOrAbort
template <typename T ,
typename U >
inline auto registerInputPortOrAbort(
const std::string & id,
const std::string & title,
U * instance,
void(U::*)(const T &data) fn
)function saveSettings
virtual void saveSettings(
ByteVector & settings,
const fs::path & baseDir
)Parameters:
- settings The settings data.
- baseDir Base directory where the settings file will be stored.
Called when settings should be saved.
function loadSettings
virtual bool loadSettings(
const ByteVector & settings,
const fs::path & baseDir
)Parameters:
- settings The settings data.
- baseDir Base directory from where the settings were loaded.
Return: Return true if loading was successful, false on error.
Called when settings should be loaded.
Protected Attributes Documentation
variable m_running
bool m_running;Friends
friend OutputPortLink
friend class OutputPortLink(
OutputPortLink
);Updated on 2026-04-24 at 23:36:58 +0000