Go to the documentation of this file.
27 #include <SimoxUtility/algorithm/get_map_keys_values.h>
28 #include <SimoxUtility/algorithm/string/string_conversion.h>
43 for (
const auto& [key, t] : o.elementTypes)
60 return std::make_shared<Object>(*
aron,
path);
63 type::dto::AronObjectPtr
70 return aron->toAronObjectDTO();
88 this->memberTypes = memberTypes;
89 for (
const auto& [key,
value] : memberTypes)
91 aron->elementTypes[key] =
value->toAronDTO();
98 aron->templates = templates;
104 aron->templateInstantiations = templateInstantiations;
107 std::map<std::string, VariantPtr>
110 std::map<std::string, VariantPtr>
ret = memberTypes;
113 for (
const auto& [key, t] : extends->getMemberTypes())
115 ret.insert({key, t});
121 std::map<std::string, VariantPtr>
130 if (memberTypes.find(
s) == memberTypes.end() and not(extends and extends->hasMemberType(
s)))
135 "Member not set. The list of all members is: " +
139 if (memberTypes.find(
s) == memberTypes.end())
141 return extends->getMemberType(
s);
143 return memberTypes.at(
s);
152 __PRETTY_FUNCTION__,
"Cannot set an element with an empty key.",
getPath());
157 this->
aron->elementTypes[k] =
v->toAronDTO();
166 this->
aron->objectName = n;
173 type::dto::AronObjectPtr ex = p->toAronObjectDTO();
182 return memberTypes.count(k) > 0 or (extends && extends->hasMemberType(k));
195 if (
aron->templateInstantiations.empty())
199 return getObjectName() +
"<" + simox::alg::join(
aron->templateInstantiations,
", ") +
">";
205 if (
aron->templates.empty())
215 if (std::find(
aron->templates.begin(),
aron->templates.end(),
s) !=
aron->templates.end())
218 __PRETTY_FUNCTION__,
"The template already exists!",
s);
220 aron->templates.push_back(
s);
226 if (std::find(
aron->templateInstantiations.begin(),
227 aron->templateInstantiations.end(),
228 s) !=
aron->templateInstantiations.end())
231 __PRETTY_FUNCTION__,
"The template arg already exists!",
s);
233 aron->templateInstantiations.push_back(
s);
236 std::vector<std::string>
239 return aron->templates;
242 std::vector<std::string>
245 return aron->templateInstantiations;
251 return this->
aron->objectName;
254 std::shared_ptr<Object>
260 std::vector<std::string>
263 std::vector<std::string>
ret;
264 for (
const auto& [k, _] : memberTypes)
270 for (
const auto&
s : extends->getAllKeys())
278 type::dto::AronObjectPtr
285 std::vector<VariantPtr>
288 std::vector<VariantPtr>
ret;
289 for (
const auto& [k, t] : memberTypes)
295 for (
const auto& t : extends->getChildren())
306 return memberTypes.size();
312 return "Object<" + this->
aron->objectName +
313 (extends ? (
" : " + extends->getShortName()) :
"") +
">";
319 return "armarx::aron::type::Object<" + this->
aron->objectName +
320 (extends ? (
" : " + extends->getFullName()) :
"") +
">";
326 return "armarx::aron::type::Object";
341 __PRETTY_FUNCTION__,
"Could not navigate without a valid path",
path);
348 __PRETTY_FUNCTION__,
"Could not find an element of a path.", el,
path);
353 return memberTypes.at(el);
358 if (!memberTypes.at(el))
361 __PRETTY_FUNCTION__,
"Could not navigate into a NULL member.", next);
363 return memberTypes.at(el)->navigateAbsolute(next);
static std::string GetFullNamePrefix()
Path withElement(const std::string &, bool escape=false) const
std::string getFirstElement() const
A base class for aron exceptions.
std::shared_ptr< Variant > VariantPtr
VariantPtr getMemberType(const std::string &) const
ReaderT::InputType T & ret
static VariantPtr FromAronDTO(const type::dto::GenericType &, const Path &=Path())
create a variant object from an dto object
std::vector< std::string > getAllKeys() const
#define ARMARX_CHECK_NOT_NULL(ptr)
This macro evaluates whether ptr is not null and if it turns out to be false it will throw an Express...
std::string getObjectNameWithTemplates() const
void setObjectName(const std::string &)
std::shared_ptr< Object > getExtends() const
std::string getObjectName() const
std::vector< std::string > getTemplateInstantiations() const
The ValueNotValidException class.
std::shared_ptr< Value > value()
std::vector< VariantPtr > getChildren() const override
get all child elements
void setExtends(const std::shared_ptr< Object > &)
VariantPtr navigateAbsolute(const Path &path) const override
naviate absolute
static ObjectPtr FromAronObjectDTO(const type::dto::AronObjectPtr &, const aron::Path &path=aron::Path())
type::dto::AronObject ::PointerType aron
bool hasMemberType(const std::string &) const
A convenience header to include all aron files (full include, not forward declared)
void setTemplateInstantiations(const std::vector< std::string > &) const
const std::string & to_string(const std::string &s)
void setMemberTypes(const std::map< std::string, VariantPtr > &)
double v(double t, double v0, double a0, double j)
std::map< std::string, VariantPtr > getDirectMemberTypes() const
static std::string GetNamePrefix()
size_t childrenSize() const override
Object(const Path &=Path())
static type::dto::AronObjectPtr ToAronObjectDTO(const ObjectPtr &)
void addTemplate(const std::string &) const
Path withDetachedFirstElement() const
void addMemberType(const std::string &, const VariantPtr &)
void addTemplateInstantiation(const std::string &) const
std::string getFullName() const override
get the full name of this specific type
std::shared_ptr< Object > ObjectPtr
void setTemplates(const std::vector< std::string > &)
std::map< std::string, VariantPtr > getMemberTypes() const
std::string getShortName() const override
get a short name of this specific type
bool checkObjectName(const std::string &) const
type::dto::AronObjectPtr toAronObjectDTO() const
std::vector< std::string > getTemplates() const
double s(double t, double s0, double v0, double a0, double j)
std::string getObjectNameWithTemplateInstantiations() const
std::vector< std::string > split(const std::string &source, const std::string &splitBy, bool trimElements=false, bool removeEmptyElements=false)
std::string getObjectNameWithoutNamespace() const