Syntalos::MLinkModule

Syntalos::MLinkModule

Syntalos::MLinkModule

Master link for out-of-process modules.

#include <mlinkmodule.h>

Inherits from Syntalos::AbstractModule, QObject

Public Signals

Name
voidprocessOutputReceived(const QString & text)

Public Functions

Name
MLinkModule(QObject * parent =nullptr)
virtual~MLinkModule() override
virtual ModuleDriverKinddriver() const override
Select how this module will be executed by the Syntalos engine.
virtual ModuleFeaturesfeatures() const override
Return a bitfield of features this module supports.
QStringmoduleBinary() const
voidsetModuleBinary(const QString & binaryPath)
QProcessEnvironmentmoduleBinaryEnv() const
voidsetModuleBinaryEnv(const QProcessEnvironment & env)
booloutputCaptured() const
voidsetOutputCaptured(bool capture)
voidsetPythonVirtualEnv(const QString & venvDir)
voidsetScript(const QString & script, const QString & wdir =QString())
boolsetScriptFromFile(const QString & fname, const QString & wdir =QString())
boolisScriptModified() const
QByteArraysettingsData() const
voidsetSettingsData(const QByteArray & data)
virtual voidshowDisplayUi() override
Show the display widgets of this module.
virtual voidshowSettingsUi() override
Show the configuration UI of this module.
voidterminateProcess()
boolrunProcess()
boolisProcessRunning() const
boolloadCurrentScript()
boolsendPortInformation()
QStringreadProcessOutput()
voidmarkIncomingForExport(StreamExporter * exporter)
virtual boolprepare(const TestSubject & testSubject) override
Prepare for an experiment run.
virtual voidstart() override
Run when the experiment is started and the HRTimer has an initial time set. Switches the module into “Started” mode.
virtual voidstop() override
Stop running an experiment. Stop execution of an experiment. This method is called after prepare() was run.

Friends

Name
classPrivate

Additional inherited members

Public Signals inherited from Syntalos::AbstractModule

Name
voidstateChanged(ModuleState state)
voiderror(const QString & message)
voidstatusMessage(const QString & message)
voidnameChanged(const QString & name)
voidportsConnected(const VarStreamInputPort * inPort, const StreamOutputPort * outPort)
voidportConfigurationUpdated()
voidsynchronizerDetailsChanged(const QString & id, const Syntalos::TimeSyncStrategies & strategies, const Syntalos::microseconds_t & tolerance)
voidsynchronizerOffsetChanged(const QString & id, const Syntalos::microseconds_t & currentOffset)
voidmodifiersUpdated()

Public Functions inherited from Syntalos::AbstractModule

