Go to the documentation of this file.
28 #include <SimoxUtility/algorithm/string/string_conversion.h>
49 for (
const auto& [key, dataPtr] : this->
aron->elements)
57 for (
const auto& [key, dataPtr] : m)
67 for (
const auto& [key, nav] : childrenNavigators)
92 return *
this == *other;
105 this->childrenNavigators = other.childrenNavigators;
117 ret->addElement(key, val->cloneAsVariant());
121 ret->addElement(key,
nullptr);
135 return std::make_shared<Dict>(
aron);
141 return navigator ? navigator->toAronDictDTO() :
nullptr;
151 std::vector<std::string>
154 std::vector<std::string>
ret;
155 for (
const auto& [key, _] : childrenNavigators)
177 "The key '" + key +
"' already exists in a aron dict.");
191 "The key '" + key +
"' already exists in a aron dict.");
229 return childrenNavigators.count(key) > 0;
235 auto it = childrenNavigators.find(key);
236 if (it == childrenNavigators.end())
240 "Could not find key '" + key +
241 "'. But I found the following keys: [" +
242 simox::alg::join(this->
getAllKeys(),
", ") +
"]",
248 std::map<std::string, VariantPtr>
251 return childrenNavigators;
261 const auto& p =
data->getPath();
262 if (not p.hasDirectPrefix(this->getPath()))
265 <<
"An element added to a dict does not have a correct path set. This "
266 "may cause errors. Please use setElemetCopy() instead.";
270 this->childrenNavigators[key] =
data;
273 this->
aron->elements[key] =
data->toAronDTO();
277 this->
aron->elements[key] =
nullptr;
290 copy =
data->cloneAsVariant(newPath);
298 childrenNavigators.erase(key);
299 aron->elements.erase(key);
305 childrenNavigators.clear();
306 aron->elements.clear();
325 return "armarx::aron::data::Dict";
353 for (
const auto& [key, childTypeNav] : objectTypeNav->getMemberTypes())
368 if (not childNav->fullfillsType(childTypeNav))
391 for (
const auto& [key, childNav] : childrenNavigators)
394 auto childTypeNav = dictTypeNav->getAcceptedType();
404 if (!childNav->fullfillsType(childTypeNav))
416 std::vector<VariantPtr>
419 std::vector<VariantPtr>
ret(childrenNavigators.size());
420 for (
const auto& [key, nav] : childrenNavigators)
430 return childrenNavigators.size();
440 __PRETTY_FUNCTION__,
"Could not navigate without a valid path",
path);
447 __PRETTY_FUNCTION__,
"Could not find an element of a path.", el,
path);
452 return childrenNavigators.at(el);
457 if (!childrenNavigators.at(el))
461 "Could not navigate into a NULL member. Seems like the "
462 "member is optional and not set.",
465 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