|
ifw-daq
1.0.0
IFW Data Acquisition modules
|
Go to the documentation of this file.
8 #ifndef OCM_DAQ_MANAGER_HPP_
9 #define OCM_DAQ_MANAGER_HPP_
12 #include <string_view>
15 #include <boost/thread/future.hpp>
16 #include <log4cplus/logger.h>
50 template <
class Observer>
52 return m_signal.connect(std::move(o));
128 virtual void AddDaq(std::shared_ptr<DaqController>
daq) = 0;
180 std::chrono::milliseconds timeout) = 0;
221 bool HaveDaq(std::string_view
id)
const noexcept
override;
225 void AddDaq(std::shared_ptr<DaqController>
daq)
override;
227 boost::future<State>
StartDaqAsync(std::string_view
id)
override;
233 boost::future<Result<Status>>
244 Daq(std::string id_arg,
245 std::shared_ptr<DaqController> controller_arg,
246 boost::signals2::connection connection_arg) noexcept;
249 std::shared_ptr<DaqController> controller;
251 boost::signals2::connection connection;
257 using Func = std::function<bool()>;
258 OpAbortFunc(Func&& f);
259 OpAbortFunc(OpAbortFunc&&) =
default;
260 OpAbortFunc& operator=(OpAbortFunc&&) =
default;
262 uint64_t GetId()
const noexcept;
263 bool Abort() noexcept;
265 static uint64_t NextId();
267 std::function<bool()> m_func;
269 void RemoveAbortFunc(uint64_t
id) noexcept;
270 DaqController const* FindDaq(std::string_view
id)
const noexcept;
273 DaqController const& FindDaqOrThrow(std::string_view
id)
const;
275 std::shared_ptr<bool> m_alive_token;
277 std::string m_instrument_id;
280 std::vector<Daq> m_daq_controllers;
282 std::vector<OpAbortFunc> m_abort_funcs;
283 log4cplus::Logger m_logger;
287 #endif // #ifndef OCM_DAQ_MANAGER_HPP_
boost::signals2::signal< void(ObservableStatus const &)> SignalType
State
Observable states of the data acquisition process.
virtual void UpdateKeywords(std::string_view id, fits::KeywordVector const &keywords)=0
Update FITS keywords for DaqController identified by id.
virtual std::vector< std::shared_ptr< DaqController const > > GetDaqControllers()=0
boost::future< Status > AbortDaqAsync(std::string_view id, ErrorPolicy policy) override
Abort DaqController identified by id.
void Signal(ObservableStatus const &status)
Adapts boost::asio::io_context into a compatible boost::thread Executor type.
std::string MakeDaqId() const override
Creates a new unique identifier based on the instrumend id and current time.
boost::signals2::signal< void(ObservableStatus const &)> Signal
Stores data acquisition status and allows subscription to status changes.
boost::signals2::connection ConnectObserver(Observer o)
boost::future< Result< Status > > AwaitDaqStateAsync(std::string_view id, State, std::chrono::milliseconds timeout) override
Await DAQ state.
ManagerImpl(rad::IoExecutor &executor, std::string instrument_id)
virtual std::string MakeDaqId() const =0
Creates a new unique identifier based on the instrumend id and current time.
virtual boost::future< Result< Status > > AwaitDaqStateAsync(std::string_view id, State state, std::chrono::milliseconds timeout)=0
Await DAQ state.
Config class header file.
boost::future< Status > StopDaqAsync(std::string_view id, ErrorPolicy policy) override
Stop DaqController identified by id.
StatusSignal & GetStatusSignal() override
boost::future< State > StartDaqAsync(std::string_view id) override
Start DaqController identified by id.
Contains declaration for Status and ObservableStatus.
virtual bool HaveDaq(std::string_view id) const DAQ_NOEXCEPT=0
Query existing data acquisition by id.
void AddDaq(std::shared_ptr< DaqController > daq) override
Add data acquisition.
virtual boost::future< State > StartDaqAsync(std::string_view id)=0
Start DaqController identified by id.
virtual boost::future< Status > AbortDaqAsync(std::string_view id, ErrorPolicy policy)=0
Abort DaqController identified by id.
Non observable status object that keeps stores status of data acquisition.
std::vector< KeywordVariant > KeywordVector
Vector of keywords.
virtual void AddDaq(std::shared_ptr< DaqController > daq)=0
Add data acquisition.
virtual StatusSignal & GetStatusSignal()=0
Manager owns DaqController and FitsController (active data acquisitions) instances and multiplexes re...
std::vector< std::shared_ptr< DaqController const > > GetDaqControllers() override
Declares daq::State and related functions.
Status GetStatus(std::string_view id) const override
Get status.
ErrorPolicy
Error policy supported by certain operations.
void UpdateKeywords(std::string_view id, fits::KeywordVector const &keywords) override
Update FITS keywords for DaqController identified by id.
Controls the execution of single data acquisition that ultimately result in a set of FITS keywords an...
std::string MakeDaqIdCandidate(char const *instrument_id, unsigned jitter=0)
Creates a DAQ id candidate that may or may not be unique.
Declaration of utilities.
virtual Status GetStatus(std::string_view id) const =0
Get status.
bool HaveDaq(std::string_view id) const noexcept override
Query existing data acquisition by id.
virtual boost::future< Status > StopDaqAsync(std::string_view id, ErrorPolicy policy)=0
Stop DaqController identified by id.
Contains error related declarations for DAQ.