Project
Loading...
Searching...
No Matches
ConfigParamStore.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
14#include "PropertyTreeHelpers.h"
15#include <boost/property_tree/ptree.hpp>
16
17namespace o2::framework
18{
19
20ConfigParamStore::ConfigParamStore(std::vector<ConfigParamSpec> const& specs,
21 std::vector<std::unique_ptr<ParamRetriever>> retrievers)
22 : mSpecs(specs),
23 mRetrievers{std::move(retrievers)},
24 mStore{new boost::property_tree::ptree{}},
25 mProvenance{new boost::property_tree::ptree{}},
26 mNextStore{new boost::property_tree::ptree{}},
27 mNextProvenance{new boost::property_tree::ptree{}}
28{
29}
30
34{
35 mNextStore->clear();
36 mNextProvenance->clear();
37 // By default we populate with code.
38 PropertyTreeHelpers::populateDefaults(mSpecs, *mNextStore, *mNextProvenance);
39 for (auto& retriever : mRetrievers) {
40 retriever->update(mSpecs, *mNextStore, *mNextProvenance);
41 }
42}
43
44void ConfigParamStore::load(std::vector<ConfigParamSpec>& specs)
45{
46 mNextStore->clear();
47 mNextProvenance->clear();
48 // By default we populate with code.
49 PropertyTreeHelpers::populateDefaults(specs, *mNextStore, *mNextProvenance);
50 for (auto& retriever : mRetrievers) {
51 retriever->update(specs, *mStore, *mProvenance);
52 }
53}
54
57{
58 mStore->swap(*mNextStore);
59 mProvenance->swap(*mNextProvenance);
60}
61
62std::string ConfigParamStore::provenance(const char* key) const
63{
64 return mProvenance->get<std::string>(key);
65}
66} // namespace o2::framework
StringRef key
void load(std::vector< ConfigParamSpec > &specs)
std::vector< ConfigParamSpec > const & specs() const
Get the specs.
void activate()
Activate the next store.
std::string provenance(const char *) const
ConfigParamStore(std::vector< ConfigParamSpec > const &specs, std::vector< std::unique_ptr< ParamRetriever > > retrievers)
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
Defining DataPointCompositeObject explicitly as copiable.
static void populateDefaults(std::vector< ConfigParamSpec > const &schema, boost::property_tree::ptree &tree, boost::property_tree::ptree &provenance)