14 #ifndef SECONDARYDRIVERINTERFACE_H_
15 #define SECONDARYDRIVERINTERFACE_H_
17 #include "secondarydriver.h"
21 Transaction &tr_meas,
const shared_ptr<XMeasure> &meas) :
22 T(name, runtime, ref(tr_meas), meas),
23 m_drivers(meas->drivers()) {
33 onConnectedRecorded(shot,
this);
38 Snapshot shot_all_drivers( *m_drivers.lock());
39 if( !shot_all_drivers.isUpperOf( *
this))
41 Snapshot shot_this( *
this, shot_all_drivers);
43 bool firsttime =
true;
47 shot_all_drivers = tr.newTransactionUsingSnapshotFor( *m_drivers.lock());
50 catch (
typename T::NodeNotFoundError &) {
55 if( !shot_all_drivers.isUpperOf( *driver))
61 for(
auto it = shot_this[ *
this].m_connections.begin(); it != shot_this[ *
this].m_connections.end(); ++it) {
62 if((shared_ptr<XNode>(shot_this[ *it->m_selecter]).get() == driver) &&
63 (shot_emitter[ *driver].time())) {
72 for(
auto it = shot_this[ *
this].m_connections.begin();
73 it != shot_this[ *
this].m_connections.end(); ++it) {
74 shared_ptr<XNode> node = shot_this[ *it->m_selecter];
76 if( !shot_all_drivers.isUpperOf( *node))
78 if((node.get() != driver) &&
79 !shot_all_drivers[ *static_pointer_cast<XDriver>(node)].time())
85 if( !checkDependency(tr, shot_emitter, shot_all_drivers, driver))
90 XTime time_recorded = shot_emitter[ *driver].time();
92 analyze(tr, shot_emitter, shot_all_drivers, driver);
94 catch (
typename T::XSkippedRecordError& e) {
98 catch (
typename T::XRecordError& e) {
99 time_recorded =
XTime();
103 this->record(tr, shot_emitter[ *driver].timeAwared(), time_recorded);
105 if(err.msg().length())
106 err.print(this->getLabel() +
": ");
117 con.m_selecter = selecter;
118 tr[ *
this].m_connections.push_back(con);
122 if(m_lsnOnItemChanged)
123 tr[ *selecter].onValueChanged().connect(m_lsnOnItemChanged);
125 m_lsnOnItemChanged = tr[ *selecter].onValueChanged().connectWeakly(this->shared_from_this(),
133 shared_ptr<XNode> nd = shot[ *item];
134 auto driver = static_pointer_cast<
XDriver>(nd);
136 shared_ptr<XListener> lsnonrecord;
139 lsnonrecord = tr[ *driver].onRecord().connectWeakly(
144 auto it = std::find(tr[ *
this].m_connections.begin(), tr[ *
this].m_connections.end(), item);
145 it->m_lsnOnRecord = lsnonrecord;