9 : collection(strutil::trim_copy(collection))
13 throw std::runtime_error(
"Collection: string '" +
collection +
"' must start with '[' and must end with ']'");
17 if ( list.empty() )
return;
19 auto elements = strutil::split( list,
"," );
20 for (
auto& element : elements ) {
21 strutil::trim(element);
22 if ( strutil::starts_with(element,
"\"") && strutil::ends_with(element,
"\"") ) {
23assert(!
"Should not be reached");
33 values.push_back( std::nullopt );
41 throw std::runtime_error(
"Collection: illegal value '" + element +
"' in '" +
collection +
"'");
53 return registeredCollections[i];
57 std::lock_guard<std::mutex> lock(registryMutex);
59 auto it = index.find(collection);
60 if ( it == index.end() ) {
62 registeredCollections.emplace_back(collection);
63 index[collection] = index.size();
64 return registeredCollections.size()-1;
70 registeredCollections.clear();
CollectionRegistry collectionRegistry
const std::string Undefined
number to_number(const std::string &valueString, const ValueType &type)
Converts a string to a number.
double stod(const std::string &str)
Utility class for representing collections by numeric values.
CollectionRegistry()
Constructor adds empty collection at index 0.
const Collection & operator[](size_t i) const
Operator providing access to a registered collections by index.
size_t operator()(const std::string &collection)
Operator to register a collection by its string representation and return its index.
Collection(const std::string &collection)