helics  2.8.1
helicsCLI11JsonConfig.hpp
1 /*
2 Copyright (c) 2017-2021,
3 Battelle Memorial Institute; Lawrence Livermore National Security, LLC; Alliance for Sustainable
4 Energy, LLC. See the top-level NOTICE for additional details. All rights reserved.
5 SPDX-License-Identifier: BSD-3-Clause
6 */
7 
8 #pragma once
9 
10 #include "helicsCLI11.hpp"
11 
12 #include "json/forwards.h"
13 #include <string>
14 #include <utility>
15 #include <vector>
16 
17 namespace helics {
19 class HelicsConfigJSON: public CLI::ConfigBase {
20  public:
21  std::vector<CLI::ConfigItem> from_config(std::istream& input) const override final;
22 
24  void skipJson(bool skj = true) { skip_json_ = skj; }
26  void fallbackToDefault(bool ftd = true) { fallback_to_default_ = ftd; }
27 
28  private:
29  bool skip_json_{false};
30  bool fallback_to_default_{false};
32  std::vector<CLI::ConfigItem>
33  fromConfigInternal(Json::Value j,
34  const std::string& name = {},
35  const std::vector<std::string>& prefix = {}) const;
36 };
38 HelicsConfigJSON* addJsonConfig(CLI::App* app);
39 
40 } // namespace helics
helics::HelicsConfigJSON::skipJson
void skipJson(bool skj=true)
skip checking the JSON and go directory to the TOML processing
Definition: helicsCLI11JsonConfig.hpp:24
helics
the main namespace for the helics co-simulation library User functions will be in the helics namespac...
Definition: AsyncFedCallInfo.hpp:14
helics::HelicsConfigJSON
Define a JSON parser for the config files for CLI11.
Definition: helicsCLI11JsonConfig.hpp:19
helics::HelicsConfigJSON::fallbackToDefault
void fallbackToDefault(bool ftd=true)
if the specified section isn't available use the root section
Definition: helicsCLI11JsonConfig.hpp:26
helics::addJsonConfig
HelicsConfigJSON * addJsonConfig(CLI::App *app)
Add the HELICS JSON configuration processor to the app.
Definition: helicsCLI11JsonConfig.cpp:96