Name
AbstractModule(QObject * parent =nullptr)
AbstractModule(const QString & id, QObject * parent =nullptr)
virtual~AbstractModule()
ModuleStatestate() const
voidsetStateDormant()
Allow a running module to mark itself as idle.
voidsetStateReady()
Allow a preparing module to mark itself as ready.
QStringid() const
Name of this module used internally as unique identifier.
intindex() const
Index of this module.
virtual QStringname() const
Name of this module displayed to the user.
virtual voidsetName(const QString & name)
template <typename T >
requires std::is_base_of_v< BaseDataType, T > std::shared_ptr< DataStream< T > >
registerOutputPort(const QString & id, const QString & title =QString())
Register an output port for this module.
template <typename T >
requires std::is_base_of_v< BaseDataType, T > std::shared_ptr< StreamInputPort< T > >
registerInputPort(const QString & id, const QString & title =QString())
Register an input port for this module.
std::shared_ptr< VariantDataStream >registerOutputPortByTypeId(int typeId, const QString & id, const QString & title =QString())
Register an output port for this module using a type ID.
std::shared_ptr< VarStreamInputPort >registerInputPortByTypeId(int typeId, const QString & id, const QString & title =QString())
Register an input port for this module using a type ID.
virtual boolinitialize()
Initialize the module.
virtual voidrunThread(OptionalWaitCondition * startWaitCondition)
Run task in a thread.
virtual voidprocessUiEvents()
Called to process UI events.
virtual voidfinalize()
Finalize this module. This method is called before the module itself is destroyed.
virtual boolisDisplayUiVisible()
virtual boolisSettingsUiVisible()
virtual voidhideDisplayUi()
Hide all display widgets of this module.
virtual voidhideSettingsUi()
Hide the configuration UI of this module.
virtual voidserializeSettings(const QString & confBaseDir, QVariantHash & settings, QByteArray & extraData)
Serialize the settings of this module.
virtual boolloadSettings(const QString & confBaseDir, const QVariantHash & settings, const QByteArray & extraData)
Load settings from previously stored data.
virtual voidinputPortConnected(VarStreamInputPort * inPort)
Called when one of this module’s input ports is subscribed to a stream.
virtual voidupdateStartWaitCondition(OptionalWaitCondition * waitCondition)
Update thread start wait condition before each run.
QStringlastError() const
Return last error.
QStringmoduleRootDir() const
Obtain the root directory of this (loadable) module.
voidsetEventsMaxModulesPerThread(int maxModuleCount)
Set maximum modules per thread when using dedicated event driver.
inteventsMaxModulesPerThread() const
voidclearInPorts()
voidclearOutPorts()
voidremoveInPortById(const QString & id)
voidremoveOutPortById(const QString & id)
QList< std::shared_ptr< VarStreamInputPort > >inPorts() const
QList< std::shared_ptr< StreamOutputPort > >outPorts() const
std::shared_ptr< VarStreamInputPort >inPortById(const QString & id) const
std::shared_ptr< StreamOutputPort >outPortById(const QString & id) const
QList< QPair< intervalEventFunc_t, int > >intervalEventCallbacks() const
QList< QPair< recvDataEventFunc_t, std::shared_ptr< VariantStreamSubscription > > >recvDataEventCallbacks() const
QVariantserializeDisplayUiGeometry()
voidrestoreDisplayUiGeometry(const QVariant & var)
voidsetTimer(std::shared_ptr< SyncTimer > timer)
ModuleModifiersmodifiers() const
Return a bitfield of modifiers assigned to this module.
voidsetModifiers(ModuleModifiers modifiers)

Protected Functions inherited from Syntalos::AbstractModule

Name
voidraiseError(const QString & message)
voidsetStatusMessage(const QString & message)
boolmakeDirectory(const QString & dir)
voidappProcessEvents()
QStringdatasetNameSuggestion(bool lowercase =true) const
Suggested name for datasets from this module.
QStringdatasetNameFromSubMetadata(const QVariantHash & subMetadata) const
Get name of a dataset from subscription metadata.
QStringdatasetNameFromParameters(const QString & preferredName, const QVariantHash & subMetadata) const
Get name of a dataset from subscription metadata and preferred name.
QStringdataBasenameFromSubMetadata(const QVariantHash & subMetadata, const QString & defaultName =QStringLiteral(“data”))
Get file basename for data from subscription metadata.
std::shared_ptr< EDLDataset >createDefaultDataset(const QString & preferredName =QString(), const QVariantHash & subMetadata =QVariantHash())
Create dataset for data storage in default storage group for this module.
std::shared_ptr< EDLDataset >createDatasetInGroup(std::shared_ptr< EDLGroup > group, const QString & preferredName =QString(), const QVariantHash & subMetadata =QVariantHash())
std::shared_ptr< EDLDataset >getDefaultDataset()
Obtain the module’s default dataset if it exists.
std::shared_ptr< EDLDataset >getDatasetInGroup(std::shared_ptr< EDLGroup > group, const QString & preferredName =QString(), const QVariantHash & subMetadata =QVariantHash())
std::shared_ptr< EDLGroup >createStorageGroup(const QString & groupName)
Create new data storage group with the given name.
QWidget *addDisplayWindow(QWidget * window, bool owned =true)
Register a display window for this module.
QWidget *addSettingsWindow(QWidget * window, bool owned =true)
Register a settings window for this module.
template <typename T >
void
registerTimedEvent(void(T::*)(int &) fn, const milliseconds_t & interval)
Request a member function of this module to be called at an interval.
template <typename T >
void
registerDataReceivedEvent(void(T::*)() fn, std::shared_ptr< VariantStreamSubscription > subscription)
Request a member function of this module to be called when a subscription has new data.
voidclearDataReceivedEventRegistrations()
Remove all registered data-received event callbacks.
std::unique_ptr< FreqCounterSynchronizer >initCounterSynchronizer(double frequencyHz)
Get new frequency/counter synchronizer.
std::unique_ptr< SecondaryClockSynchronizer >initClockSynchronizer(double expectedFrequencyHz =0)
Get new secondary clock synchronizer.
uintpotentialNoaffinityCPUCount() const
Potential amount of CPUs not used by other syntalos tasks.
intdefaultRealtimePriority() const
Default thread realtime priority.
boolisEphemeralRun() const
Returns true if the currently ongoing or last run is/was ephemeral.
virtual voidusbHotplugEvent(UsbHotplugEventKind kind)
Handle USB hotplug events.
voidsetInitialized()
boolinitialized() const

