-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconceptmapcompetencies.cpp
More file actions
169 lines (152 loc) · 6.03 KB
/
conceptmapcompetencies.cpp
File metadata and controls
169 lines (152 loc) · 6.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#include "conceptmapcompetencies.h"
#include <cassert>
#include <stdexcept>
ribi::cmap::Competencies::Competencies()
: m_map_dutch{}, //Lazy initialization
m_map_english{} //Lazy initialization
{
}
boost::bimap<ribi::cmap::Competency,std::string>
ribi::cmap::CreateMapEnglish() noexcept
{
boost::bimap<Competency,std::string> m;
m.insert(boost::bimap<Competency,std::string>::value_type(
Competency::uninitialized,"uninitialized"));
m.insert(boost::bimap<Competency,std::string>::value_type(
Competency::profession,"profession"));
m.insert(boost::bimap<Competency,std::string>::value_type(
Competency::organisations,"organisations"));
m.insert(boost::bimap<Competency,std::string>::value_type(
Competency::social_surroundings,"social_surroundings"));
m.insert(boost::bimap<Competency,std::string>::value_type(
Competency::target_audience,"target_audience"));
m.insert(boost::bimap<Competency,std::string>::value_type(
Competency::ti_knowledge,"ti_knowledge"));
m.insert(boost::bimap<Competency,std::string>::value_type(
Competency::prof_growth,"prof_growth"));
m.insert(boost::bimap<Competency,std::string>::value_type(
Competency::misc,"misc"));
assert(m.left.size() == static_cast<int>(Competency::n_competencies));
return m;
}
boost::bimap<ribi::cmap::Competency,std::string>
ribi::cmap::CreateMapDutch() noexcept
{
boost::bimap<Competency,std::string> m;
m.insert(boost::bimap<Competency,std::string>::value_type(
Competency::uninitialized,"Ongeinitialiseerd"));
m.insert(boost::bimap<Competency,std::string>::value_type(
Competency::profession,"Kennis van het beroepsdomein"));
m.insert(boost::bimap<Competency,std::string>::value_type(
Competency::organisations,"Kennis van de organisatie"));
m.insert(boost::bimap<Competency,std::string>::value_type(
Competency::social_surroundings,"Kennis van de sociale omgeving"));
m.insert(boost::bimap<Competency,std::string>::value_type(
Competency::target_audience,"Kennis van de doelgroep"));
m.insert(boost::bimap<Competency,std::string>::value_type(
Competency::ti_knowledge,"Technisch instrumentele kennis"));
m.insert(boost::bimap<Competency,std::string>::value_type(
Competency::prof_growth,"Kennis van de eigen persoon"));
m.insert(boost::bimap<Competency,std::string>::value_type(
Competency::misc,"Overige"));
assert(m.left.size() == static_cast<int>(Competency::n_competencies));
return m;
}
boost::bimap<ribi::cmap::Competency,std::string>
ribi::cmap::CreateMapDutchShort() noexcept
{
boost::bimap<Competency,std::string> m;
m.insert(boost::bimap<Competency,std::string>::value_type(
Competency::uninitialized,"??"));
m.insert(boost::bimap<Competency,std::string>::value_type(
Competency::profession,"BD"));
m.insert(boost::bimap<Competency,std::string>::value_type(
Competency::organisations,"OR"));
m.insert(boost::bimap<Competency,std::string>::value_type(
Competency::social_surroundings,"SO"));
m.insert(boost::bimap<Competency,std::string>::value_type(
Competency::target_audience,"DG"));
m.insert(boost::bimap<Competency,std::string>::value_type(
Competency::ti_knowledge,"TI"));
m.insert(boost::bimap<Competency,std::string>::value_type(
Competency::prof_growth,"EP"));
m.insert(boost::bimap<Competency,std::string>::value_type(
Competency::misc,"OV"));
assert(m.left.size() == static_cast<int>(Competency::n_competencies));
return m;
}
std::vector<ribi::cmap::Competency> ribi::cmap::Competencies::GetAllCompetencies() const noexcept
{
const std::vector<Competency> v {
ribi::cmap::Competency::uninitialized,
ribi::cmap::Competency::profession,
ribi::cmap::Competency::organisations,
ribi::cmap::Competency::social_surroundings,
ribi::cmap::Competency::target_audience,
ribi::cmap::Competency::ti_knowledge,
ribi::cmap::Competency::prof_growth,
ribi::cmap::Competency::misc
};
assert(static_cast<int>(v.size()) == static_cast<int>(Competency::n_competencies));
return v;
}
int ribi::cmap::Competencies::ToIndex(const Competency competency) const noexcept
{
return static_cast<int>(competency);
}
std::string ribi::cmap::Competencies::ToStr(const Competency type) const noexcept
{
if (m_map_english.left.empty()) m_map_english = CreateMapEnglish();
assert(!m_map_english.left.empty());
assert(m_map_english.left.count(type) == 1);
const std::string s = m_map_english.left.find(type)->second;
return s;
}
std::string ribi::cmap::Competencies::ToStrDutch(const Competency type) const noexcept
{
if (m_map_dutch.left.empty()) m_map_dutch = CreateMapDutch();
assert(!m_map_dutch.left.empty());
assert(m_map_dutch.left.count(type) == 1);
const std::string s = m_map_dutch.left.find(type)->second;
return s;
}
std::string ribi::cmap::Competencies::ToStrDutchShort(const Competency type) const noexcept
{
if (m_map_dutch_short.left.empty()) m_map_dutch_short = CreateMapDutchShort();
assert(!m_map_dutch_short.left.empty());
assert(m_map_dutch_short.left.count(type) == 1);
const std::string s = m_map_dutch_short.left.find(type)->second;
return s;
}
ribi::cmap::Competency ribi::cmap::Competencies::ToType(const std::string& s) const
{
if (m_map_english.right.empty()) m_map_english = CreateMapEnglish();
assert(!m_map_english.right.empty());
if (m_map_english.right.count(s) == 0)
{
std::stringstream msg;
msg << __func__
<< ": cannot find competency '"
<< s << "' in English dictionary"
;
throw std::logic_error(msg.str());
}
assert(m_map_english.right.count(s) == 1);
return m_map_english.right.find(s)->second;
}
ribi::cmap::Competency ribi::cmap::Competencies::ToTypeFromDutch(const std::string& s) const
{
if (m_map_dutch.right.empty()) m_map_dutch = CreateMapDutch();
assert(!m_map_dutch.right.empty());
if (m_map_dutch.right.count(s) == 0)
{
std::stringstream msg;
msg << __func__
<< ": cannot find competency '"
<< s << "' in Dutch dictionary"
;
throw std::logic_error(msg.str());
}
assert(m_map_dutch.right.count(s) == 1);
return m_map_dutch.right.find(s)->second;
}