LandscapeDNDC 1.37.0
Loading...
Searching...
No Matches
mbe_setup.h
1/*
2 * SPDX-FileCopyrightText: Karlsruhe Institute of Technology (KIT)
3 * SPDX-License-Identifier: LicenseRef-LandscapeDNDC
4 * This file is part of LandscapeDNDC. See LICENSE.
5 */
14
15#ifndef LDNDC_MOBILE_SETUP_H_
16#define LDNDC_MOBILE_SETUP_H_
17
18#include "ld_legacy.h"
19
20#include <map>
21#include <vector>
22#include <string/cbm_string.h>
23
24#define registered_key_prefix "registered.option."
25
26namespace ldndc {
27
28struct CBM_API mobile_module_options_t
29{
30 typedef std::string key_type;
31 typedef cbm::string_t value_type;
32 typedef std::map< key_type, value_type > mobile_module_options_container_t;
33 typedef mobile_module_options_container_t::const_iterator const_iterator;
34
35 void clear() { this->options.clear(); }
36 bool exists( key_type const & /*key*/) const;
37
38 value_type const * get( key_type const & /*key*/) const;
39 template < typename _VALUE_TYPE >
40 _VALUE_TYPE get( key_type const & _key, _VALUE_TYPE const & _default)
41 const
42 {
43 value_type const * option_value = this->get( _key);
44 if ( !option_value)
45 { return _default; }
46 return option_value->as< _VALUE_TYPE >();
47 }
48
49 lerr_t insert( key_type const & /*key*/, value_type const & /*value*/);
50 lerr_t merge( mobile_module_options_t const *);
51
52 cbm::string_t to_string() const;
53
54 const_iterator begin() const
55 { return this->options.begin(); }
56 const_iterator end() const
57 { return this->options.end(); }
58
59 private:
60 mobile_module_options_container_t options;
61};
62
63/*
64 * Structure representing module information from
65 * MoBiLE's setup module list block
66 */
67struct CBM_API mobile_module_info_t
68{
69 /* unique module name */
70 cbm::string_t id;
71 /* module time mode */
72 timemode_e timemode;
73 /* (arbitrary) module options */
74 mobile_module_options_t options;
75};
76
77
78/*
79 *
80 * Structure manages module list information
81 */
82class CBM_API mobile_modules_info_t
83{
84 public:
85 mobile_modules_info_t();
86 ~mobile_modules_info_t();
87
88 size_t number_of_modules() const;
89
90 mobile_module_info_t const *
91 get_mobile_module_info_by_id( char const * /*module ID*/) const;
92 mobile_module_info_t const *
93 get_mobile_module_info_by_slot( size_t /*index*/) const;
94 /* return index */
95 int add_module_setup( mobile_module_info_t const &);
96
97 bool have_module( char const * /*module ID*/) const;
98
99 private:
100 /* information of all listed modules */
101 std::vector< mobile_module_info_t > m_moduleinfos;
102};
103
104} /* namespace ldndc */
105
106#endif /* !LDNDC_MOBILE_SETUP_H_ */
107
Spatially explicit groundwater model.
Definition airchemistryput.h:21