Syntalos::SyntalosLinkModule

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
voidraiseError(const std::string & message)
voidraiseError(const std::string & title, const std::string & message)
voidawaitData(int timeoutUsec =-1)
ModuleStatestate() const
voidsetState(ModuleState state)
voidsetStatusMessage(const std::string & message)
virtual boolprepare()
virtual voidstart()
virtual voidstop()
virtual voidshutdown()

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 voidsaveSettings(ByteVector & settings, const fs::path & baseDir)
virtual boolloadSettings(const ByteVector & settings, const fs::path & baseDir)

Protected Attributes

Name
boolm_running

Friends

Name
classOutputPortLink

Public Functions Documentation

function SyntalosLinkModule

explicit SyntalosLinkModule(
    SyntalosLink * slink
)

function ~SyntalosLinkModule

virtual ~SyntalosLinkModule()

function SyntalosLinkModule

SyntalosLinkModule(
    const SyntalosLinkModule & 
) =delete

function operator=

SyntalosLinkModule & operator=(
    const SyntalosLinkModule & 
) =delete

function 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() const

function 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() const

The global experiment timer.

function testSubject

const TestSubjectInfo & testSubject() const

Information 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