From c05b82a2c50042ec1dfe2969f027d8df12c813e9 Mon Sep 17 00:00:00 2001 From: vdeo Date: Thu, 7 Nov 2024 16:55:20 -1000 Subject: [PATCH] pyFps.hpp more generic add_entry --- CMakeLists.txt | 2 +- python_module/pyFps.hpp | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2c53ece0..32f10174 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -208,7 +208,7 @@ set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) # ADD SOURCE DIRECTORIES # recursively add libraries to be compiled -execute_process(COMMAND bash -c "find ${PROJECT_SOURCE_DIR}/plugins -mindepth 2 -maxdepth 2 -type d| grep -v .git| grep -v .vscode" +execute_process(COMMAND bash -c "find ${PROJECT_SOURCE_DIR}/plugins -mindepth 2 -maxdepth 2 -type d | grep -v .git | grep -v .vscode" OUTPUT_VARIABLE libextradir) string(REGEX REPLACE "\n" "; " libextradir "${libextradir}") diff --git a/python_module/pyFps.hpp b/python_module/pyFps.hpp index 8c3420c8..c764ea4d 100644 --- a/python_module/pyFps.hpp +++ b/python_module/pyFps.hpp @@ -58,6 +58,15 @@ enum FPS_type : uint32_t FPSNAME = FPTYPE_FPSNAME, }; +enum FPS_flags : uint64_t +{ + // There are many more + DEFAULT_INPUT = FPFLAG_DEFAULT_INPUT, + DEFAULT_OUTPUT = FPFLAG_DEFAULT_OUTPUT, + DEFAULT_INPUT_STREAM = FPFLAG_DEFAULT_INPUT_STREAM, + DEFAULT_OUTPUT_STREAM = FPFLAG_DEFAULT_OUTPUT_STREAM, +}; + class pyFps { std::string name_; @@ -217,6 +226,26 @@ class pyFps FPFLAG_DEFAULT_INPUT, nullptr, nullptr); } + /** + * @brief Add parameter to database with generic settings + * + * If entry already exists, do not modify it + * + * @param entry_name : entry name + * @param entry_desc : entry description + * @param fptype : entry type ("int","double","float","string") + * @param fpflag : entry flags + * @return int + */ + int add_entry_w_flags(std::string entry_name, std::string entry_desc, + uint32_t fptype, uint64_t fpflag) + { + keys_[entry_name] = static_cast(fptype); + return function_parameter_add_entry(&fps_, entry_name.c_str(), + entry_desc.c_str(), fptype, + fpflag, nullptr, nullptr); + } + /** * @brief Get the status object *