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