diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt index 71ca2a0..870301c 100644 --- a/3rdparty/CMakeLists.txt +++ b/3rdparty/CMakeLists.txt @@ -35,6 +35,7 @@ SET(${PARENT}_SUBMODULE_CONFIG_READER ON CACHE BOOL "" FORCE) if (${PARENT}_SUBMODULE_CONFIG_READER) SET(${PARENT}_CONFIG_READER ON CACHE BOOL "" FORCE) SET(${PARENT}_CONFIG_READER_EXAMPLES OFF CACHE BOOL "" FORCE) + SET(${PARENT}_CONFIG_READER_TESTS OFF CACHE BOOL "" FORCE) endif() diff --git a/3rdparty/ConfigReader b/3rdparty/ConfigReader index c3839fa..5756fc1 160000 --- a/3rdparty/ConfigReader +++ b/3rdparty/ConfigReader @@ -1 +1 @@ -Subproject commit c3839fa3c5e32860303d9af07241e4082d5b2ae5 +Subproject commit 5756fc1db2a5252453f758823c43925f8bbae942 diff --git a/README.md b/README.md index e44d830..55273e3 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ # **ObjectDetector interface C++ library** -**v1.7.3** +**v1.8.0** @@ -67,6 +67,7 @@ | 1.7.1 | 25.03.2024 | - Frame class updated.
- ConfigReader class updated.
- Documentation updated. | | 1.7.2 | 20.05.2024 | - Frame class updated.
- ConfigReader class updated.
- Documentation updated. | | 1.7.3 | 23.07.2024 | - CMake structure updated. | +| 1.8.0 | 02.10.2026 | - Submodules updated.
- Compiler warnings fixed. | @@ -180,7 +181,7 @@ cout << "ObjectDetector class version: " << ObjectDetector::getVersion(); Console output: ```bash -ObjectDetector class version: 1.7.3 +ObjectDetector class version: 1.8.0 ``` @@ -682,6 +683,12 @@ public: numThreads, type, enable, custom1, custom2, custom3, classNames); + /// Default constructor. + ObjectDetectorParams() = default; + + /// Copy constructor. + ObjectDetectorParams(const ObjectDetectorParams& src) = default; + /// Copy operator. ObjectDetectorParams& operator= (const ObjectDetectorParams& src); diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index baba693..77176c9 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -54,4 +54,8 @@ target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) ############################################################################### target_link_libraries(${PROJECT_NAME} ObjectDetector) - +if(MSVC) + target_compile_options(${PROJECT_NAME} PRIVATE /W4 /WX) +else() + target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Wpedantic -Werror) +endif() diff --git a/example/CustomObjectDetector.cpp b/example/CustomObjectDetector.cpp index 7086f6d..0dc1090 100644 --- a/example/CustomObjectDetector.cpp +++ b/example/CustomObjectDetector.cpp @@ -301,14 +301,14 @@ bool cr::detector::CustomObjectDetector::executeCommand(ObjectDetectorCommand id -bool cr::detector::CustomObjectDetector::detect(cr::video::Frame& frame) +bool cr::detector::CustomObjectDetector::detect([[maybe_unused]] cr::video::Frame& frame) { return true; } -bool cr::detector::CustomObjectDetector::setMask(cr::video::Frame mask) +bool cr::detector::CustomObjectDetector::setMask([[maybe_unused]] cr::video::Frame mask) { return true; } diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 64eeb95..d2b5080 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -6,7 +6,7 @@ cmake_minimum_required(VERSION 3.13) ## LIBRARY-PROJECT ## name and version ############################################################################### -project(ObjectDetector VERSION 1.7.3 LANGUAGES CXX) +project(ObjectDetector VERSION 1.8.0 LANGUAGES CXX) @@ -52,4 +52,10 @@ target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) ## linking all dependencies ############################################################################### target_link_libraries(${PROJECT_NAME} Frame) -target_link_libraries(${PROJECT_NAME} ConfigReader) \ No newline at end of file +target_link_libraries(${PROJECT_NAME} ConfigReader) + +if(MSVC) + target_compile_options(${PROJECT_NAME} PRIVATE /W4 /WX) +else() + target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Wpedantic -Werror) +endif() diff --git a/src/ObjectDetector.cpp b/src/ObjectDetector.cpp index 359a5e1..ce2ea9a 100644 --- a/src/ObjectDetector.cpp +++ b/src/ObjectDetector.cpp @@ -142,7 +142,7 @@ bool cr::detector::ObjectDetectorParams::encode( pos += static_cast(initString.size()) + 1; // Iterate through all of the class names and add them to the data. - for (int i = 0; i < classNames.size(); ++i) + for (size_t i = 0; i < classNames.size(); ++i) { // Add size + 1 of init string to data to recognize it on decode with null terminator. memcpy(&data[pos], &classNames[i][0], classNames[i].size() + 1); @@ -325,7 +325,7 @@ bool cr::detector::ObjectDetectorParams::encode( if (mask->classNames) { // Iterate through all of the class names and add them to the data. - for (int i = 0; i < classNames.size(); ++i) + for (size_t i = 0; i < classNames.size(); ++i) { // Add size + 1 of init string to data to recognize it on decode with null terminator. memcpy(&data[pos], &classNames[i][0], classNames[i].size() + 1); diff --git a/src/ObjectDetector.h b/src/ObjectDetector.h index 5528d68..03973d6 100644 --- a/src/ObjectDetector.h +++ b/src/ObjectDetector.h @@ -168,6 +168,17 @@ class ObjectDetectorParams numThreads, type, enable, custom1, custom2, custom3, classNames); + /** + * @brief Default constructor. + */ + ObjectDetectorParams() = default; + + /** + * @brief Copy constructor. + * @param src Source object. + */ + ObjectDetectorParams(const ObjectDetectorParams& src) = default; + /** * @brief Copy operator. * @param src Source object. diff --git a/src/ObjectDetectorVersion.h b/src/ObjectDetectorVersion.h index f9bbcbe..b59f9dd 100644 --- a/src/ObjectDetectorVersion.h +++ b/src/ObjectDetectorVersion.h @@ -1,7 +1,7 @@ #pragma once #define OBJECT_DETECTOR_MAJOR_VERSION 1 -#define OBJECT_DETECTOR_MINOR_VERSION 7 -#define OBJECT_DETECTOR_PATCH_VERSION 3 +#define OBJECT_DETECTOR_MINOR_VERSION 8 +#define OBJECT_DETECTOR_PATCH_VERSION 0 -#define OBJECT_DETECTOR_VERSION "1.7.3" +#define OBJECT_DETECTOR_VERSION "1.8.0" diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index ace62ef..e2cf11b 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -44,3 +44,9 @@ endif() ## linking all dependencies ################################################################################ target_link_libraries(${PROJECT_NAME} ObjectDetector) + +if(MSVC) + target_compile_options(${PROJECT_NAME} PRIVATE /W4 /WX) +else() + target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Wpedantic -Werror) +endif() diff --git a/test/main.cpp b/test/main.cpp index d080f2f..2842536 100644 --- a/test/main.cpp +++ b/test/main.cpp @@ -1,3 +1,4 @@ +#include #include #include "ObjectDetector.h" @@ -36,42 +37,59 @@ int main(void) cout << "#####################################" << endl; cout << endl; + bool allPassed = true; + cout << "Copy test:" << endl; if (copyTest()) cout << "OK" << endl; else + { cout << "ERROR" << endl; + allPassed = false; + } cout << endl; cout << "Encode/Decode test:" << endl; if (encodeDecodeTest()) cout << "OK" << endl; else + { cout << "ERROR" << endl; + allPassed = false; + } cout << endl; cout << "Encode/Decode test with params mask:" << endl; if (encodeDecodeWithMaskTest()) cout << "OK" << endl; else + { cout << "ERROR" << endl; + allPassed = false; + } cout << endl; cout << "Encode/Decode commands test:" << endl; if (encodeDecodeCommandsTest()) cout << "OK" << endl; else + { cout << "ERROR" << endl; + allPassed = false; + } cout << endl; cout << "JSON read/write test:" << endl; if (jsonReadWriteTest()) cout << "OK" << endl; else + { cout << "ERROR" << endl; + allPassed = false; + } cout << endl; - return 1; + return allPassed ? 0 : 1; } @@ -243,7 +261,7 @@ bool copyTest() cout << "in.objects.size()" << endl; return false; } - for (int i = 0; i < in.objects.size(); ++i) + for (size_t i = 0; i < in.objects.size(); ++i) { if (in.objects[i].id != out.objects[i].id) { @@ -306,7 +324,7 @@ bool copyTest() cout << "in.classNames.size()" << endl; return false; } - for (int i = 0; i < in.classNames.size(); ++i) + for (size_t i = 0; i < in.classNames.size(); ++i) { if (in.classNames[i] != out.classNames[i]) { @@ -506,7 +524,7 @@ bool encodeDecodeTest() cout << "in.objects.size()" << endl; return false; } - for (int i = 0; i < in.objects.size(); ++i) + for (size_t i = 0; i < in.objects.size(); ++i) { if (in.objects[i].id != out.objects[i].id) { @@ -569,7 +587,7 @@ bool encodeDecodeTest() cout << "in.classNames.size()" << endl; return false; } - for (int i = 0; i < in.classNames.size(); ++i) + for (size_t i = 0; i < in.classNames.size(); ++i) { if (in.classNames[i] != out.classNames[i]) { @@ -827,7 +845,7 @@ bool jsonReadWriteTest() cout << "in.classNames.size()" << endl; return false; } - for (int i = 0; i < in.classNames.size(); ++i) + for (size_t i = 0; i < in.classNames.size(); ++i) { if (in.classNames[i] != out.classNames[i]) { @@ -1053,7 +1071,7 @@ bool encodeDecodeWithMaskTest() cout << "in.objects.size()" << endl; return false; } - for (int i = 0; i < in.objects.size(); ++i) + for (size_t i = 0; i < in.objects.size(); ++i) { if (in.objects[i].id != out.objects[i].id) { @@ -1111,7 +1129,7 @@ bool encodeDecodeWithMaskTest() cout << "in.classNames.size()" << endl; return false; } - for (int i = 0; i < in.classNames.size(); ++i) + for (size_t i = 0; i < in.classNames.size(); ++i) { if (in.classNames[i] != out.classNames[i]) {