29 #define _unused(x) ((void)(x)) 31 #include "SUAPI-CppWrapper/model/Layer.hpp" 36 #include "SUAPI-CppWrapper/String.hpp" 43 SULayerRef Layer::create_layer() {
44 SULayerRef layer = SU_INVALID;
45 SUResult res = SULayerCreate(&layer);
46 assert(res == SU_ERROR_NONE); _unused(res);
50 SULayerRef Layer::copy_reference(
const Layer& other) {
51 if (other.m_attached || SUIsInvalid(other.m_entity)) {
54 SULayerRef new_layer = create_layer();
67 Entity(SULayerToEntity(layer_ref), attached)
83 SULayerRef layer = this->
ref();
84 SUResult res = SULayerRelease(&layer);
85 assert(res == SU_ERROR_NONE); _unused(res);
95 SULayerRef layer = this->
ref();
96 SUResult res = SULayerRelease(&layer);
97 assert(res == SU_ERROR_NONE); _unused(res);
99 m_entity = SULayerToEntity(copy_reference(other));
113 Layer::operator SULayerRef()
const {
123 SUResult res = SULayerGetName(this->
ref(), name);
124 if (res == SU_ERROR_NULL_POINTER_OUTPUT) {
133 return Layer(create_layer(),
false);
135 Layer new_layer(create_layer(),
false);
143 throw std::logic_error(
"CW::Layer::name(): Layer is null");
146 SUResult res = SULayerGetName(this->
ref(),
string);
147 assert(res == SU_ERROR_NONE); _unused(res);
154 throw std::logic_error(
"CW::Layer::name(): Layer is null");
156 SUResult res = SULayerSetName(this->
ref(),
string.std_string().c_str());
157 assert(res == SU_ERROR_NONE); _unused(res);
163 throw std::logic_error(
"CW::Layer::name(): Layer is null");
165 SUResult res = SULayerSetName(this->
ref(),
string.c_str());
166 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.
SUEntityRef m_entity
The C SUEntityRef that this class wraps.
Layer & operator=(const Layer &other)
Entity & operator=(const Entity &other)
Copy assignment operator.