/* * * Copyright (C) 2024 Brett Terpstra * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef GP_IMAGE_TEST_EXTERN_H #define GP_IMAGE_TEST_EXTERN_H #include struct shapiro_wilk_results { blt::i8 error; double estimate; double p_value; double* weights; blt::size_t weights_len; blt::size_t weights_capacity; }; extern "C" shapiro_wilk_results willbert(const double* data, blt::size_t len); extern "C" void test(); class willbruh { private: shapiro_wilk_results results; public: explicit willbruh(const std::vector& data): results(willbert(data.data(), data.size())) {} explicit willbruh(const double* data, blt::size_t size): results(willbert(data, size)) {} willbruh(const willbruh& copy) = delete; willbruh(const willbruh&& move) = delete; willbruh& operator=(const willbruh& copy) = delete; willbruh& operator=(const willbruh&& move) = delete; shapiro_wilk_results& get() { return results; } shapiro_wilk_results* operator->(){ return &results; } ~willbruh() { free(results.weights); } }; #endif //GP_IMAGE_TEST_EXTERN_H