Developer documentation
Version 3.0.3-105-gd3941f44
config.h
Go to the documentation of this file.
1/* Copyright (c) 2008-2022 the MRtrix3 contributors.
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 *
7 * Covered Software is provided under this License on an "as is"
8 * basis, without warranty of any kind, either expressed, implied, or
9 * statutory, including, without limitation, warranties that the
10 * Covered Software is free of defects, merchantable, fit for a
11 * particular purpose or non-infringing.
12 * See the Mozilla Public License v. 2.0 for more details.
13 *
14 * For more details, see http://www.mrtrix.org/.
15 */
16
17#ifndef __file_config_h__
18#define __file_config_h__
19
20#include <map>
21#include "types.h"
22#include "file/key_value.h"
23
24namespace MR
25{
26 namespace File
27 {
29 public:
30
31 static void init ();
32
33 static void set (const std::string& key, const std::string& value) {
34 config[key] = value;
35 }
36 static std::string get (const std::string& key) {
37 const KeyValues::const_iterator i = config.find (key);
38 return (i != config.end() ? i->second : "");
39 }
40 static std::string get (const std::string& key, const std::string& default_value) {
41 KeyValues::iterator i = config.find (key);
42 return (i != config.end() ? i->second : default_value);
43 }
44
45 static bool get_bool (const std::string& key, bool default_value);
46 static int get_int (const std::string& key, int default_value);
47 static float get_float (const std::string& key, float default_value);
48 static void get_RGB (const std::string& key, float* ret, float default_R, float default_G, float default_B);
49
50 private:
51 static KeyValues config;
52 };
53 }
54}
55
56#endif
57
static void init()
static bool get_bool(const std::string &key, bool default_value)
static std::string get(const std::string &key)
Definition: config.h:36
static std::string get(const std::string &key, const std::string &default_value)
Definition: config.h:40
static void set(const std::string &key, const std::string &value)
Definition: config.h:33
static float get_float(const std::string &key, float default_value)
static void get_RGB(const std::string &key, float *ret, float default_R, float default_G, float default_B)
static int get_int(const std::string &key, int default_value)
VectorType::Scalar value(const VectorType &coefs, typename VectorType::Scalar cos_elevation, typename VectorType::Scalar cos_azimuth, typename VectorType::Scalar sin_azimuth, int lmax)
Definition: SH.h:233
#define NOMEMALIGN
Definition: memory.h:22
Definition: base.h:24
std::map< std::string, std::string > KeyValues
used in various places for storing key-value pairs
Definition: types.h:238