ifw-daq
2.1.0-pre1
IFW Data Acquisition modules
|
Go to the documentation of this file.
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;
213 #endif // #ifndef OCF_DAQ_SOURCE_HPP_
PrimSource(PrimSource const &)=default
State
Observable states of the data acquisition process.
friend std::ostream & operator<<(std::ostream &os, Source< T > const &s)
PrimSource(PrimSource &&)=default
PrimSource(std::string name, std::shared_ptr< RrClient > client)
PrimSource & operator=(PrimSource &)=default
DaqSources(std::vector< PrimSource > prim_sources, std::vector< MetaSource > meta_sources)
Simple class that holds the source and associated state.
bool GetErrorFlag() const
std::vector< MetaSource > const & GetMetadataSources() const noexcept
friend std::ostream & operator<<(std::ostream &os, PrimSource const &s)
Config class header file.
std::string const & GetName() const
recif::RecCmdsAsync RrClient
Data acquisition sources.
std::vector< PrimSource > & GetPrimarySources() noexcept
Declares daq::State and related functions.
StateSignal m_state_signal
void SetState(State state, std::optional< bool > error_flag={})
std::vector< PrimSource > const & GetPrimarySources() const noexcept
boost::signals2::signal< void(State, bool)> StateSignal
boost::signals2::connection ConnectStateListener(Subscriber subscriber)
Connect subscriber that is invoked on state changes.
PrimSource & operator=(PrimSource &&)=default
T const & GetSource() const
Keeps relevant state to be able to communicate with a primary data source.
std::variant< PrimSource, MetaSource > SourceVariant
std::vector< MetaSource > & GetMetadataSources() noexcept