29 #define _unused(x) ((void)(x)) 31 #include "SUAPI-CppWrapper/model/InstancePath.hpp" 33 #include "SUAPI-CppWrapper/model/ComponentInstance.hpp" 34 #include "SUAPI-CppWrapper/model/Entity.hpp" 35 #include "SUAPI-CppWrapper/Transformation.hpp" 36 #include "SUAPI-CppWrapper/String.hpp" 42 SUInstancePathRef InstancePath::create_instance_path() {
43 SUInstancePathRef instance_path_ref = SU_INVALID;
44 SUResult res = SUInstancePathCreate(&instance_path_ref);
45 assert(res == SU_ERROR_NONE); _unused(res);
46 return instance_path_ref;
50 SUInstancePathRef InstancePath::copy_reference(
const InstancePath& other) {
51 SUInstancePathRef instance_path_ref = SU_INVALID;
52 SUResult res = SUInstancePathCreateCopy(&instance_path_ref, other.ref());
53 assert(res == SU_ERROR_NONE); _unused(res);
54 return instance_path_ref;
59 m_instance_path(create_instance_path())
64 m_instance_path(instance_path)
74 SUResult res = SUInstancePathRelease(&m_instance_path);
75 assert(res == SU_ERROR_NONE); _unused(res);
80 SUResult res = SUInstancePathRelease(&m_instance_path);
81 assert(res == SU_ERROR_NONE); _unused(res);
82 m_instance_path = copy_reference(other);
87 SUInstancePathRef InstancePath::ref()
const {
88 return m_instance_path;
92 InstancePath::operator SUInstancePathRef()
const {
97 InstancePath::operator SUInstancePathRef*() {
98 return &m_instance_path;
103 SUResult res = SUInstancePathPushInstance(m_instance_path, instance.
ref());
104 assert(res == SU_ERROR_NONE); _unused(res);
110 SUResult res = SUInstancePathPopInstance(m_instance_path);
111 assert(res == SU_ERROR_NONE); _unused(res);
117 SUResult res = SUInstancePathSetLeaf(m_instance_path, entity.ref());
118 assert(res == SU_ERROR_NONE); _unused(res);
125 SUResult res = SUInstancePathGetPathDepth(m_instance_path, &depth);
126 assert(res == SU_ERROR_NONE); _unused(res);
133 SUResult res = SUInstancePathGetFullDepth(m_instance_path, &depth);
134 assert(res == SU_ERROR_NONE); _unused(res);
140 SUTransformation transform;
141 SUResult res = SUInstancePathGetTransform(m_instance_path, &transform);
142 assert(res == SU_ERROR_NONE); _unused(res);
148 SUTransformation transform;
149 SUResult res = SUInstancePathGetTransformAtDepth(m_instance_path, depth, &transform);
150 assert(res == SU_ERROR_NONE); _unused(res);
156 assert(this->
valid());
157 SUComponentInstanceRef instance = SU_INVALID;
158 SUResult res = SUInstancePathGetInstanceAtDepth(m_instance_path, depth, &instance);
159 assert(res == SU_ERROR_NONE); _unused(res);
165 SUEntityRef entity = SU_INVALID;
166 SUResult res = SUInstancePathGetLeafAsEntity(m_instance_path, &entity);
167 assert(res == SU_ERROR_NONE); _unused(res);
173 SUDrawingElementRef element = SU_INVALID;
174 SUResult res = SUInstancePathGetLeaf(m_instance_path, &element);
175 assert(res == SU_ERROR_NONE); _unused(res);
182 SUResult res = SUInstancePathIsValid(m_instance_path, &valid);
183 assert(res == SU_ERROR_NONE); _unused(res);
190 SUResult res = SUInstancePathIsEmpty(m_instance_path, &empty);
191 assert(res == SU_ERROR_NONE); _unused(res);
198 SUResult res = SUInstancePathContains(m_instance_path, entity.ref(), &
contains);
199 assert(res == SU_ERROR_NONE); _unused(res);
205 SUStringRef pid = SU_INVALID;
206 SUResult res = SUStringCreate(&pid);
207 assert(res == SU_ERROR_NONE);
208 res = SUInstancePathGetPersistentID(m_instance_path, &pid);
209 assert(res == SU_ERROR_NONE); _unused(res);
215 SUStringRef pid = SU_INVALID;
216 SUResult res = SUStringCreate(&pid);
217 assert(res == SU_ERROR_NONE);
218 res = SUInstancePathGetPersistentIDAtDepth(m_instance_path, depth, &pid);
219 assert(res == SU_ERROR_NONE); _unused(res);
String persistent_id_at_depth(size_t depth) const
InstancePath & set_leaf(const Entity &entity)
Transformation total_transformation() const
bool contains(const Entity &entity) const
InstancePath & operator=(const InstancePath &other)
size_t full_depth() const
Transformation transformation_at_depth(size_t depth) const
InstancePath & push(const ComponentInstance &instance)
ComponentInstance instance_at_depth(size_t depth) const
String persistent_id() const
DrawingElement leaf() const
SUComponentInstanceRef ref() const
Entity leaf_entity() const