20 #include <boost/algorithm/string.hpp> 28 template <
class KeyType>
30 checkKeyExists(
const boost::shared_ptr<MetainfoMapImpl>& mapImpl, KeyType&& key) {
31 auto it = mapImpl->find(key);
32 if(it == mapImpl->end())
33 internal::throwSerializationException(
"Error: requested key %s is not in set", key);
45 *mapImpl_ = *other.mapImpl_;
54 if(!mapImpl_->insert(key, value))
55 internal::throwSerializationException(
"Error: metainfo with key = %s exists already", key);
59 if(!mapImpl_->insert(key, value))
60 internal::throwSerializationException(
"Error: metainfo with key = %s exists already", key);
64 if(!mapImpl_->insert(key, value))
65 internal::throwSerializationException(
"Error: metainfo with key = %s exists already", key);
69 if(!mapImpl_->insert(key, value))
70 internal::throwSerializationException(
"Error: metainfo with key = %s exists already", key);
74 if(!mapImpl_->insert(key, value))
75 internal::throwSerializationException(
"Error: metainfo with key = %s exists already", key);
79 return internal::checkKeyExists(mapImpl_, key)->second.any();
84 return value.
as<
bool>();
90 return value.
as<
int>();
92 internal::throwSerializationException(
"Error: %s", e.what());
99 return value.
as<
float>();
104 return value.
as<
double>();
109 return value.
as<std::string>();
113 std::ostringstream ss;
115 for(
auto it = mapImpl_->begin(), end = mapImpl_->end(); it != end; ++it)
116 if(!boost::algorithm::starts_with(it->first,
"__"))
117 ss << it->first <<
"=" << it->second.toString() <<
" ";
124 for(
auto it = mapImpl_->begin(), end = mapImpl_->end(); it != end; ++it)
125 if(!boost::algorithm::starts_with(it->first,
"__"))
131 return (*mapImpl_ == *other.mapImpl_);
135 mapImpl_ = metaInfoMap;
139 std::vector<std::string> keyStr;
140 for(
auto it = mapImpl_->begin(), end = mapImpl_->end(); it != end; ++it)
141 keyStr.push_back(it->first);
Namespace of the STELLA frontend.
Namespace of the serialbox library.
#define serialbox_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Exception class which stores a human-readable error description.