ifw-daq  3.0.0-pre2
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  lhs.specification == rhs.specification;
23 }
24 
25 bool operator==(DaqContext::Source const& lhs, DaqContext::Source const& rhs) noexcept {
26  return lhs.name == rhs.name && lhs.rr_uri == rhs.rr_uri;
27 }
28 
29 void UpdateKeywords(DaqContext& ctx, fits::KeywordVector const& keywords) {
30  if (keywords.empty()) {
31  return;
32  }
33  fits::UpdateKeywords(ctx.keywords, keywords);
34 }
35 
36 void AddDpParts(DaqContext& ctx, std::vector<DpPart> const& parts) {
37  using std::copy;
38  copy(parts.begin(), parts.end(), std::back_inserter(ctx.results));
39 }
40 
41 } // namespace daq
Contains declaration of daq::Context.
std::vector< KeywordVariant > KeywordVector
Vector of keywords.
Definition: keyword.hpp:414
void UpdateKeywords(KeywordVector &to, KeywordVector const &from, ConflictPolicy policy=ConflictPolicy::Replace)
Updates to with keywords from from.
Definition: keyword.cpp:554
void UpdateKeywords(DaqContext &ctx, fits::KeywordVector const &keywords)
Updates (adds or replaces) primary HDU keywords.
Definition: daqContext.cpp:29
void AddDpParts(DaqContext &ctx, std::vector< DpPart > const &parts)
Definition: daqContext.cpp:36
bool operator==(DaqContext const &lhs, DaqContext const &rhs) noexcept
Definition: daqContext.cpp:12
Structure carrying context needed to start a Data Acquisition and construct a Data Product Specificat...
Definition: daqContext.hpp:44
DpParts results
Results from Data Acquisition (FITS files and keywords).
Definition: daqContext.hpp:102
std::vector< daq::fits::KeywordVariant > keywords
Keyword list provided by OCM to Data Product.
Definition: daqContext.hpp:87