ifw-daq  2.1.0-pre1
IFW Data Acquisition modules
daqContext.cpp
Go to the documentation of this file.
1 /**
2  * @file
3  * @ingroup daq_common_libdaq
4  * @copyright 2022 ESO - European Southern Observatory
5  *
6  * @brief Contains definition of `daq::Context` helpers.
7  */
8 #include <daq/daqContext.hpp>
9 
10 namespace daq {
11 
12 bool operator==(DaqContext const& lhs, DaqContext const& rhs) noexcept {
13  return lhs.id == rhs.id &&
14  lhs.file_id == rhs.file_id &&
15  lhs.await_interval == rhs.await_interval &&
16  lhs.dp_name_prefix == rhs.dp_name_prefix &&
17  lhs.process_name == rhs.process_name &&
18  lhs.keywords == rhs.keywords &&
19  lhs.meta_sources == rhs.meta_sources &&
20  lhs.prim_sources == rhs.prim_sources &&
21  lhs.results == rhs.results;
22 }
23 
24 bool operator==(DaqContext::Source const& lhs, DaqContext::Source const& rhs) noexcept {
25  return lhs.name == rhs.name && lhs.rr_uri == rhs.rr_uri;
26 }
27 
28 void UpdateKeywords(DaqContext& ctx, fits::KeywordVector const& keywords) {
29  if (keywords.empty()) {
30  return;
31  }
32  fits::UpdateKeywords(ctx.keywords, keywords);
33 }
34 
35 void AddDpParts(DaqContext& ctx, std::vector<DpPart> const& parts) {
36  using std::copy;
37  copy(parts.begin(), parts.end(), std::back_inserter(ctx.results));
38 }
39 
40 } // namespace daq
daq
Definition: asyncProcess.cpp:15
daq::DaqContext::results
DpParts results
Results from Data Acquisition (FITS files and keywords).
Definition: daqContext.hpp:106
daq::DaqContext
Structure carrying context needed to start a Data Acquisition and construct a Data Product Specificat...
Definition: daqContext.hpp:48
daq::DaqContext::keywords
std::vector< daq::fits::KeywordVariant > keywords
Keyword list provided by OCM to Data Product.
Definition: daqContext.hpp:91
daqContext.hpp
Contains declaration of daq::Context.
daq::fits::UpdateKeywords
void UpdateKeywords(KeywordVector &to, KeywordVector const &from, ConflictPolicy policy=ConflictPolicy::Replace)
Updates to with keywords from from.
Definition: keyword.cpp:553
daq::fits::KeywordVector
std::vector< KeywordVariant > KeywordVector
Vector of keywords.
Definition: keyword.hpp:414
daq::DaqContext::Source
Definition: daqContext.hpp:49
daq::AddDpParts
void AddDpParts(DaqContext &ctx, std::vector< DpPart > const &parts)
Definition: daqContext.cpp:35
daq::UpdateKeywords
void UpdateKeywords(DaqContext &ctx, fits::KeywordVector const &keywords)
Updates (adds or replaces) primary HDU keywords.
Definition: daqContext.cpp:28
daq::operator==
bool operator==(DaqContext const &lhs, DaqContext const &rhs) noexcept
Definition: daqContext.cpp:12