DynExp
Highly flexible laboratory automation for dynamically changing experiments.
NetworkDataStreamInstrumentModule.h
Go to the documentation of this file.
1 // This file is part of DynExp.
2 
9 #pragma once
10 
11 #include "stdafx.h"
12 #include "../Instruments/NetworkDataStreamInstrument.h"
13 #include "gRPCModule.h"
14 
15 #include "NetworkDataStreamInstrument.grpc.pb.h"
16 
17 namespace DynExpModule
18 {
19  template <typename... gRPCServices>
20  class NetworkDataStreamInstrumentT;
21 
22  template <typename... gRPCServices>
23  class NetworkDataStreamInstrumentData : public gRPCModuleData<gRPCServices...>
24  {
25  public:
27  virtual ~NetworkDataStreamInstrumentData() = default;
28 
29  auto& GetDataStreamInstrument() noexcept { return DataStreamInstrument; }
30 
31  private:
34 
35  void Init() {}
36 
38  };
39 
40  template <typename... gRPCServices>
41  class NetworkDataStreamInstrumentParams : public gRPCModuleParams<gRPCServices...>
42  {
43  public:
46 
47  virtual const char* GetParamClassTag() const noexcept override { return "NetworkDataStreamInstrumentParams"; }
48 
50  "DataStreamInstrument", "Data stream instrument", "Data stream instrument to receive data from with this network module", DynExpUI::Icons::Instrument };
51 
52  private:
55  };
56 
57  template <typename... gRPCServices>
59  {
60  public:
61  using ObjectType = NetworkDataStreamInstrumentT<gRPCServices...>;
63 
66 
67  private:
68  virtual DynExp::ParamsBasePtrType MakeParams(DynExp::ItemIDType ID, const DynExp::DynExpCore& Core) const override { return DynExp::MakeParams<NetworkDataStreamInstrumentConfigurator>(ID, Core); }
69  };
70 
71  template <typename... gRPCServices>
72  class NetworkDataStreamInstrumentT : public gRPCModule<gRPCServices...>
73  {
74  public:
79 
80  constexpr static auto Name() noexcept { return "Network Data Stream Instrument"; }
81 
83  : gRPCModule<gRPCServices...>(OwnerThreadID, std::move(Params)) {}
84  virtual ~NetworkDataStreamInstrumentT() = default;
85 
86  virtual std::string GetName() const override { return Name(); }
87 
88  protected:
90  : public gRPCModule<gRPCServices...>::template TypedCallDataBase<CallDataGetStreamInfo, ThisServiceType, DynExpProto::Common::VoidMessage, DynExpProto::NetworkDataStreamInstrument::StreamInfoMessage>
91  {
92  using Base = gRPCModule<gRPCServices...>::template TypedCallDataBase<CallDataGetStreamInfo, ThisServiceType, DynExpProto::Common::VoidMessage, DynExpProto::NetworkDataStreamInstrument::StreamInfoMessage>;
93  using Base::ResponseMessage;
94 
95  public:
96  CallDataGetStreamInfo(const gRPCModule<gRPCServices...>* const OwningModule) noexcept
97  : Base::TypedCallDataBase(OwningModule, &ThisServiceType::AsyncService::RequestGetStreamInfo) {}
98  virtual ~CallDataGetStreamInfo() = default;
99 
100  private:
101  virtual void ProcessChildImpl(DynExp::ModuleInstance& Instance) override
102  {
103  auto StreamSizeMsg = std::make_unique<DynExpProto::NetworkDataStreamInstrument::StreamSizeMessage>();
104  auto ModuleData = DynExp::dynamic_ModuleData_cast<NetworkDataStreamInstrumentT>(Instance.ModuleDataGetter());
105  auto Instrument = ModuleData->GetDataStreamInstrument().get();
106  auto InstrData = DynExp::dynamic_InstrumentData_cast<DynExpInstr::DataStreamInstrument>(Instrument->GetInstrumentData());
107 
108  ResponseMessage.set_valueunit(DynExpInstr::ToPrototUnitType(Instrument->GetValueUnit()));
109  ResponseMessage.set_hardwareminvalue(InstrData->GetHardwareMinValue());
110  ResponseMessage.set_hardwaremaxvalue(InstrData->GetHardwareMaxValue());
111  ResponseMessage.set_isbasicsampletimeused(InstrData->GetSampleStream()->IsBasicSampleTimeUsed());
112 
113  StreamSizeMsg->set_streamsizeread(Util::NumToT<google::protobuf::uint64>(InstrData->GetSampleStream()->GetStreamSizeRead()));
114  StreamSizeMsg->set_streamsizewrite(Util::NumToT<google::protobuf::uint64>(InstrData->GetSampleStream()->GetStreamSizeWrite()));
115  ResponseMessage.set_allocated_streamsizemsg(StreamSizeMsg.release());
116  }
117  };
118 
120  : public gRPCModule<gRPCServices...>::template TypedCallDataBase<CallDataRead, ThisServiceType, DynExpProto::NetworkDataStreamInstrument::ReadMessage, DynExpProto::NetworkDataStreamInstrument::ReadResultMessage>
121  {
122  using Base = gRPCModule<gRPCServices...>::template TypedCallDataBase<CallDataRead, ThisServiceType, DynExpProto::NetworkDataStreamInstrument::ReadMessage, DynExpProto::NetworkDataStreamInstrument::ReadResultMessage>;
123  using Base::RequestMessage;
124  using Base::ResponseMessage;
125 
126  public:
127  CallDataRead(const gRPCModule<gRPCServices...>* const OwningModule) noexcept
128  : Base::TypedCallDataBase(OwningModule, &ThisServiceType::AsyncService::RequestRead) {}
129  virtual ~CallDataRead() = default;
130 
131  private:
132  virtual void ProcessChildImpl(DynExp::ModuleInstance& Instance) override
133  {
134  auto StartSample = Util::NumToT<size_t>(RequestMessage.startsampleid());
135  auto ModuleData = DynExp::dynamic_ModuleData_cast<NetworkDataStreamInstrumentT>(Instance.ModuleDataGetter());
136  auto Instrument = ModuleData->GetDataStreamInstrument().get();
137  auto InstrData = DynExp::dynamic_InstrumentData_cast<DynExpInstr::DataStreamInstrument>(Instrument->GetInstrumentData());
138  auto SampleStream = InstrData->template GetCastSampleStream<DynExpInstr::CircularDataStreamBase>();
139 
140  Instrument->ReadData();
141 
142  if (SampleStream->GetNumSamplesWritten() == StartSample)
143  {
144  ResponseMessage.set_lastsampleid(Util::NumToT<google::protobuf::uint64>(StartSample));
145  return;
146  }
147  if (SampleStream->GetNumSamplesWritten() < StartSample)
148  StartSample = 0; // e.g. if SampleStream has been cleared. Transmit the entire buffer then.
149 
150  auto Samples = SampleStream->ReadRecentBasicSamples(StartSample);
151 
152  ResponseMessage.set_lastsampleid(Util::NumToT<google::protobuf::uint64>(SampleStream->GetNumSamplesWritten()));
153  for (const auto& Sample : Samples)
154  {
155  auto BasicSampleMsg = ResponseMessage.add_samples();
156  BasicSampleMsg->set_value(Sample.Value);
157  BasicSampleMsg->set_time(Sample.Time);
158  }
159  }
160  };
161 
163  : public gRPCModule<gRPCServices...>::template TypedCallDataBase<CallDataWrite, ThisServiceType, DynExpProto::NetworkDataStreamInstrument::WriteMessage, DynExpProto::NetworkDataStreamInstrument::WriteResultMessage>
164  {
165  using Base = gRPCModule<gRPCServices...>::template TypedCallDataBase<CallDataWrite, ThisServiceType, DynExpProto::NetworkDataStreamInstrument::WriteMessage, DynExpProto::NetworkDataStreamInstrument::WriteResultMessage>;
166  using Base::RequestMessage;
167  using Base::ResponseMessage;
168 
169  public:
170  CallDataWrite(const gRPCModule<gRPCServices...>* const OwningModule) noexcept
171  : Base::TypedCallDataBase(OwningModule, &ThisServiceType::AsyncService::RequestWrite) {}
172  virtual ~CallDataWrite() = default;
173 
174  private:
175  virtual void ProcessChildImpl(DynExp::ModuleInstance& Instance) override
176  {
177  auto ModuleData = DynExp::dynamic_ModuleData_cast<NetworkDataStreamInstrumentT>(Instance.ModuleDataGetter());
178  auto Instrument = ModuleData->GetDataStreamInstrument().get();
179  auto InstrData = DynExp::dynamic_InstrumentData_cast<DynExpInstr::DataStreamInstrument>(Instrument->GetInstrumentData());
180 
181  for (decltype(RequestMessage.samples_size()) i = 0; i < RequestMessage.samples_size(); ++i)
182  InstrData->GetSampleStream()->WriteBasicSample({ RequestMessage.samples(i).value(), RequestMessage.samples(i).time() });
183  Instrument->WriteData();
184 
185  ResponseMessage.set_lastsampleid(InstrData->GetSampleStream()->GetNumSamplesWritten());
186  }
187  };
188 
190  : public gRPCModule<gRPCServices...>::template TypedCallDataBase<CallDataClearData, ThisServiceType, DynExpProto::Common::VoidMessage, DynExpProto::Common::VoidMessage>
191  {
192  using Base = gRPCModule<gRPCServices...>::template TypedCallDataBase<CallDataClearData, ThisServiceType, DynExpProto::Common::VoidMessage, DynExpProto::Common::VoidMessage>;
193 
194  public:
195  CallDataClearData(const gRPCModule<gRPCServices...>* const OwningModule) noexcept
196  : Base::TypedCallDataBase(OwningModule, &ThisServiceType::AsyncService::RequestClearData) {}
197  virtual ~CallDataClearData() = default;
198 
199  private:
200  virtual void ProcessChildImpl(DynExp::ModuleInstance& Instance) override
201  {
202  auto ModuleData = DynExp::dynamic_ModuleData_cast<NetworkDataStreamInstrumentT>(Instance.ModuleDataGetter());
203 
204  ModuleData->GetDataStreamInstrument()->Clear();
205  }
206  };
207 
209  : public gRPCModule<gRPCServices...>::template TypedCallDataBase<CallDataStart, ThisServiceType, DynExpProto::Common::VoidMessage, DynExpProto::Common::VoidMessage>
210  {
211  using Base = gRPCModule<gRPCServices...>::template TypedCallDataBase<CallDataStart, ThisServiceType, DynExpProto::Common::VoidMessage, DynExpProto::Common::VoidMessage>;
212 
213  public:
214  CallDataStart(const gRPCModule<gRPCServices...>* const OwningModule) noexcept
215  : Base::TypedCallDataBase(OwningModule, &ThisServiceType::AsyncService::RequestStart) {}
216  virtual ~CallDataStart() = default;
217 
218  private:
219  virtual void ProcessChildImpl(DynExp::ModuleInstance& Instance) override
220  {
221  auto ModuleData = DynExp::dynamic_ModuleData_cast<NetworkDataStreamInstrumentT>(Instance.ModuleDataGetter());
222 
223  ModuleData->GetDataStreamInstrument()->Start();
224  }
225  };
226 
228  : public gRPCModule<gRPCServices...>::template TypedCallDataBase<CallDataStop, ThisServiceType, DynExpProto::Common::VoidMessage, DynExpProto::Common::VoidMessage>
229  {
230  using Base = gRPCModule<gRPCServices...>::template TypedCallDataBase<CallDataStop, ThisServiceType, DynExpProto::Common::VoidMessage, DynExpProto::Common::VoidMessage>;
231 
232  public:
233  CallDataStop(const gRPCModule<gRPCServices...>* const OwningModule) noexcept
234  : Base::TypedCallDataBase(OwningModule, &ThisServiceType::AsyncService::RequestStop) {}
235  virtual ~CallDataStop() = default;
236 
237  private:
238  virtual void ProcessChildImpl(DynExp::ModuleInstance& Instance) override
239  {
240  auto ModuleData = DynExp::dynamic_ModuleData_cast<NetworkDataStreamInstrumentT>(Instance.ModuleDataGetter());
241 
242  ModuleData->GetDataStreamInstrument()->Stop();
243  }
244  };
245 
247  : public gRPCModule<gRPCServices...>::template TypedCallDataBase<CallDataRestart, ThisServiceType, DynExpProto::Common::VoidMessage, DynExpProto::Common::VoidMessage>
248  {
249  using Base = gRPCModule<gRPCServices...>::template TypedCallDataBase<CallDataRestart, ThisServiceType, DynExpProto::Common::VoidMessage, DynExpProto::Common::VoidMessage>;
250 
251  public:
252  CallDataRestart(const gRPCModule<gRPCServices...>* const OwningModule) noexcept
253  : Base::TypedCallDataBase(OwningModule, &ThisServiceType::AsyncService::RequestRestart) {}
254  virtual ~CallDataRestart() = default;
255 
256  private:
257  virtual void ProcessChildImpl(DynExp::ModuleInstance& Instance) override
258  {
259  auto ModuleData = DynExp::dynamic_ModuleData_cast<NetworkDataStreamInstrumentT>(Instance.ModuleDataGetter());
260 
261  ModuleData->GetDataStreamInstrument()->Restart();
262  }
263  };
264 
266  : public gRPCModule<gRPCServices...>::template TypedCallDataBase<CallDataGetStreamSize, ThisServiceType, DynExpProto::Common::VoidMessage, DynExpProto::NetworkDataStreamInstrument::StreamSizeMessage>
267  {
268  using Base = gRPCModule<gRPCServices...>::template TypedCallDataBase<CallDataGetStreamSize, ThisServiceType, DynExpProto::Common::VoidMessage, DynExpProto::NetworkDataStreamInstrument::StreamSizeMessage>;
269  using Base::ResponseMessage;
270 
271  public:
272  CallDataGetStreamSize(const gRPCModule<gRPCServices...>* const OwningModule) noexcept
273  : Base::TypedCallDataBase(OwningModule, &ThisServiceType::AsyncService::RequestGetStreamSize) {}
274  virtual ~CallDataGetStreamSize() = default;
275 
276  private:
277  virtual void ProcessChildImpl(DynExp::ModuleInstance& Instance) override
278  {
279  auto ModuleData = DynExp::dynamic_ModuleData_cast<NetworkDataStreamInstrumentT>(Instance.ModuleDataGetter());
280  auto Instrument = ModuleData->GetDataStreamInstrument().get();
281  auto InstrData = DynExp::dynamic_InstrumentData_cast<DynExpInstr::DataStreamInstrument>(Instrument->GetInstrumentData());
282 
283  ResponseMessage.set_streamsizeread(Util::NumToT<google::protobuf::uint64>(InstrData->GetSampleStream()->GetStreamSizeRead()));
284  ResponseMessage.set_streamsizewrite(Util::NumToT<google::protobuf::uint64>(InstrData->GetSampleStream()->GetStreamSizeWrite()));
285  }
286  };
287 
289  : public gRPCModule<gRPCServices...>::template TypedCallDataBase<CallDataSetStreamSize, ThisServiceType, DynExpProto::NetworkDataStreamInstrument::StreamSizeMessage, DynExpProto::NetworkDataStreamInstrument::StreamSizeMessage>
290  {
291  using Base = gRPCModule<gRPCServices...>::template TypedCallDataBase<CallDataSetStreamSize, ThisServiceType, DynExpProto::NetworkDataStreamInstrument::StreamSizeMessage, DynExpProto::NetworkDataStreamInstrument::StreamSizeMessage>;
292  using Base::RequestMessage;
293  using Base::ResponseMessage;
294 
295  public:
296  CallDataSetStreamSize(const gRPCModule<gRPCServices...>* const OwningModule) noexcept
297  : Base::TypedCallDataBase(OwningModule, &ThisServiceType::AsyncService::RequestSetStreamSize) {}
298  virtual ~CallDataSetStreamSize() = default;
299 
300  private:
301  virtual void ProcessChildImpl(DynExp::ModuleInstance& Instance) override
302  {
303  auto ModuleData = DynExp::dynamic_ModuleData_cast<NetworkDataStreamInstrumentT>(Instance.ModuleDataGetter());
304  ModuleData->GetDataStreamInstrument()->AsSyncTask(&DynExpInstr::DataStreamInstrument::SetStreamSize, Util::NumToT<size_t>(RequestMessage.streamsizewrite()));
305 
306  auto Instrument = ModuleData->GetDataStreamInstrument().get();
307  auto InstrData = DynExp::dynamic_InstrumentData_cast<DynExpInstr::DataStreamInstrument>(Instrument->GetInstrumentData());
308  ResponseMessage.set_streamsizeread(Util::NumToT<google::protobuf::uint64>(InstrData->GetSampleStream()->GetStreamSizeRead()));
309  ResponseMessage.set_streamsizewrite(Util::NumToT<google::protobuf::uint64>(InstrData->GetSampleStream()->GetStreamSizeWrite()));
310  }
311  };
312 
314  : public gRPCModule<gRPCServices...>::template TypedCallDataBase<CallDataResetStreamSize, ThisServiceType, DynExpProto::Common::VoidMessage, DynExpProto::NetworkDataStreamInstrument::StreamSizeMessage>
315  {
316  using Base = gRPCModule<gRPCServices...>::template TypedCallDataBase<CallDataResetStreamSize, ThisServiceType, DynExpProto::Common::VoidMessage, DynExpProto::NetworkDataStreamInstrument::StreamSizeMessage>;
317  using Base::ResponseMessage;
318 
319  public:
320  CallDataResetStreamSize(const gRPCModule<gRPCServices...>* const OwningModule) noexcept
321  : Base::TypedCallDataBase(OwningModule, &ThisServiceType::AsyncService::RequestResetStreamSize) {}
322  virtual ~CallDataResetStreamSize() = default;
323 
324  private:
325  virtual void ProcessChildImpl(DynExp::ModuleInstance& Instance) override
326  {
327  auto ModuleData = DynExp::dynamic_ModuleData_cast<NetworkDataStreamInstrumentT>(Instance.ModuleDataGetter());
328  ModuleData->GetDataStreamInstrument()->AsSyncTask(&DynExpInstr::DataStreamInstrument::ResetStreamSize);
329 
330  auto Instrument = ModuleData->GetDataStreamInstrument().get();
331  auto InstrData = DynExp::dynamic_InstrumentData_cast<DynExpInstr::DataStreamInstrument>(Instrument->GetInstrumentData());
332  ResponseMessage.set_streamsizeread(Util::NumToT<google::protobuf::uint64>(InstrData->GetSampleStream()->GetStreamSizeRead()));
333  ResponseMessage.set_streamsizewrite(Util::NumToT<google::protobuf::uint64>(InstrData->GetSampleStream()->GetStreamSizeWrite()));
334  }
335  };
336 
338  : public gRPCModule<gRPCServices...>::template TypedCallDataBase<CallDataHasFinished, ThisServiceType, DynExpProto::Common::VoidMessage, DynExpProto::Common::OptionalBoolMessage>
339  {
340  using Base = gRPCModule<gRPCServices...>::template TypedCallDataBase<CallDataHasFinished, ThisServiceType, DynExpProto::Common::VoidMessage, DynExpProto::Common::OptionalBoolMessage>;
341  using Base::ResponseMessage;
342 
343  public:
344  CallDataHasFinished(const gRPCModule<gRPCServices...>* const OwningModule) noexcept
345  : Base::TypedCallDataBase(OwningModule, &ThisServiceType::AsyncService::RequestHasFinished) {}
346  virtual ~CallDataHasFinished() = default;
347 
348  private:
349  virtual void ProcessChildImpl(DynExp::ModuleInstance& Instance) override
350  {
351  auto ModuleData = DynExp::dynamic_ModuleData_cast<NetworkDataStreamInstrumentT>(Instance.ModuleDataGetter());
352 
353  auto Finished = ModuleData->GetDataStreamInstrument()->HasFinished();
354  if (Finished != Util::OptionalBool::Values::Unknown)
355  ResponseMessage.set_value(Finished);
356  }
357  };
358 
360  : public gRPCModule<gRPCServices...>::template TypedCallDataBase<CallDataIsRunning, ThisServiceType, DynExpProto::Common::VoidMessage, DynExpProto::Common::OptionalBoolMessage>
361  {
362  using Base = gRPCModule<gRPCServices...>::template TypedCallDataBase<CallDataIsRunning, ThisServiceType, DynExpProto::Common::VoidMessage, DynExpProto::Common::OptionalBoolMessage>;
363  using Base::ResponseMessage;
364 
365  public:
366  CallDataIsRunning(const gRPCModule<gRPCServices...>* const OwningModule) noexcept
367  : Base::TypedCallDataBase(OwningModule, &ThisServiceType::AsyncService::RequestIsRunning) {}
368  virtual ~CallDataIsRunning() = default;
369 
370  private:
371  virtual void ProcessChildImpl(DynExp::ModuleInstance& Instance) override
372  {
373  auto ModuleData = DynExp::dynamic_ModuleData_cast<NetworkDataStreamInstrumentT>(Instance.ModuleDataGetter());
374 
375  auto Running = ModuleData->GetDataStreamInstrument()->IsRunning();
377  ResponseMessage.set_value(Running);
378  }
379  };
380 
381  private:
383  {
385  }
386 
388 
390  {
391  CallDataGetStreamInfo::MakeCall(this, Instance);
392  CallDataRead::MakeCall(this, Instance);
393  CallDataWrite::MakeCall(this, Instance);
394  CallDataClearData::MakeCall(this, Instance);
395  CallDataStart::MakeCall(this, Instance);
396  CallDataStop::MakeCall(this, Instance);
397  CallDataRestart::MakeCall(this, Instance);
398  CallDataGetStreamSize::MakeCall(this, Instance);
399  CallDataSetStreamSize::MakeCall(this, Instance);
400  CallDataResetStreamSize::MakeCall(this, Instance);
401  CallDataHasFinished::MakeCall(this, Instance);
402  CallDataIsRunning::MakeCall(this, Instance);
403 
405  }
406 
408 
409  virtual void OnInitChild(DynExp::ModuleInstance* Instance) const override
410  {
411  auto ModuleParams = DynExp::dynamic_Params_cast<NetworkDataStreamInstrumentT>(Instance->ParamsGetter());
412  auto ModuleData = DynExp::dynamic_ModuleData_cast<NetworkDataStreamInstrumentT>(Instance->ModuleDataGetter());
413 
414  Instance->LockObject(ModuleParams->DataStreamInstrument, ModuleData->GetDataStreamInstrument());
415 
416  try
417  {
418  ValidateInstrType(ModuleData->GetDataStreamInstrument().get());
419  }
420  catch ([[maybe_unused]] const Util::TypeErrorException& e)
421  {
423  + ") because an instrument assigned to this gRPC data stream server does not match the expected type.", Util::ErrorType::Error);
424 
425  throw;
426  }
427  }
428 
429  virtual void OnExitChild(DynExp::ModuleInstance* Instance) const override
430  {
431  auto ModuleData = DynExp::dynamic_ModuleData_cast<NetworkDataStreamInstrumentT>(Instance->ModuleDataGetter());
432 
433  Instance->UnlockObject(ModuleData->GetDataStreamInstrument());
434  }
435 
436  virtual void ValidateInstrType(const DynExpInstr::DataStreamInstrument* Instr) const {}
437  };
438 
443 }
Implementation of the data stream meta instrument, which is a base class for all instruments reading/...
virtual void SetStreamSize(size_t BufferSizeInSamples, DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const
Enqueues a task to set the size of the instrument's sample stream. The default implementation just ca...
virtual void ResetStreamSize(DynExp::TaskBase::CallbackType CallbackFunc=nullptr) const
Enqueues a task to reset the size of the instrument's sample stream to its default value.
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...
virtual void ResetImpl(DynExp::ModuleDataBase::dispatch_tag< NetworkDataStreamInstrumentData >)
DynExp::LinkedObjectWrapperContainer< DynExpInstr::DataStreamInstrument > DataStreamInstrument
void ResetImpl(DynExp::ModuleDataBase::dispatch_tag< gRPCModuleData< gRPCServices... >>) override final
NetworkDataStreamInstrumentParams(DynExp::ItemIDType ID, const DynExp::DynExpCore &Core)
DynExp::ParamsBase::Param< DynExp::ObjectLink< DynExpInstr::DataStreamInstrument > > DataStreamInstrument
void ConfigureParamsImpl(DynExp::ParamsBase::dispatch_tag< gRPCModuleParams< gRPCServices... >>) override final
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...
virtual void ConfigureParamsImpl(DynExp::ParamsBase::dispatch_tag< NetworkDataStreamInstrumentParams >)
CallDataClearData(const gRPCModule< gRPCServices... > *const OwningModule) noexcept
gRPCModule< gRPCServices... >::template TypedCallDataBase< CallDataClearData, ThisServiceType, DynExpProto::Common::VoidMessage, DynExpProto::Common::VoidMessage > Base
virtual void ProcessChildImpl(DynExp::ModuleInstance &Instance) override
virtual void ProcessChildImpl(DynExp::ModuleInstance &Instance) override
gRPCModule< gRPCServices... >::template TypedCallDataBase< CallDataGetStreamInfo, ThisServiceType, DynExpProto::Common::VoidMessage, DynExpProto::NetworkDataStreamInstrument::StreamInfoMessage > Base
CallDataGetStreamInfo(const gRPCModule< gRPCServices... > *const OwningModule) noexcept
CallDataGetStreamSize(const gRPCModule< gRPCServices... > *const OwningModule) noexcept
gRPCModule< gRPCServices... >::template TypedCallDataBase< CallDataGetStreamSize, ThisServiceType, DynExpProto::Common::VoidMessage, DynExpProto::NetworkDataStreamInstrument::StreamSizeMessage > Base
virtual void ProcessChildImpl(DynExp::ModuleInstance &Instance) override
virtual void ProcessChildImpl(DynExp::ModuleInstance &Instance) override
CallDataHasFinished(const gRPCModule< gRPCServices... > *const OwningModule) noexcept
gRPCModule< gRPCServices... >::template TypedCallDataBase< CallDataHasFinished, ThisServiceType, DynExpProto::Common::VoidMessage, DynExpProto::Common::OptionalBoolMessage > Base
virtual void ProcessChildImpl(DynExp::ModuleInstance &Instance) override
CallDataIsRunning(const gRPCModule< gRPCServices... > *const OwningModule) noexcept
gRPCModule< gRPCServices... >::template TypedCallDataBase< CallDataIsRunning, ThisServiceType, DynExpProto::Common::VoidMessage, DynExpProto::Common::OptionalBoolMessage > Base
gRPCModule< gRPCServices... >::template TypedCallDataBase< CallDataRead, ThisServiceType, DynExpProto::NetworkDataStreamInstrument::ReadMessage, DynExpProto::NetworkDataStreamInstrument::ReadResultMessage > Base
CallDataRead(const gRPCModule< gRPCServices... > *const OwningModule) noexcept
virtual void ProcessChildImpl(DynExp::ModuleInstance &Instance) override
virtual void ProcessChildImpl(DynExp::ModuleInstance &Instance) override
CallDataResetStreamSize(const gRPCModule< gRPCServices... > *const OwningModule) noexcept
gRPCModule< gRPCServices... >::template TypedCallDataBase< CallDataResetStreamSize, ThisServiceType, DynExpProto::Common::VoidMessage, DynExpProto::NetworkDataStreamInstrument::StreamSizeMessage > Base
CallDataRestart(const gRPCModule< gRPCServices... > *const OwningModule) noexcept
virtual void ProcessChildImpl(DynExp::ModuleInstance &Instance) override
gRPCModule< gRPCServices... >::template TypedCallDataBase< CallDataRestart, ThisServiceType, DynExpProto::Common::VoidMessage, DynExpProto::Common::VoidMessage > Base
virtual void ProcessChildImpl(DynExp::ModuleInstance &Instance) override
gRPCModule< gRPCServices... >::template TypedCallDataBase< CallDataSetStreamSize, ThisServiceType, DynExpProto::NetworkDataStreamInstrument::StreamSizeMessage, DynExpProto::NetworkDataStreamInstrument::StreamSizeMessage > Base
CallDataSetStreamSize(const gRPCModule< gRPCServices... > *const OwningModule) noexcept
CallDataStart(const gRPCModule< gRPCServices... > *const OwningModule) noexcept
gRPCModule< gRPCServices... >::template TypedCallDataBase< CallDataStart, ThisServiceType, DynExpProto::Common::VoidMessage, DynExpProto::Common::VoidMessage > Base
virtual void ProcessChildImpl(DynExp::ModuleInstance &Instance) override
CallDataStop(const gRPCModule< gRPCServices... > *const OwningModule) noexcept
virtual void ProcessChildImpl(DynExp::ModuleInstance &Instance) override
gRPCModule< gRPCServices... >::template TypedCallDataBase< CallDataStop, ThisServiceType, DynExpProto::Common::VoidMessage, DynExpProto::Common::VoidMessage > Base
virtual void ProcessChildImpl(DynExp::ModuleInstance &Instance) override
CallDataWrite(const gRPCModule< gRPCServices... > *const OwningModule) noexcept
gRPCModule< gRPCServices... >::template TypedCallDataBase< CallDataWrite, ThisServiceType, DynExpProto::NetworkDataStreamInstrument::WriteMessage, DynExpProto::NetworkDataStreamInstrument::WriteResultMessage > Base
virtual void OnExitChild(DynExp::ModuleInstance *Instance) const override
Allows derived classes to unlock instruments they are controlling (e.g. with calls to DynExp::Runnabl...
virtual void ValidateInstrType(const DynExpInstr::DataStreamInstrument *Instr) const
void ResetImpl(DynExp::Object::dispatch_tag< gRPCModule< gRPCServices... >>) override final
virtual void ResetImpl(DynExp::Object::dispatch_tag< NetworkDataStreamInstrumentT >)
DynExpProto::NetworkDataStreamInstrument::NetworkDataStreamInstrument ThisServiceType
NetworkDataStreamInstrumentT(const std::thread::id OwnerThreadID, DynExp::ParamsBasePtrType &&Params)
virtual std::string GetName() const override
Returns the name of this Object type.
virtual void OnInitChild(DynExp::ModuleInstance *Instance) const override
Allows derived classes to lock instruments they are controlling (e.g. with calls to DynExp::RunnableI...
virtual void CreateInitialCallDataObjectsImpl(DynExp::Object::dispatch_tag< gRPCModule< gRPCServices... >>, DynExp::ModuleInstance &Instance) const override
virtual void CreateInitialCallDataObjectsImpl(DynExp::Object::dispatch_tag< NetworkDataStreamInstrumentT >, DynExp::ModuleInstance &Instance) const
Configurator class for gRPCModule.
Definition: gRPCModule.h:96
Data class for gRPCModule.
Definition: gRPCModule.h:26
Parameter class for gRPCModule.
Definition: gRPCModule.h:55
Module template for building gRPC servers listening on TCP sockets for network instruments to connect...
Definition: gRPCModule.h:116
DynExp's core class acts as the interface between the user interface and DynExp's internal data like ...
Definition: DynExpCore.h:127
Base class for modules. Modules implement programs on their own (e.g. measurement protocols or server...
Definition: Module.h:392
const std::unique_ptr< ModuleDataType > ModuleData
Module data belonging to this ModuleBase instance.
Definition: Module.h:743
Configurator class for ModuleBase.
Definition: Module.h:374
Data structure to contain data which is synchronized in between different threads....
Definition: Module.h:171
Refer to ParamsBase::dispatch_tag.
Definition: Module.h:189
Defines data for a thread belonging to a ModuleBase instance. Refer to RunnableInstance.
Definition: Module.h:793
const ModuleBase::ModuleDataGetterType ModuleDataGetter
Getter for module's data. Refer to ModuleBase::ModuleDataGetterType.
Definition: Module.h:825
Parameter class for ModuleBase.
Definition: Module.h:337
std::string GetCategoryAndName() const
Builds a string from an Object's category and name to allow the user to identify an Object's type.
Definition: Object.h:2158
const std::thread::id OwnerThreadID
Thread id of the thread which has constructed (and owns) this Object instance.
Definition: Object.h:2302
const ParamsBasePtrType Params
Pointer to the parameter class instance belonging to this Object instance.
Definition: Object.h:2303
auto GetObjectName(const std::chrono::milliseconds Timeout=GetParamsTimeoutDefault) const
Returns the name of this Object instance.
Definition: Object.h:2128
Refer to ParamsBase::dispatch_tag.
Definition: Object.h:2018
const ItemIDType ID
ID of the Object this parameter class instance belongs to.
Definition: Object.h:1779
const auto & GetCore() const noexcept
Returns a reference to DynExp's core.
Definition: Object.h:1677
const DynExpCore & Core
Reference to DynExp's core.
Definition: Object.h:1780
Tag for function dispatching mechanism within this class used when derived classes are not intended t...
Definition: Object.h:349
const Object::ParamsGetterType ParamsGetter
Invoke to obtain the parameters (derived from ParamsBase) of Owner.
Definition: Object.h:3671
void UnlockObject(LinkedObjectWrapperContainer< ObjectT > &ObjectWrapperContainer)
Unlocks an Object instance stored in the LinkedObjectWrapperContainer ObjectWrapperContainer....
Definition: Object.h:3570
void LockObject(const ParamsBase::Param< ObjectLink< ObjectT >> &LinkParam, LinkedObjectWrapperContainer< ObjectT > &ObjectWrapperContainer, std::chrono::milliseconds Timeout=ObjectLinkBase::LockObjectTimeoutDefault)
Locks an Object instance referenced by a parameter LinkParam of type ParamsBase::Param< ObjectLink< O...
Definition: Object.h:3554
std::atomic< bool > Running
Indicates whether the RunnableObject instance is running.
Definition: Object.h:2684
void Log(const std::string &Message, const ErrorType Type=ErrorType::Info, const size_t Line=0, const std::string &Function="", const std::string &File="", const int ErrorCode=0, const std::stacktrace &Trace={}) noexcept
Logs an event from information specified manually.
Definition: Util.cpp:309
Thrown when an attempt was made to convert two incompatible types into each other.
Definition: Exception.h:248
Defines a module template for building gRPC servers for network instruments to connect to.
constexpr DynExpProto::Common::UnitType ToPrototUnitType(DataStreamInstrumentData::UnitType Unit)
DynExp's module namespace contains the implementation of DynExp modules which extend DynExp's core fu...
NetworkDataStreamInstrumentT< DynExpProto::NetworkDataStreamInstrument::NetworkDataStreamInstrument > NetworkDataStreamInstrument
Explicit instantiation of derivable class NetworkDataStreamInstrumentT to create the network data str...
constexpr auto Instrument
std::unique_ptr< ParamsBase > ParamsBasePtrType
Alias for a pointer to the parameter system base class ParamsBase.
Definition: Object.h:1807
size_t ItemIDType
ID type of objects/items managed by DynExp.
EventLogger & EventLog()
This function holds a static EventLogger instance and returns a reference to it. DynExp uses only one...
Definition: Util.cpp:509
Accumulates include statements to provide a precompiled header.