29 #define _unused(x) ((void)(x)) 31 #include "SUAPI-CppWrapper/model/Group.hpp" 35 #include "SUAPI-CppWrapper/String.hpp" 36 #include "SUAPI-CppWrapper/model/ComponentDefinition.hpp" 37 #include "SUAPI-CppWrapper/model/Model.hpp" 38 #include "SUAPI-CppWrapper/model/ComponentInstance.hpp" 39 #include "SUAPI-CppWrapper/model/Entities.hpp" 40 #include "SUAPI-CppWrapper/Transformation.hpp" 48 SUGroupRef Group::create_group() {
49 SUGroupRef group_ref = SU_INVALID;
50 SUResult res = SUGroupCreate(&group_ref);
51 assert(res == SU_ERROR_NONE); _unused(res);
56 SUGroupRef Group::copy_reference(
const Group& other) {
57 if (other.m_attached) {
64 new_group.transformation(other.transformation());
65 new_group.name(other.name());
66 new_group.entities().add(other.entities());
67 return new_group.ref();
72 Group(SU_INVALID, true)
112 Group::operator SUGroupRef()
const {
119 throw std::logic_error(
"CW::Group::definition(): Group is null");
121 SUComponentDefinitionRef def_ref = SU_INVALID;
122 SUResult res = SUGroupGetDefinition(this->
ref(), &def_ref);
123 assert(res == SU_ERROR_NONE); _unused(res);
130 throw std::logic_error(
"CW::Group::entities(): Group is null");
132 SUEntitiesRef
entities = SU_INVALID;
133 SUGroupGetEntities(this->
ref(), &entities);
140 throw std::logic_error(
"CW::Group::name(): Group is null");
143 SUStringRef *
const string_ref = string;
144 SUResult res = SUGroupGetName(this->
ref(), string_ref);
145 assert(res == SU_ERROR_NONE); _unused(res);
152 throw std::logic_error(
"CW::Group::name(): Group is null");
154 std::string name_string =
string.std_string();
155 SUResult res = SUGroupSetName(this->
ref(), name_string.c_str());
156 assert(res == SU_ERROR_NONE); _unused(res);
162 throw std::logic_error(
"CW::Group::transformation(): Group is null");
164 SUTransformation transform{};
165 SUGroupGetTransform(this->
ref(), &transform);
172 throw std::logic_error(
"CW::Group::transformation(): Group is null");
174 SUTransformation transform_ref = transform.ref();
175 SUResult res = SUGroupSetTransform(this->
ref(), &transform_ref);
176 assert(res == SU_ERROR_NONE); _unused(res);
bool m_attached
Indicates whether the Entity has been attached to a model.
bool attached() const
Returns true if the entity is attached to another object.
enum SURefType entity_type() const
Returns the type of the entity. See enum SURefType.
ComponentDefinition definition() const
SUEntityRef m_entity
The C SUEntityRef that this class wraps.
Group & operator=(const Group &other)
Transformation transformation() const
Entities entities() const