16 class InterModuleCommunicator;
21 namespace InterModuleCommunicatorTasks
91 virtual const char*
GetParamClassTag() const noexcept
override {
return "InterModuleCommunicatorParams"; }
130 constexpr
static auto Name() noexcept {
return "Inter-Module Communicator"; }
149 template <
typename DerivedEvent,
150 std::enable_if_t<std::is_base_of_v<DynExp::InterModuleEventBase, DerivedEvent>,
int> = 0>
156 for (
auto ID : UserIDs)
159 if (Caller.
GetID() == ID)
162 auto Resource = ModuleMgr.GetResource(ID);
165 for (
int NumTries = 0;
true; NumTries++)
169 if (Resource->IsReady())
170 Resource->EnqueueEvent(std::make_unique<DerivedEvent>(InterModuleEvent));
178 std::this_thread::yield();
190 void ResetImpl(dispatch_tag<DynExp::InstrumentBase>)
override final;
Defines DynExp's core module as an interface between the UI and DynExp objects.
Configurator class for InterModuleCommunicator.
virtual ~InterModuleCommunicatorConfigurator()=default
InterModuleCommunicatorConfigurator()=default
virtual DynExp::ParamsBasePtrType MakeParams(DynExp::ItemIDType ID, const DynExp::DynExpCore &Core) const override
Override to make derived classes call DynExp::MakeParams with the correct configurator type derived f...
Data class for InterModuleCommunicator.
InterModuleCommunicatorData()=default
virtual void ResetImpl(dispatch_tag< InterModuleCommunicatorData >)
void ResetImpl(dispatch_tag< DynExp::InstrumentDataBase >) override final
Refer to DynExp::InstrumentDataBase::Reset(). Using tag dispatch mechanism to ensure that ResetImpl()...
virtual ~InterModuleCommunicatorData()=default
Parameter class for InterModuleCommunicator.
virtual const char * GetParamClassTag() const noexcept override
This function is intended to be overridden once in each derived class returning the name of the respe...
InterModuleCommunicatorParams(DynExp::ItemIDType ID, const DynExp::DynExpCore &Core)
Constructs the parameters for a InterModuleCommunicator instance.
DummyParam Dummy
Dummy parameter which is to be owned once by parameter classes that do not contain any other paramete...
virtual void ConfigureParamsImpl(dispatch_tag< InterModuleCommunicatorParams >)
Called by DynExp::ParamsBase::ConfigureParams() as a starting point for the tag dispatch mechanism to...
void ConfigureParamsImpl(dispatch_tag< DynExp::InstrumentParamsBase >) override final
Called by DynExp::ParamsBase::ConfigureParams() as a starting point for the tag dispatch mechanism to...
virtual ~InterModuleCommunicatorParams()=default
Defines a task for deinitializing an instrument within an instrument inheritance hierarchy....
virtual void ExitFuncImpl(dispatch_tag< ExitTask >, DynExp::InstrumentInstance &Instance)
Deinitializes the respective instrument within the instrument inheritance hierarchy....
void ExitFuncImpl(dispatch_tag< DynExp::ExitTaskBase >, DynExp::InstrumentInstance &Instance) override final
Deinitializes the respective instrument within the instrument inheritance hierarchy....
Defines a task for initializing an instrument within an instrument inheritance hierarchy....
void InitFuncImpl(dispatch_tag< DynExp::InitTaskBase >, DynExp::InstrumentInstance &Instance) override final
Initializes the respective instrument within the instrument inheritance hierarchy....
virtual void InitFuncImpl(dispatch_tag< InitTask >, DynExp::InstrumentInstance &Instance)
Initializes the respective instrument within the instrument inheritance hierarchy....
Defines a task for updating an instrument within an instrument inheritance hierarchy....
void UpdateFuncImpl(dispatch_tag< DynExp::UpdateTaskBase >, DynExp::InstrumentInstance &Instance) override final
Updates the respective instrument within the instrument inheritance hierarchy. Call UpdateFuncImpl() ...
virtual void UpdateFuncImpl(dispatch_tag< UpdateTask >, DynExp::InstrumentInstance &Instance)
Updates the respective instrument within the instrument inheritance hierarchy. Call UpdateFuncImpl() ...
Defines an inter-module communicator instrument to exchange events in between DynExp modules....
void PostEvent(const DynExp::ModuleBase &Caller, const DerivedEvent &InterModuleEvent) const
Inserts the event passed to the function into the event queues of the modules making use of this Inte...
virtual void ResetImpl(dispatch_tag< InterModuleCommunicator >)
Refer to DynExp::Object::Reset(). Using tag dispatch mechanism to ensure that ResetImpl() of every de...
constexpr static auto Name() noexcept
Every derived class has to redefine this function.
virtual std::string GetName() const override
Returns the name of this Object type.
const DynExp::DynExpCore & Core
Reference to DynExp's core.
virtual ~InterModuleCommunicator()
InterModuleCommunicator(const std::thread::id OwnerThreadID, DynExp::ParamsBasePtrType &&Params)
Constructs an instrument instance.
void ResetImpl(dispatch_tag< DynExp::InstrumentBase >) override final
Refer to DynExp::Object::Reset(). Using tag dispatch mechanism to ensure that ResetImpl() of every de...
DynExp's core class acts as the interface between the user interface and DynExp's internal data like ...
auto & GetModuleManager() noexcept
Getter for the module manager.
Defines a task for deinitializing an instrument within an instrument inheritance hierarchy....
Refer to DynExp::ParamsBase::dispatch_tag.
Defines a task for initializing an instrument within an instrument inheritance hierarchy....
Refer to DynExp::ParamsBase::dispatch_tag.
Base class for instruments. Instruments comprise virtual devices (meta instruments) and physial devic...
Configurator class for InstrumentBase.
Data structure to contain data which is synchronized in between different threads....
Refer to ParamsBase::dispatch_tag.
Defines data for a thread belonging to a InstrumentBase instance. Refer to RunnableInstance.
Parameter class for InstrumentBase.
InstrumentParamsBase(ItemIDType ID, const DynExpCore &Core)
Constructs the parameters for a InstrumentBase instance.
Base class for modules. Modules implement programs on their own (e.g. measurement protocols or server...
auto GetUserIDs(const std::chrono::milliseconds Timeout=Util::ILockable::DefaultTimeout) const
Returns a list of the IDs of the registered users in a thread-safe way.
ItemIDType GetID() const noexcept
Returns the ID of this Object instance. Thread-safe since ID is const.
const std::thread::id OwnerThreadID
Thread id of the thread which has constructed (and owns) this Object instance.
const ParamsBasePtrType Params
Pointer to the parameter class instance belonging to this Object instance.
Refer to ParamsBase::dispatch_tag.
Dummy parameter which is to be owned once by parameter classes that do not contain any other paramete...
const ItemIDType ID
ID of the Object this parameter class instance belongs to.
const DynExpCore & Core
Reference to DynExp's core.
Tag for function dispatching mechanism within this class used when derived classes are not intended t...
Defines a task for updating an instrument within an instrument inheritance hierarchy....
Refer to DynExp::ParamsBase::dispatch_tag.
Thrown when an operation timed out before it could be completed, especially used for locking shared d...
DynExp's instrument namespace contains the implementation of DynExp instruments which extend DynExp's...
DynExp's main namespace contains the implementation of DynExp including classes to manage resources (...
std::unique_ptr< ParamsBase > ParamsBasePtrType
Alias for a pointer to the parameter system base class ParamsBase.
size_t ItemIDType
ID type of objects/items managed by DynExp.
Accumulates include statements to provide a precompiled header.