15 boost::shared_ptr<ChimeraTK::TransferElement> externalTriggerImpl,
DeviceManager& deviceModule)
16 : _externalTrigger(std::move(externalTriggerImpl)), _deviceModule(deviceModule) {}
24 catch(ChimeraTK::logic_error& e) {
25 std::cerr << e.what() << std::endl;
34 _thread = boost::thread([
this] { this->
run(); });
48 catch(boost::thread_resource_error&) {
56 struct SendDataToConsumers {
57 SendDataToConsumers(VersionNumber theVersion, DataValidity initialTriggerValidity)
60 template<
typename PAIR>
61 void operator()(PAIR& pair)
const {
62 auto theMap = pair.second;
66 for(
auto& network : theMap) {
67 auto feeder = network.first;
68 auto fanOut = network.second;
69 fanOut->setDataValidity((triggerValidity == DataValidity::ok && feeder->dataValidity() == DataValidity::ok) ?
71 DataValidity::faulty);
72 fanOut->accessChannel(0).swap(feeder->accessChannel(0));
75 bool dataLoss = fanOut->write(version);
80 fanOut->accessChannel(0).swap(feeder->accessChannel(0));
124 boost::this_thread::interruption_point();
126 boost::this_thread::interruption_point();
DataValidity triggerValidity
detail::TestableMode & getTestableMode()
Get the TestableMode control object of this application.
static void registerThread(const std::string &name)
Register the thread in the application system and give it a name.
static Application & getInstance()
Obtain instance of the application.
VersionNumber getStartVersion() const
Return the start version.
static void incrementDataLossCounter(const std::string &name)
Increment counter for how many write() operations have overwritten unread data.
Implements access to a ChimeraTK::Device.
void waitForInitialValues()
Wait for initial values coming from the device.
std::atomic< bool > _testableModeReached
Flag used by the testable mode to identify whether a thread within the EntityOwner has reached the po...
boost::shared_ptr< ChimeraTK::TransferElement > _externalTrigger
TransferElement acting as our trigger.
DeviceManager & _deviceModule
The DeviceModule of the feeder.
boost::thread _thread
Thread handling the synchronisation, if needed.
void activate() override
Activate synchronisation thread if needed.
TemplateUserTypeMap< FanOutMap > _fanOutMap
TriggerFanOut(boost::shared_ptr< ChimeraTK::TransferElement > externalTriggerImpl, DeviceManager &deviceModule)
void deactivate() final
Deactivate synchronisation thread if running.
ChimeraTK::TransferGroup _transferGroup
TransferGroup containing all feeders NDRegisterAccessors.
~TriggerFanOut() override
void run()
Synchronise feeder and the consumers.
InvalidityTracer application module.