14 #ifndef _DATAT_BITS_INCLUDE_TAG
15 #error Must only be included from sag_connectivity_cpp.hpp, use that instead
32 : map(map), keysAlreadyAccessed(), displayName(displayName)
34 if (displayName.empty())
36 throw std::runtime_error(
"displayName cannot be empty");
48 keysAlreadyAccessed(
std::move(other.keysAlreadyAccessed)),
49 displayName(
std::move(other.displayName))
81 std::vector<std::string> remaining;
82 for (
auto it = map.
begin(); it != map.
end(); ++it)
84 if (keysAlreadyAccessed.
find(it->first) == keysAlreadyAccessed.
end())
86 remaining.push_back(stringifyKey(it->first));
89 if (remaining.empty())
return;
92 for (
auto it = remaining.begin(); it != remaining.end(); ++it)
94 ss <<
"'" << *it <<
"'" <<
" ";
96 throw std::runtime_error(
"Found unexpected items in the map '" + displayName +
"': " + ss.str());
110 const is_not_convertable_t<T> &
get(
const data_t& key)
112 return com::softwareag::connectivity::get<T>(doGet(key));
128 const is_convertable_t<T>
get(
const data_t& key)
130 return com::softwareag::connectivity::convert_to<T>(doGet(key));
141 const T
get(
const data_t& key,
const T defaultValue)
147 catch (
const std::exception &)
162 return MapExtractor(get<map_t>(key), displayName +
"." + stringifyKey(key));
164 catch (
const std::exception &)
168 return MapExtractor(emptyMap, displayName +
"." + stringifyKey(key));
179 std::string ret = get<const char*>(key);
182 throw std::runtime_error(
"The string value associated with key '" + stringifyKey(key) +
"' in " + displayName +
" is empty");
194 }
catch (
const std::exception &) {
204 return get<const char*>(key);
214 }
catch (
const std::exception &) {
227 auto it = map.
find(key);
230 throw std::runtime_error(
"Key '" + stringifyKey(key) +
"' not found in " + displayName);
234 throw std::runtime_error(
"Key '" + stringifyKey(key) +
"' has an empty value in " + displayName);
240 std::string stringifyKey(
const data_t& data);
245 map_t keysAlreadyAccessed;
247 const std::string displayName;
249 const map_t emptyMap;
iterator find(const data_t &k)
Searches the map for an item with the given key and returns an iterator to that position in the map...
A map class which implements many of the functions on std::map.
Definition: map_t.hpp:36
iterator end()
Forward iterator end.
Definition: map_t.hpp:274
data_t copy() const
Return a deep copy of this data_t.
iterator begin()
Forward iterator begin.
Definition: map_t.hpp:272
bool empty() const
Returns true if the map is empty (size() == 0)
Definition: map_t.hpp:288
A variant type which can be one of the following:
Definition: data_t.hpp:42
Empty.
Definition: sag_connectivity_c.h:36