Protected Attributes inherited from Syntalos::AbstractModule

Name
std::atomic_boolm_running
std::shared_ptr< SyncTimer >m_syTimer
Global master timer reference for this module, valid only during a run.

Friends inherited from Syntalos::AbstractModule

Name
classEngine

Public Signals Documentation

signal processOutputReceived

void processOutputReceived(
    const QString & text
)

Public Functions Documentation

function MLinkModule

explicit MLinkModule(
    QObject * parent =nullptr
)

function ~MLinkModule

virtual ~MLinkModule() override

function driver

virtual ModuleDriverKind driver() const override

Select how this module will be executed by the Syntalos engine.

Reimplements: Syntalos::AbstractModule::driver

function features

virtual ModuleFeatures features() const override

Return a bitfield of features this module supports.

Reimplements: Syntalos::AbstractModule::features

function moduleBinary

QString moduleBinary() const

function setModuleBinary

void setModuleBinary(
    const QString & binaryPath
)

function moduleBinaryEnv

QProcessEnvironment moduleBinaryEnv() const

function setModuleBinaryEnv

void setModuleBinaryEnv(
    const QProcessEnvironment & env
)

function outputCaptured

bool outputCaptured() const

function setOutputCaptured

void setOutputCaptured(
    bool capture
)

function setPythonVirtualEnv

void setPythonVirtualEnv(
    const QString & venvDir
)

function setScript

void setScript(
    const QString & script,
    const QString & wdir =QString()
)

function setScriptFromFile

bool setScriptFromFile(
    const QString & fname,
    const QString & wdir =QString()
)

function isScriptModified

bool isScriptModified() const

function settingsData

QByteArray settingsData() const

function setSettingsData

void setSettingsData(
    const QByteArray & data
)

function showDisplayUi

virtual void showDisplayUi() override

Show the display widgets of this module.

Reimplements: Syntalos::AbstractModule::showDisplayUi

function showSettingsUi

virtual void showSettingsUi() override

Show the configuration UI of this module.

Reimplements: Syntalos::AbstractModule::showSettingsUi

function terminateProcess

void terminateProcess()

function runProcess

bool runProcess()

function isProcessRunning

bool isProcessRunning() const

function loadCurrentScript

bool loadCurrentScript()

function sendPortInformation

bool sendPortInformation()

function readProcessOutput

QString readProcessOutput()

function markIncomingForExport

void markIncomingForExport(
    StreamExporter * exporter
)

function prepare

virtual bool prepare(
    const TestSubject & testSubject
) override

Prepare for an experiment run.

Return: true if success

Reimplements: Syntalos::AbstractModule::prepare

Prepare this module to run. This method is called once prior to every experiment run.

function start

virtual void start() override

Run when the experiment is started and the HRTimer has an initial time set. Switches the module into “Started” mode.

Reimplements: Syntalos::AbstractModule::start

function stop

virtual void stop() override

Stop running an experiment. Stop execution of an experiment. This method is called after prepare() was run.

Reimplements: Syntalos::AbstractModule::stop

Friends

friend Private

friend class Private(
    Private 
);

Updated on 2024-11-06 at 17:10:29 +0000