Go to the documentation of this file.
28 #include <SimoxUtility/algorithm/string/string_conversion.h>
50 for (
const auto& [key, dataPtr] : this->
aron->elements)
58 for (
const auto& [key, dataPtr] : m)
68 for (
const auto& [key, nav] : childrenNavigators)
93 return *
this == *other;
106 this->childrenNavigators = other.childrenNavigators;
118 ret->addElement(key, val->cloneAsVariant());
122 ret->addElement(key,
nullptr);
136 return std::make_shared<Dict>(
aron);
142 return navigator ? navigator->toAronDictDTO() :
nullptr;
152 std::vector<std::string>
155 std::vector<std::string>
ret;
156 for (
const auto& [key, _] : childrenNavigators)
178 "The key '" + key +
"' already exists in a aron dict.");
192 "The key '" + key +
"' already exists in a aron dict.");
230 return childrenNavigators.count(key) > 0;
236 auto it = childrenNavigators.find(key);
237 if (it == childrenNavigators.end())
241 "Could not find key '" + key +
242 "'. But I found the following keys: [" +
243 simox::alg::join(this->
getAllKeys(),
", ") +
"]",
249 std::map<std::string, VariantPtr>
252 return childrenNavigators;
262 const auto& p =
data->getPath();
263 if (not p.hasDirectPrefix(this->getPath()))
266 <<
"An element added to a dict does not have a correct path set. This "
267 "may cause errors. Please use setElemetCopy() instead.";
271 this->childrenNavigators[key] =
data;
274 this->
aron->elements[key] =
data->toAronDTO();
278 this->
aron->elements[key] =
nullptr;
291 copy =
data->cloneAsVariant(newPath);
299 childrenNavigators.erase(key);
300 aron->elements.erase(key);
306 childrenNavigators.clear();
307 aron->elements.clear();
326 return "armarx::aron::data::Dict";
354 for (
const auto& [key, childTypeNav] : objectTypeNav->getMemberTypes())
369 if (not childNav->fullfillsType(childTypeNav))
392 for (
const auto& [key, childNav] : childrenNavigators)
395 auto childTypeNav = dictTypeNav->getAcceptedType();
405 if (!childNav->fullfillsType(childTypeNav))
417 std::vector<VariantPtr>
420 std::vector<VariantPtr>
ret(childrenNavigators.size());
421 for (
const auto& [key, nav] : childrenNavigators)
431 return childrenNavigators.size();
441 __PRETTY_FUNCTION__,
"Could not navigate without a valid path",
path);
448 __PRETTY_FUNCTION__,
"Could not find an element of a path.", el,
path);
453 return childrenNavigators.at(el);
458 if (!childrenNavigators.at(el))
462 "Could not navigate into a NULL member. Seems like the "
463 "member is optional and not set.",
466 return childrenNavigators.at(el)->navigateAbsolute(next);
Path withElement(const std::string &, bool escape=false) const
type::VariantPtr recalculateType() const override
recalculate the type of a data variant. Please not tha the mapping ist NOT bijective,...
std::string getFirstElement() const
A base class for aron exceptions.
std::shared_ptr< Variant > VariantPtr
ReaderT::InputType T & ret
void removeElement(const std::string &key)
static VariantPtr FromAronDTO(const data::dto::GenericDataPtr &, const Path &=Path())
create a variant from a dto object
void addElementCopy(const std::string &key, const VariantPtr &=nullptr)
Path getPath() const
get the path
VariantPtr getElement(const std::string &) const
Dict & operator=(const Dict &)
The NotImplementedYetException class.
virtual PointerType clone() const
void mergeAndReplace(const DictPtr &d)
static PointerType FromAronDictDTO(const data::dto::DictPtr &aron)
std::vector< std::string > getAllKeys() const
VariantPtr navigateAbsolute(const Path &path) const override
naviate absolute
std::shared_ptr< Variant > VariantPtr
bool operator==(const Dict &) const override
SpamFilterDataPtr deactivateSpam(SpamFilterDataPtr const &spamFilter, float deactivationDurationSec, const std::string &identifier, bool deactivate)
The ValueNotValidException class.
bool fullfillsType(const type::VariantPtr &) const override
checks, if the current data variant fullfills the given type
void addElement(const std::string &key, const VariantPtr &=nullptr)
Use of this software is granted under one of the following two to be chosen freely by the user Boost Software License Version Marcin Kalicinski Permission is hereby free of to any person or organization obtaining a copy of the software and accompanying documentation covered by this and transmit the and to prepare derivative works of the and to permit third parties to whom the Software is furnished to do all subject to the including the above license this restriction and the following must be included in all copies of the in whole or in and all derivative works of the unless such copies or derivative works are solely in the form of machine executable object code generated by a source language processor THE SOFTWARE IS PROVIDED AS WITHOUT WARRANTY OF ANY EXPRESS OR INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF FITNESS FOR A PARTICULAR TITLE AND NON INFRINGEMENT IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER WHETHER IN TORT OR ARISING OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE The MIT Marcin Kalicinski Permission is hereby free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to copy
bool hasElement(const std::string &) const
Dict(const Path &path=Path())
static data::dto::DictPtr ToAronDictDTO(const PointerType &navigator)
const std::string & to_string(const std::string &s)
VariantPtr at(const std::string &) const
A convenience header to include all aron files (full include, not forward declared)
std::shared_ptr< Dict > DictPtr
VariantPtr operator[](const std::string &) const
double v(double t, double v0, double a0, double j)
std::map< std::string, VariantPtr > getElements() const
Path withDetachedFirstElement() const
static std::shared_ptr< Object > DynamicCastAndCheck(const VariantPtr &n)
void mergeAndReplaceCopy(const DictPtr &d)
void setElementCopy(const std::string &, const VariantPtr &=nullptr)
std::vector< VariantPtr > getChildren() const override
get the children of a data variant
size_t childrenSize() const override
get the children size of a data variant
std::string getAllKeysAsString() const
std::string getFullName() const override
get the full str representation of this variant
std::string getShortName() const override
get a short str representation of this variant
double s(double t, double s0, double v0, double a0, double j)
AronDataType::PointerType aron
void setElement(const std::string &, const VariantPtr &=nullptr)
data::dto::DictPtr toAronDictDTO() const