29 #define _unused(x) ((void)(x)) 31 #include "SUAPI-CppWrapper/model/Opening.hpp" 41 : m_opening(
std::shared_ptr<SUOpeningRef>SU_INVALID)
46 : m_opening(
std::shared_ptr<SUOpeningRef>(&ref))
56 : m_opening(!other ?
std::shared_ptr<SUOpeningRef>SU_INVALID : other.m_opening)
62 if (!!(*
this) && m_opening.use_count() < 2) {
63 SU_RESULT res = SUOpeningRelease(m_opening.get());
64 assert (res != SU_ERROR_INVALID_INPUT);
69 bool Opening::operator!()
const {
70 return SUIsInvalid(*m_opening.get());
76 if (!!(*
this) && m_opening.use_count() < 2) {
77 SU_RESULT res = SUOpeningRelease(m_opening.get());
78 if (res == SU_ERROR_INVALID_INPUT) {
79 throw std::logic_error(
"CW::Opening::operator=(): Opening reference is invalid. The code may point to dereferenced pointer.");
82 m_opening = other.m_opening;
93 throw std::logic_error(
"CW::Opening::get_num_points(): Opening is invalid");
96 SU_RESULT res = SUOpeningGetNumPoints(*m_opening.get(), &count);
97 if (res == SU_ERROR_NULL_POINTER_OUTPUT) {
98 throw std::logic_error(
"CW::Opening::get_num_points(): points or count is NULL");
100 assert(res == SU_ERROR_NONE); _unused(res);
107 throw std::logic_error(
"CW::Opening::get_points(): Opening is invalid");
110 std::vector<SUPoint3D> points_array(count, SU_INVALID);
111 size_t count_returned = 0;
112 SU_RESULT res = SUOpeningGetPoints(*m_opening.get(), count, points_array.data(), &count_returned);
113 if (res == SU_ERROR_NULL_POINTER_OUTPUT) {
114 throw std::logic_error(
"CW::Opening::get_points(): points or count is NULL");
116 assert(res == SU_ERROR_NONE); _unused(res);
117 assert(count_returned == count);
118 std::vector<Point3D> points;
119 points.reserve(count_returned);
120 for (SUPoint3D p : points_array) {
std::vector< Point3D > get_points() const
size_t get_num_points() const
Opening & operator=(const Opening &other)