ChimeraTK-ApplicationCore  04.01.00
DeviceModule.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Deutsches Elektronen-Synchrotron DESY, MSK, ChimeraTK Project <chimeratk-support@desy.de>
2 // SPDX-License-Identifier: LGPL-3.0-or-later
3 #pragma once
4 
5 #include "ModuleGroup.h"
6 
7 #include <ChimeraTK/Device.h>
8 #include <ChimeraTK/ForwardDeclarations.h>
9 #include <ChimeraTK/RegisterPath.h>
10 
11 #include <boost/thread/latch.hpp>
12 
13 namespace ChimeraTK {
14  class DeviceManager;
15 
16  /*********************************************************************************************************************/
17 
20  class DeviceModule : public ModuleGroup {
21  public:
44  DeviceModule(ModuleGroup* owner, const std::string& deviceAliasOrCDD, const std::string& triggerPath = {},
45  std::function<void(ChimeraTK::Device&)> initialisationHandler = nullptr, const std::string& pathInDevice = "/");
46 
48 
50  DeviceModule(DeviceModule&& other) noexcept { operator=(std::move(other)); }
51 
53  DeviceModule& operator=(DeviceModule&& other) noexcept;
54 
59  const DeviceManager& getDeviceManager() const;
60 
62 
63  const std::string& getDeviceAliasOrURI() const;
64 
65  void addInitialisationHandler(std::function<void(ChimeraTK::Device&)> initialisationHandler);
66 
72  void reportException(std::string errMsg);
73 
74  const std::string& getTriggerPath() const { return _triggerPath; }
75 
76  protected:
78  boost::weak_ptr<DeviceManager> _dm;
79 
81  friend class ChimeraTK::Model::Impl;
82 
83  std::string _triggerPath;
84 
85  std::string _pathInDevice;
86  };
87 
88  /*********************************************************************************************************************/
89 
95  public:
96  explicit SetDMapFilePath(const std::string& dmapFilePath);
97  };
98 
99  /*********************************************************************************************************************/
100 
101 } /* namespace ChimeraTK */
ChimeraTK::DeviceModule::addInitialisationHandler
void addInitialisationHandler(std::function< void(ChimeraTK::Device &)> initialisationHandler)
Definition: DeviceModule.cc:160
ChimeraTK::Model::Impl
Implementation class for the model.
Definition: Model.h:1358
ChimeraTK::DeviceModule::reportException
void reportException(std::string errMsg)
Use this function to report an exception.
Definition: DeviceModule.cc:166
ChimeraTK::SetDMapFilePath::SetDMapFilePath
SetDMapFilePath(const std::string &dmapFilePath)
Definition: DeviceModule.cc:172
ChimeraTK::ModuleGroup
Definition: ModuleGroup.h:16
ChimeraTK::Model::DeviceModuleProxy
Definition: Model.h:354
ChimeraTK::ModuleGroup::ModuleGroup
ModuleGroup()=default
Default constructor to allow late initialisation of module groups.
ChimeraTK::DeviceModule
Definition: DeviceModule.h:20
ModuleGroup.h
ChimeraTK::DeviceModule::_pathInDevice
std::string _pathInDevice
Definition: DeviceModule.h:85
ChimeraTK::DeviceModule::_dm
boost::weak_ptr< DeviceManager > _dm
The corresponding DeviceManager.
Definition: DeviceModule.h:78
ChimeraTK::DeviceManager
Implements access to a ChimeraTK::Device.
Definition: DeviceManager.h:20
ChimeraTK::DeviceModule::getDeviceManager
DeviceManager & getDeviceManager()
Return the corresponding DeviceManager.
Definition: DeviceModule.cc:136
ChimeraTK::SetDMapFilePath
Helper class to set the DMAP file path.
Definition: DeviceModule.h:94
ChimeraTK::DeviceModule::_model
Model::DeviceModuleProxy _model
Definition: DeviceModule.h:80
ChimeraTK::DeviceModule::operator=
DeviceModule & operator=(DeviceModule &&other) noexcept
Move assignment.
Definition: DeviceModule.cc:75
ChimeraTK::DeviceModule::getDeviceAliasOrURI
const std::string & getDeviceAliasOrURI() const
Definition: DeviceModule.cc:154
ChimeraTK::ModuleGroup::DeviceModule
friend class DeviceModule
Definition: ModuleGroup.h:48
ChimeraTK::DeviceModule::_triggerPath
std::string _triggerPath
Definition: DeviceModule.h:83
ChimeraTK::DeviceModule::getModel
Model::DeviceModuleProxy getModel()
Definition: DeviceModule.cc:148
ChimeraTK::DeviceModule::DeviceModule
DeviceModule(DeviceModule &&other) noexcept
Move operation with the move constructor.
Definition: DeviceModule.h:50
ChimeraTK
InvalidityTracer application module.
Definition: spec_dataValidityPropagation.dox:2
ChimeraTK::DeviceModule::getTriggerPath
const std::string & getTriggerPath() const
Definition: DeviceModule.h:74