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 ={})
std::shared_ptr< SyncTimer >timer() const
const TestSubjectInfo &testSubject() const
const RunInfo &runInfo() const
autocreateDefaultDataset(const std::string & preferredName ={})
Create (or return cached) the default dataset for this module.
autocreateDatasetInGroup(const std::shared_ptr< EDLGroup > & parent, const std::string & name)
Create a new dataset in the given group.
autocreateStorageGroup(const std::string & name)
Create (or open) a sub-group under the module’s assigned root.
autocreateStorageGroup(const std::shared_ptr< EDLGroup > & parent, const std::string & name)
Create (or open) a sub-group under an existing group.
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)
std::unique_ptr< FreqCounterSynchronizer >initCounterSynchronizer(double frequencyHz, const std::string & id ={})
Create a frequency-counter synchronizer for the current run.
std::unique_ptr< SecondaryClockSynchronizer >initClockSynchronizer(double expectedFrequencyHz =0, const std::string & id ={})
Create a secondary-clock synchronizer for the current run.
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

std::shared_ptr< 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 runInfo

const RunInfo & runInfo() const

The run info (EDL root group, UUID, etc.). Available after prepare() is called.

function createDefaultDataset

auto createDefaultDataset(
    const std::string & preferredName ={}
)

Create (or return cached) the default dataset for this module.

Parameters:

  • preferredName Dataset name; defaults to the module name if empty.

Uses MUST_CREATE semantics; fails if the name is already taken in the assigned root group. The result is cached: repeated calls with the same name return the same dataset.

function createDatasetInGroup

auto createDatasetInGroup(
    const std::shared_ptr< EDLGroup > & parent,
    const std::string & name
)

Create a new dataset in the given group.

Parameters:

  • parent Group to create the dataset in.
  • name Dataset name.

Uses MUST_CREATE semantics: fails if a dataset with that name already exists in the group (both locally and on the master side).

function createStorageGroup

auto createStorageGroup(
    const std::string & name
)

Create (or open) a sub-group under the module’s assigned root.

Parameters:

  • name Group name.

Uses CREATE_OR_OPEN semantics: safe to call multiple times with the same name.

function createStorageGroup

auto createStorageGroup(
    const std::shared_ptr< EDLGroup > & parent,
    const std::string & name
)

Create (or open) a sub-group under an existing group.

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 initCounterSynchronizer

std::unique_ptr< FreqCounterSynchronizer > initCounterSynchronizer(
    double frequencyHz,
    const std::string & id ={}
)

Create a frequency-counter synchronizer for the current run.

Must be called while the module is preparing or running.

function initClockSynchronizer

std::unique_ptr< SecondaryClockSynchronizer > initClockSynchronizer(
    double expectedFrequencyHz =0,
    const std::string & id ={}
)

Create a secondary-clock synchronizer for the current run.

Must be called while the module is preparing or running.

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-05-20 at 12:42:23 +0000