8 #ifndef OCF_DAQ_SOURCE_HPP_
9 #define OCF_DAQ_SOURCE_HPP_
15 #include <Metadaqif.hpp>
17 #include <boost/signals2/signal.hpp>
36 <<
", error_flag=" << (s.
GetErrorFlag() ?
"true" :
"false");
46 template <
class Subscriber>
103 PrimSource(std::string name, std::shared_ptr<RrClient> client)
104 : m_name(std::move(name)), m_rr_client(std::move(client)) {
105 if (m_name.empty()) {
106 throw std::invalid_argument(
"'name' is invalid");
109 throw std::invalid_argument(
"'client' is invalid");
126 os <<
"PrimSource: " << s.m_name;
132 std::shared_ptr<RrClient> m_rr_client;
147 MetaSource(std::string name, std::shared_ptr<RrClient> client)
148 : m_name(std::move(name)), m_rr_client(std::move(client)) {
149 if (m_name.empty()) {
150 throw std::invalid_argument(
"'name' is invalid");
153 throw std::invalid_argument(
"'client' is invalid");
170 os <<
"MetaSource: " << s.m_name;
176 std::shared_ptr<RrClient> m_rr_client;
187 explicit DaqSources(std::vector<PrimSource> prim_sources, std::vector<MetaSource> meta_sources)
188 : m_prim_sources(std::move(prim_sources)), m_meta_sources(std::move(meta_sources)) {
191 return m_prim_sources;
195 return m_prim_sources;
199 return m_meta_sources;
203 return m_meta_sources;
207 std::vector<PrimSource> m_prim_sources;
208 std::vector<MetaSource> m_meta_sources;
Data acquisition sources.
std::vector< PrimSource > & GetPrimarySources() noexcept
std::vector< MetaSource > const & GetMetadataSources() const noexcept
std::vector< MetaSource > & GetMetadataSources() noexcept
std::vector< PrimSource > const & GetPrimarySources() const noexcept
DaqSources(std::vector< PrimSource > prim_sources, std::vector< MetaSource > meta_sources)
Keeps relevant state to be able to communicate with a primary data source.
friend std::ostream & operator<<(std::ostream &os, PrimSource const &s)
std::string const & GetName() const
PrimSource & operator=(PrimSource &)=default
PrimSource(PrimSource &&)=default
PrimSource & operator=(PrimSource &&)=default
recif::RecCmdsAsync RrClient
PrimSource(std::string name, std::shared_ptr< RrClient > client)
PrimSource(PrimSource const &)=default
Declares daq::State and related functions.
std::variant< PrimSource, MetaSource > SourceVariant
State
Observable states of the data acquisition process.
@ NotStarted
Initial state of data acquisition.
Config class header file.
Simple class that holds the source and associated state.
boost::signals2::connection ConnectStateListener(Subscriber subscriber)
Connect subscriber that is invoked on state changes.
friend std::ostream & operator<<(std::ostream &os, Source< T > const &s)
boost::signals2::signal< void(State, bool)> StateSignal
T const & GetSource() const
bool GetErrorFlag() const
StateSignal m_state_signal
void SetState(State state, std::optional< bool > error_flag={})