diff --git a/.github/.abignore b/.github/.abignore index c5fbdcd3fac..535bc3f2c0f 100644 --- a/.github/.abignore +++ b/.github/.abignore @@ -92,3 +92,19 @@ drop = yes [suppress_function] symbol_name_regexp = _Z+N6oneapi3dal[[:digit:]].*7preview[[:digit:]].* drop = yes + +; deselect oneapi::dal newly added symbols +[suppress_type] +symbol_name_regexp = _Z[ZT]?[ISV]?N6oneapi3dal[[:digit:]].* +change_kind = added-type +drop = yes + +[suppress_variable] +symbol_name_regexp = _Z[ZT]?[ISV]?N6oneapi3dal[[:digit:]].* +change_kind = added-variable +drop = yes + +[suppress_function] +symbol_name_regexp = _Z[ZT]?[ISV]?N6oneapi3dal[[:digit:]].* +change_kind = added-function +drop = yes diff --git a/cpp/oneapi/dal/algo/basic_statistics/compute_types.cpp b/cpp/oneapi/dal/algo/basic_statistics/compute_types.cpp index 543dee75027..714eb0bacb5 100644 --- a/cpp/oneapi/dal/algo/basic_statistics/compute_types.cpp +++ b/cpp/oneapi/dal/algo/basic_statistics/compute_types.cpp @@ -73,6 +73,33 @@ template compute_input::compute_input(const table& data, const table& weights) : impl_(new compute_input_impl(data, weights)) {} +template +compute_input::~compute_input() {} + +template +compute_input::compute_input(const compute_input& other) : impl_(other.impl_) {} + +template +compute_input::compute_input(compute_input&& other) noexcept + : impl_(std::move(other.impl_)) {} + +template +compute_input& compute_input::operator=(const compute_input& other) { + if (this != &other) { + compute_input tmp(other); + swap(*this, tmp); + } + return *this; +} + +template +compute_input& compute_input::operator=(compute_input&& other) noexcept { + if (this != &other) { + swap(*this, other); + } + return *this; +} + template const table& compute_input::get_data() const { return impl_->data; @@ -93,6 +120,11 @@ void compute_input::set_weights_impl(const table& value) { impl_->weights = value; } +template +void compute_input::swap(compute_input& a, compute_input& b) noexcept { + std::swap(a.impl_, b.impl_); +} + using msg = dal::detail::error_messages; template @@ -353,6 +385,46 @@ template const table& partial_compute_result::get_partial_sum_squares_centered() const { return impl_->partial_sum_squares_centered; } + +template +partial_compute_input::~partial_compute_input() {} + +template +partial_compute_input::partial_compute_input(const partial_compute_input& other) + : compute_input(other), + prev_(other.prev_) {} + +template +partial_compute_input::partial_compute_input(partial_compute_input&& other) noexcept + : compute_input(std::move(other)), + prev_(std::move(other.prev_)) {} + +template +partial_compute_input& partial_compute_input::operator=( + const partial_compute_input& other) { + if (this != &other) { + partial_compute_input tmp(other); + swap(*this, tmp); + } + return *this; +} + +template +partial_compute_input& partial_compute_input::operator=( + partial_compute_input&& other) noexcept { + if (this != &other) { + swap(*this, other); + } + return *this; +} + +template +void partial_compute_input::swap(partial_compute_input& a, + partial_compute_input& b) noexcept { + compute_input::swap(a, b); + std::swap(a.prev_, b.prev_); +} + template class ONEDAL_EXPORT compute_input; template class ONEDAL_EXPORT compute_result; template class ONEDAL_EXPORT partial_compute_result; diff --git a/cpp/oneapi/dal/algo/basic_statistics/compute_types.hpp b/cpp/oneapi/dal/algo/basic_statistics/compute_types.hpp index a07e3e6c482..4600964dcb9 100644 --- a/cpp/oneapi/dal/algo/basic_statistics/compute_types.hpp +++ b/cpp/oneapi/dal/algo/basic_statistics/compute_types.hpp @@ -54,6 +54,19 @@ class compute_input : public base { compute_input(const table& data); compute_input(const table& data, const table& weights); + /// Do not remove the destructor + /// it is needed to properly handle the visibility of the class in the shared library + /// while compiling with -fvisibility=hidden + + ~compute_input() override; + + /// Rule of five methods defined here due to the definition of the destructor. + + compute_input(const compute_input&); + compute_input(compute_input&&) noexcept; + compute_input& operator=(const compute_input&); + compute_input& operator=(compute_input&&) noexcept; + /// An $n \\times p$ table with the training data, where each row stores one /// feature vector. /// @remark default = table{} @@ -74,6 +87,7 @@ class compute_input : public base { protected: void set_data_impl(const table& data); void set_weights_impl(const table& weights); + static void swap(compute_input& a, compute_input& b) noexcept; private: dal::detail::pimpl> impl_; @@ -307,6 +321,19 @@ class partial_compute_input : protected compute_input { const table& data, const table& weights); + /// Do not remove the destructor + /// it is needed to properly handle the visibility of the class in the shared library + /// while compiling with -fvisibility=hidden + + ~partial_compute_input() override; + + /// Rule of five methods defined here due to the definition of the destructor. + + partial_compute_input(const partial_compute_input&); + partial_compute_input(partial_compute_input&&) noexcept; + partial_compute_input& operator=(const partial_compute_input&); + partial_compute_input& operator=(partial_compute_input&&) noexcept; + const table& get_data() const { return compute_input::get_data(); } @@ -334,6 +361,9 @@ class partial_compute_input : protected compute_input { return *this; } +protected: + static void swap(partial_compute_input& a, partial_compute_input& b) noexcept; + private: partial_compute_result prev_; }; diff --git a/cpp/oneapi/dal/algo/covariance/compute_types.cpp b/cpp/oneapi/dal/algo/covariance/compute_types.cpp index e0ff17c98b8..f7ffc5990b7 100644 --- a/cpp/oneapi/dal/algo/covariance/compute_types.cpp +++ b/cpp/oneapi/dal/algo/covariance/compute_types.cpp @@ -140,6 +140,33 @@ compute_input::compute_input() : impl_(new compute_input_impl{}) {} template compute_input::compute_input(const table& data) : impl_(new compute_input_impl(data)) {} +template +compute_input::~compute_input() {} + +template +compute_input::compute_input(const compute_input& other) : impl_(other.impl_) {} + +template +compute_input::compute_input(compute_input&& other) noexcept + : impl_(std::move(other.impl_)) {} + +template +compute_input& compute_input::operator=(const compute_input& other) { + if (this != &other) { + compute_input tmp(other); + swap(*this, tmp); + } + return *this; +} + +template +compute_input& compute_input::operator=(compute_input&& other) noexcept { + if (this != &other) { + swap(*this, other); + } + return *this; +} + template const table& compute_input::get_data() const { return impl_->data; @@ -150,6 +177,11 @@ void compute_input::set_data_impl(const table& value) { impl_->data = value; } +template +void compute_input::swap(compute_input& a, compute_input& b) noexcept { + std::swap(a.impl_, b.impl_); +} + template compute_result::compute_result() : impl_(new compute_result_impl{}) {} @@ -265,6 +297,45 @@ void partial_compute_result::set_partial_sum_impl(const table& value) { impl_->sums = value; } +template +partial_compute_input::~partial_compute_input() {} + +template +partial_compute_input::partial_compute_input(const partial_compute_input& other) + : compute_input(other), + prev_(other.prev_) {} + +template +partial_compute_input::partial_compute_input(partial_compute_input&& other) noexcept + : compute_input(std::move(other)), + prev_(std::move(other.prev_)) {} + +template +partial_compute_input& partial_compute_input::operator=( + const partial_compute_input& other) { + if (this != &other) { + partial_compute_input tmp(other); + swap(*this, tmp); + } + return *this; +} + +template +partial_compute_input& partial_compute_input::operator=( + partial_compute_input&& other) noexcept { + if (this != &other) { + swap(*this, other); + } + return *this; +} + +template +void partial_compute_input::swap(partial_compute_input& a, + partial_compute_input& b) noexcept { + compute_input::swap(a, b); + std::swap(a.prev_, b.prev_); +} + template class ONEDAL_EXPORT compute_input; template class ONEDAL_EXPORT compute_result; template class ONEDAL_EXPORT partial_compute_result; diff --git a/cpp/oneapi/dal/algo/covariance/compute_types.hpp b/cpp/oneapi/dal/algo/covariance/compute_types.hpp index 40861096bc6..f3b5dc22644 100644 --- a/cpp/oneapi/dal/algo/covariance/compute_types.hpp +++ b/cpp/oneapi/dal/algo/covariance/compute_types.hpp @@ -118,6 +118,19 @@ class compute_input : public base { /// property value compute_input(const table& data); + /// Do not remove the destructor + /// it is needed to properly handle the visibility of the class in the shared library + /// while compiling with -fvisibility=hidden + + ~compute_input() override; + + /// Rule of five methods defined here due to the definition of the destructor. + + compute_input(const compute_input&); + compute_input(compute_input&&) noexcept; + compute_input& operator=(const compute_input&); + compute_input& operator=(compute_input&&) noexcept; + /// An $n \\times p$ table with the training data, where each row stores one /// feature vector. /// @remark default = table{} @@ -130,6 +143,7 @@ class compute_input : public base { protected: void set_data_impl(const table& value); + static void swap(compute_input& a, compute_input& b) noexcept; private: dal::detail::pimpl> impl_; @@ -249,6 +263,20 @@ class partial_compute_input : protected compute_input { partial_compute_input(const partial_compute_result& prev, const table& data); + /// Do not remove the destructor + /// it is needed to properly handle the visibility of the class in the shared library + /// while compiling with -fvisibility=hidden + + ~partial_compute_input() override; + + /// Rule of five methods defined here due to the definition of the destructor. + + partial_compute_input(const partial_compute_input&); + partial_compute_input(partial_compute_input&&) noexcept; + partial_compute_input& operator=(const partial_compute_input&); + partial_compute_input& operator=(partial_compute_input&&) noexcept; + + /// A $n \\times p$ table with the portion of the training data, where each row stores one feature vector. const table& get_data() const { return compute_input::get_data(); } @@ -258,6 +286,7 @@ class partial_compute_input : protected compute_input { return *this; } + /// Partial result from the previous step of the online covariance computation. const partial_compute_result& get_prev() const { return prev_; } @@ -267,6 +296,9 @@ class partial_compute_input : protected compute_input { return *this; } +protected: + static void swap(partial_compute_input& a, partial_compute_input& b) noexcept; + private: partial_compute_result prev_; }; diff --git a/cpp/oneapi/dal/algo/dbscan/compute_types.cpp b/cpp/oneapi/dal/algo/dbscan/compute_types.cpp index e53810acd2b..844807a96c1 100644 --- a/cpp/oneapi/dal/algo/dbscan/compute_types.cpp +++ b/cpp/oneapi/dal/algo/dbscan/compute_types.cpp @@ -51,6 +51,33 @@ template compute_input::compute_input(const table& data, const table& weights) : impl_(new compute_input_impl(data, weights)) {} +template +compute_input::~compute_input() {} + +template +compute_input::compute_input(const compute_input& other) : impl_(other.impl_) {} + +template +compute_input::compute_input(compute_input&& other) noexcept + : impl_(std::move(other.impl_)) {} + +template +compute_input& compute_input::operator=(const compute_input& other) { + if (this != &other) { + compute_input tmp(other); + swap(*this, tmp); + } + return *this; +} + +template +compute_input& compute_input::operator=(compute_input&& other) noexcept { + if (this != &other) { + swap(*this, other); + } + return *this; +} + template const table& compute_input::get_data() const { return impl_->data; @@ -71,6 +98,11 @@ void compute_input::set_weights_impl(const table& value) { impl_->weights = value; } +template +void compute_input::swap(compute_input& a, compute_input& b) noexcept { + std::swap(a.impl_, b.impl_); +} + template compute_result::compute_result() : impl_(new compute_result_impl{}) {} diff --git a/cpp/oneapi/dal/algo/dbscan/compute_types.hpp b/cpp/oneapi/dal/algo/dbscan/compute_types.hpp index 2954b4e56c4..8dced27f965 100644 --- a/cpp/oneapi/dal/algo/dbscan/compute_types.hpp +++ b/cpp/oneapi/dal/algo/dbscan/compute_types.hpp @@ -49,6 +49,19 @@ class compute_input : public base { /// :literal:`weights` compute_input(const table& data = {}, const table& weights = {}); + /// Do not remove the destructor + /// it is needed to properly handle the visibility of the class in the shared library + /// while compiling with -fvisibility=hidden + + ~compute_input() override; + + /// Rule of five methods defined here due to the definition of the destructor. + + compute_input(const compute_input&); + compute_input(compute_input&&) noexcept; + compute_input& operator=(const compute_input&); + compute_input& operator=(compute_input&&) noexcept; + /// An $n \\times p$ table with the data to be clustered, where each row /// stores one feature vector. const table& get_data() const; @@ -70,6 +83,7 @@ class compute_input : public base { protected: void set_data_impl(const table& data); void set_weights_impl(const table& weights); + static void swap(compute_input& a, compute_input& b) noexcept; private: dal::detail::pimpl> impl_; diff --git a/cpp/oneapi/dal/algo/kmeans/train_types.cpp b/cpp/oneapi/dal/algo/kmeans/train_types.cpp index 1d5791a0284..bf8d6698033 100644 --- a/cpp/oneapi/dal/algo/kmeans/train_types.cpp +++ b/cpp/oneapi/dal/algo/kmeans/train_types.cpp @@ -53,6 +53,32 @@ template train_input::train_input(const table& data, const table& initial_centroids) : impl_(new train_input_impl(data, initial_centroids)) {} +template +train_input::~train_input() {} + +template +train_input::train_input(const train_input& other) : impl_(other.impl_) {} + +template +train_input::train_input(train_input&& other) noexcept : impl_(std::move(other.impl_)) {} + +template +train_input& train_input::operator=(const train_input& other) { + if (this != &other) { + train_input tmp(other); + swap(*this, tmp); + } + return *this; +} + +template +train_input& train_input::operator=(train_input&& other) noexcept { + if (this != &other) { + swap(*this, other); + } + return *this; +} + template const table& train_input::get_data() const { return impl_->data; @@ -73,6 +99,11 @@ void train_input::set_initial_centroids_impl(const table& value) { impl_->initial_centroids = value; } +template +void train_input::swap(train_input& a, train_input& b) noexcept { + std::swap(a.impl_, b.impl_); +} + template train_result::train_result() : impl_(new train_result_impl{}) {} diff --git a/cpp/oneapi/dal/algo/kmeans/train_types.hpp b/cpp/oneapi/dal/algo/kmeans/train_types.hpp index 8e40316b7c1..09c2ae0ab6f 100644 --- a/cpp/oneapi/dal/algo/kmeans/train_types.hpp +++ b/cpp/oneapi/dal/algo/kmeans/train_types.hpp @@ -51,6 +51,19 @@ class train_input : public base { /// :literal:`initial_centroids` train_input(const table& data, const table& initial_centroids); + /// Do not remove the destructor + /// it is needed to properly handle the visibility of the class in the shared library + /// while compiling with -fvisibility=hidden + + ~train_input() override; + + /// Rule of five methods defined here due to the definition of the destructor. + + train_input(const train_input&); + train_input(train_input&&) noexcept; + train_input& operator=(const train_input&); + train_input& operator=(train_input&&) noexcept; + /// An $n \\times p$ table with the data to be clustered, where each row /// stores one feature vector. const table& get_data() const; @@ -72,6 +85,7 @@ class train_input : public base { protected: void set_data_impl(const table& data); void set_initial_centroids_impl(const table& data); + static void swap(train_input& a, train_input& b) noexcept; private: dal::detail::pimpl> impl_; diff --git a/cpp/oneapi/dal/algo/kmeans_init/compute_types.cpp b/cpp/oneapi/dal/algo/kmeans_init/compute_types.cpp index 6a9ef589d94..d53bc9f262b 100644 --- a/cpp/oneapi/dal/algo/kmeans_init/compute_types.cpp +++ b/cpp/oneapi/dal/algo/kmeans_init/compute_types.cpp @@ -41,6 +41,33 @@ namespace v1 { template compute_input::compute_input(const table& data) : impl_(new compute_input_impl(data)) {} +template +compute_input::~compute_input() {} + +template +compute_input::compute_input(const compute_input& other) : impl_(other.impl_) {} + +template +compute_input::compute_input(compute_input&& other) noexcept + : impl_(std::move(other.impl_)) {} + +template +compute_input& compute_input::operator=(const compute_input& other) { + if (this != &other) { + compute_input tmp(other); + swap(*this, tmp); + } + return *this; +} + +template +compute_input& compute_input::operator=(compute_input&& other) noexcept { + if (this != &other) { + swap(*this, other); + } + return *this; +} + template const table& compute_input::get_data() const { return impl_->data; @@ -51,6 +78,11 @@ void compute_input::set_data_impl(const table& value) { impl_->data = value; } +template +void compute_input::swap(compute_input& a, compute_input& b) noexcept { + std::swap(a.impl_, b.impl_); +} + template compute_result::compute_result() : impl_(new compute_result_impl{}) {} diff --git a/cpp/oneapi/dal/algo/kmeans_init/compute_types.hpp b/cpp/oneapi/dal/algo/kmeans_init/compute_types.hpp index 82ab94772e5..f629753eeea 100644 --- a/cpp/oneapi/dal/algo/kmeans_init/compute_types.hpp +++ b/cpp/oneapi/dal/algo/kmeans_init/compute_types.hpp @@ -48,6 +48,19 @@ class compute_input : public base { /// Creates a new instance of the class with the given :literal:`data`. compute_input(const table& data); + /// Do not remove the destructor + /// it is needed to properly handle the visibility of the class in the shared library + /// while compiling with -fvisibility=hidden + + ~compute_input() override; + + /// Rule of five methods defined here due to the definition of the destructor. + + compute_input(const compute_input&); + compute_input(compute_input&&) noexcept; + compute_input& operator=(const compute_input&); + compute_input& operator=(compute_input&&) noexcept; + /// An $n \\times p$ table with the data to be clustered, where each row /// stores one feature vector. /// @remark default = table{} @@ -58,6 +71,9 @@ class compute_input : public base { return *this; } +protected: + static void swap(compute_input& a, compute_input& b) noexcept; + private: void set_data_impl(const table& data); diff --git a/cpp/oneapi/dal/algo/knn/train_types.cpp b/cpp/oneapi/dal/algo/knn/train_types.cpp index 276f4d836c3..56a9328b08a 100644 --- a/cpp/oneapi/dal/algo/knn/train_types.cpp +++ b/cpp/oneapi/dal/algo/knn/train_types.cpp @@ -48,6 +48,32 @@ train_input::train_input(const table& data, const table& responses) template train_input::train_input(const table& data) : impl_(new train_input_impl(data)) {} +template +train_input::~train_input() {} + +template +train_input::train_input(const train_input& other) : impl_(other.impl_) {} + +template +train_input::train_input(train_input&& other) noexcept : impl_(std::move(other.impl_)) {} + +template +train_input& train_input::operator=(const train_input& other) { + if (this != &other) { + train_input tmp(other); + swap(*this, tmp); + } + return *this; +} + +template +train_input& train_input::operator=(train_input&& other) noexcept { + if (this != &other) { + swap(*this, other); + } + return *this; +} + template const table& train_input::get_data() const { return impl_->data; @@ -68,6 +94,11 @@ void train_input::set_responses_impl(const table& value) { impl_->responses = value; } +template +void train_input::swap(train_input& a, train_input& b) noexcept { + std::swap(a.impl_, b.impl_); +} + template train_result::train_result() : impl_(new train_result_impl{}) {} diff --git a/cpp/oneapi/dal/algo/knn/train_types.hpp b/cpp/oneapi/dal/algo/knn/train_types.hpp index 70aa87333af..55168eda686 100644 --- a/cpp/oneapi/dal/algo/knn/train_types.hpp +++ b/cpp/oneapi/dal/algo/knn/train_types.hpp @@ -51,6 +51,19 @@ class train_input : public base { train_input(const table& data); + /// Do not remove the destructor + /// it is needed to properly handle the visibility of the class in the shared library + /// while compiling with -fvisibility=hidden + + ~train_input() override; + + /// Rule of five methods defined here due to the definition of the destructor. + + train_input(const train_input&); + train_input(train_input&&) noexcept; + train_input& operator=(const train_input&); + train_input& operator=(train_input&&) noexcept; + /// The training set X /// @remark default = table{} const table& get_data() const; @@ -77,13 +90,14 @@ class train_input : public base { template > auto& set_responses(const table& responses) { - set_data_impl(responses); + set_responses_impl(responses); return *this; } protected: void set_data_impl(const table& data); void set_responses_impl(const table& responses); + static void swap(train_input& a, train_input& b) noexcept; private: dal::detail::pimpl> impl_; diff --git a/cpp/oneapi/dal/algo/linear_regression/train_types.cpp b/cpp/oneapi/dal/algo/linear_regression/train_types.cpp index 2fd59706772..1510aac7372 100644 --- a/cpp/oneapi/dal/algo/linear_regression/train_types.cpp +++ b/cpp/oneapi/dal/algo/linear_regression/train_types.cpp @@ -135,6 +135,32 @@ train_input::train_input(const table& data, const table& responses) template train_input::train_input(const table& data) : impl_(new train_input_impl(data)) {} +template +train_input::~train_input() {} + +template +train_input::train_input(const train_input& other) : impl_(other.impl_) {} + +template +train_input::train_input(train_input&& other) noexcept : impl_(std::move(other.impl_)) {} + +template +train_input& train_input::operator=(const train_input& other) { + if (this != &other) { + train_input tmp(other); + swap(*this, tmp); + } + return *this; +} + +template +train_input& train_input::operator=(train_input&& other) noexcept { + if (this != &other) { + swap(*this, other); + } + return *this; +} + template const table& train_input::get_data() const { return impl_->data; @@ -155,6 +181,11 @@ void train_input::set_responses_impl(const table& value) { impl_->responses = value; } +template +void train_input::swap(train_input& a, train_input& b) noexcept { + std::swap(a.impl_, b.impl_); +} + template train_result::train_result() : impl_(new train_result_impl{}) {} @@ -283,6 +314,44 @@ void partial_train_result::set_partial_xty_impl(const table& value) { impl_->xty = value; } +template +partial_train_input::~partial_train_input() {} + +template +partial_train_input::partial_train_input(const partial_train_input& other) + : train_input(other), + prev_(other.prev_) {} + +template +partial_train_input::partial_train_input(partial_train_input&& other) noexcept + : train_input(std::move(other)), + prev_(std::move(other.prev_)) {} + +template +partial_train_input& partial_train_input::operator=(const partial_train_input& other) { + if (this != &other) { + partial_train_input tmp(other); + swap(*this, tmp); + } + return *this; +} + +template +partial_train_input& partial_train_input::operator=( + partial_train_input&& other) noexcept { + if (this != &other) { + swap(*this, other); + } + return *this; +} + +template +void partial_train_input::swap(partial_train_input& a, + partial_train_input& b) noexcept { + train_input::swap(a, b); + std::swap(a.prev_, b.prev_); +} + template class ONEDAL_EXPORT train_result; template class ONEDAL_EXPORT train_input; template class ONEDAL_EXPORT partial_train_result; diff --git a/cpp/oneapi/dal/algo/linear_regression/train_types.hpp b/cpp/oneapi/dal/algo/linear_regression/train_types.hpp index 96976959d2d..8384909c361 100644 --- a/cpp/oneapi/dal/algo/linear_regression/train_types.hpp +++ b/cpp/oneapi/dal/algo/linear_regression/train_types.hpp @@ -119,7 +119,18 @@ class train_input : public base { train_input(const table& data); - virtual ~train_input() = default; + /// Do not remove the destructor + /// it is needed to properly handle the visibility of the class in the shared library + /// while compiling with -fvisibility=hidden + + ~train_input() override; + + /// Rule of five methods defined here due to the definition of the destructor. + + train_input(const train_input&); + train_input(train_input&&) noexcept; + train_input& operator=(const train_input&); + train_input& operator=(train_input&&) noexcept; /// The training set X /// @remark default = table{} @@ -142,6 +153,7 @@ class train_input : public base { protected: void set_data_impl(const table& data); void set_responses_impl(const table& responses); + static void swap(train_input& a, train_input& b) noexcept; private: dal::detail::pimpl> impl_; @@ -268,7 +280,18 @@ class partial_train_input : protected train_input { partial_train_input(const partial_train_result& prev, const partial_train_input& input); - virtual ~partial_train_input() = default; + /// Do not remove the destructor + /// it is needed to properly handle the visibility of the class in the shared library + /// while compiling with -fvisibility=hidden + + ~partial_train_input() override; + + /// Rule of five methods defined here due to the definition of the destructor. + + partial_train_input(const partial_train_input&); + partial_train_input(partial_train_input&&) noexcept; + partial_train_input& operator=(const partial_train_input&); + partial_train_input& operator=(partial_train_input&&) noexcept; const table& get_data() const { return train_input::get_data(); @@ -299,6 +322,9 @@ class partial_train_input : protected train_input { return *this; } +protected: + static void swap(partial_train_input& a, partial_train_input& b) noexcept; + private: partial_train_result prev_; }; diff --git a/cpp/oneapi/dal/algo/pca/train_types.cpp b/cpp/oneapi/dal/algo/pca/train_types.cpp index 037a838254e..77816a87eb0 100644 --- a/cpp/oneapi/dal/algo/pca/train_types.cpp +++ b/cpp/oneapi/dal/algo/pca/train_types.cpp @@ -131,6 +131,32 @@ train_input::train_input() : impl_(new train_input_impl{}) {} template train_input::train_input(const table& data) : impl_(new train_input_impl(data)) {} +template +train_input::~train_input() {} + +template +train_input::train_input(const train_input& other) : impl_(other.impl_) {} + +template +train_input::train_input(train_input&& other) noexcept : impl_(std::move(other.impl_)) {} + +template +train_input& train_input::operator=(const train_input& other) { + if (this != &other) { + train_input tmp(other); + swap(*this, tmp); + } + return *this; +} + +template +train_input& train_input::operator=(train_input&& other) noexcept { + if (this != &other) { + swap(*this, other); + } + return *this; +} + template const table& train_input::get_data() const { return impl_->data; @@ -141,6 +167,11 @@ void train_input::set_data_impl(const table& value) { impl_->data = value; } +template +void train_input::swap(train_input& a, train_input& b) noexcept { + std::swap(a.impl_, b.impl_); +} + using msg = dal::detail::error_messages; template @@ -325,6 +356,44 @@ void partial_train_result::set_auxiliary_table_impl(const table& value) { impl_->auxiliary_tables.push_back(value); } +template +partial_train_input::~partial_train_input() {} + +template +partial_train_input::partial_train_input(const partial_train_input& other) + : train_input(other), + prev_(other.prev_) {} + +template +partial_train_input::partial_train_input(partial_train_input&& other) noexcept + : train_input(std::move(other)), + prev_(std::move(other.prev_)) {} + +template +partial_train_input& partial_train_input::operator=(const partial_train_input& other) { + if (this != &other) { + partial_train_input tmp(other); + swap(*this, tmp); + } + return *this; +} + +template +partial_train_input& partial_train_input::operator=( + partial_train_input&& other) noexcept { + if (this != &other) { + swap(*this, other); + } + return *this; +} + +template +void partial_train_input::swap(partial_train_input& a, + partial_train_input& b) noexcept { + train_input::swap(a, b); + std::swap(a.prev_, b.prev_); +} + template class ONEDAL_EXPORT train_input; template class ONEDAL_EXPORT train_result; template class ONEDAL_EXPORT partial_train_result; diff --git a/cpp/oneapi/dal/algo/pca/train_types.hpp b/cpp/oneapi/dal/algo/pca/train_types.hpp index c6d2c111aa8..7d066feb6e5 100644 --- a/cpp/oneapi/dal/algo/pca/train_types.hpp +++ b/cpp/oneapi/dal/algo/pca/train_types.hpp @@ -118,6 +118,19 @@ class train_input : public base { /// property value train_input(const table& data); + /// Do not remove the destructor + /// it is needed to properly handle the visibility of the class in the shared library + /// while compiling with -fvisibility=hidden + + ~train_input() override; + + /// Rule of five methods defined here due to the definition of the destructor. + + train_input(const train_input&); + train_input(train_input&&) noexcept; + train_input& operator=(const train_input&); + train_input& operator=(train_input&&) noexcept; + /// An $n \\times p$ table with the training data, where each row stores one /// feature vector. /// @remark default = table{} @@ -130,6 +143,7 @@ class train_input : public base { protected: void set_data_impl(const table& data); + static void swap(train_input& a, train_input& b) noexcept; private: dal::detail::pimpl> impl_; @@ -302,6 +316,19 @@ class partial_train_input : protected train_input { partial_train_input(const partial_train_result& prev, const table& data); + /// Do not remove the destructor + /// it is needed to properly handle the visibility of the class in the shared library + /// while compiling with -fvisibility=hidden + + ~partial_train_input() override; + + /// Rule of five methods defined here due to the definition of the destructor. + + partial_train_input(const partial_train_input&); + partial_train_input(partial_train_input&&) noexcept; + partial_train_input& operator=(const partial_train_input&); + partial_train_input& operator=(partial_train_input&&) noexcept; + const table& get_data() const { return train_input::get_data(); } @@ -320,6 +347,9 @@ class partial_train_input : protected train_input { return *this; } +protected: + static void swap(partial_train_input& a, partial_train_input& b) noexcept; + private: partial_train_result prev_; }; diff --git a/docs/dalapi/directives.py b/docs/dalapi/directives.py index 6c8e738794a..f3cb73a3f21 100644 --- a/docs/dalapi/directives.py +++ b/docs/dalapi/directives.py @@ -75,7 +75,7 @@ def add_description(self, description, x: RstBuilder, level=0): x.add_doc(desc_str, level=level) def add_function_base(self, func, x: RstBuilder, is_free=True, level=0): - if func.doc and func.doc.description: + if func.doc and func.doc.description and func.doc.description.runs: namespace = func.parent_fully_qualified_name if is_free else None x.add_function(func.declaration, namespace, level=level) self.add_description(func.doc.description, x, level=level + 1)