Add add-ons enum type
This commit is contained in:
parent
8b21989dcc
commit
2e31a79b1a
|
@ -165,6 +165,19 @@ enum class Source : std::uint8_t {
|
||||||
LAST
|
LAST
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ingroup enumerations
|
||||||
|
* @brief Add-Ons are peripheral modules of our hardware.
|
||||||
|
*/
|
||||||
|
enum class AddOns : std::uint8_t {
|
||||||
|
/** Infrared */
|
||||||
|
INFRARED,
|
||||||
|
/** Second infrared */
|
||||||
|
INFRARED2,
|
||||||
|
/** Last guard */
|
||||||
|
LAST
|
||||||
|
};
|
||||||
|
|
||||||
#define MYNTEYE_ENUM_HELPERS(TYPE) \
|
#define MYNTEYE_ENUM_HELPERS(TYPE) \
|
||||||
MYNTEYE_API const char *to_string(const TYPE &value); \
|
MYNTEYE_API const char *to_string(const TYPE &value); \
|
||||||
inline bool is_valid(const TYPE &value) { \
|
inline bool is_valid(const TYPE &value) { \
|
||||||
|
@ -187,6 +200,7 @@ MYNTEYE_ENUM_HELPERS(Capabilities)
|
||||||
MYNTEYE_ENUM_HELPERS(Info)
|
MYNTEYE_ENUM_HELPERS(Info)
|
||||||
MYNTEYE_ENUM_HELPERS(Option)
|
MYNTEYE_ENUM_HELPERS(Option)
|
||||||
MYNTEYE_ENUM_HELPERS(Source)
|
MYNTEYE_ENUM_HELPERS(Source)
|
||||||
|
MYNTEYE_ENUM_HELPERS(AddOns)
|
||||||
|
|
||||||
#undef MYNTEYE_ENUM_HELPERS
|
#undef MYNTEYE_ENUM_HELPERS
|
||||||
|
|
||||||
|
|
|
@ -122,6 +122,19 @@ const char *to_string(const Source &value) {
|
||||||
#undef CASE
|
#undef CASE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *to_string(const AddOns &value) {
|
||||||
|
#define CASE(X) \
|
||||||
|
case AddOns::X: \
|
||||||
|
return "AddOns::" #X;
|
||||||
|
switch (value) {
|
||||||
|
CASE(INFRARED)
|
||||||
|
CASE(INFRARED2)
|
||||||
|
default:
|
||||||
|
return "AddOns::UNKNOWN";
|
||||||
|
}
|
||||||
|
#undef CASE
|
||||||
|
}
|
||||||
|
|
||||||
const char *to_string(const Format &value) {
|
const char *to_string(const Format &value) {
|
||||||
#define CASE(X) \
|
#define CASE(X) \
|
||||||
case Format::X: \
|
case Format::X: \
|
||||||
|
|
|
@ -52,6 +52,9 @@ message(STATUS "Found mynteye: ${mynteye_VERSION}")
|
||||||
|
|
||||||
LIST(APPEND CMAKE_MODULE_PATH ${PRO_DIR}/cmake)
|
LIST(APPEND CMAKE_MODULE_PATH ${PRO_DIR}/cmake)
|
||||||
|
|
||||||
|
find_package(OpenCV REQUIRED)
|
||||||
|
message(STATUS "Found OpenCV: ${OpenCV_VERSION}")
|
||||||
|
|
||||||
## gtest
|
## gtest
|
||||||
|
|
||||||
set(TEST_DIR ${PROJECT_SOURCE_DIR})
|
set(TEST_DIR ${PROJECT_SOURCE_DIR})
|
||||||
|
@ -93,9 +96,10 @@ add_executable(${PROJECT_NAME}
|
||||||
${TEST_INTERNAL_SRC}
|
${TEST_INTERNAL_SRC}
|
||||||
${TEST_PUBLIC_SRC}
|
${TEST_PUBLIC_SRC}
|
||||||
)
|
)
|
||||||
target_link_libraries(${PROJECT_NAME} ${GTEST_LIBS} mynteye)
|
target_link_libraries(${PROJECT_NAME} mynteye ${GTEST_LIBS} ${OpenCV_LIBS})
|
||||||
target_create_scripts(${PROJECT_NAME} DLL_SEARCH_PATHS
|
target_create_scripts(${PROJECT_NAME} DLL_SEARCH_PATHS
|
||||||
${PRO_DIR}/_install/bin
|
${PRO_DIR}/_install/bin
|
||||||
|
${OpenCV_LIB_SEARCH_PATH}
|
||||||
)
|
)
|
||||||
|
|
||||||
if(OS_WIN)
|
if(OS_WIN)
|
||||||
|
|
|
@ -68,6 +68,11 @@ TEST(Source, VerifyToString) {
|
||||||
EXPECT_STREQ("Source::ALL", to_string(Source::ALL));
|
EXPECT_STREQ("Source::ALL", to_string(Source::ALL));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(AddOns, VerifyToString) {
|
||||||
|
EXPECT_STREQ("AddOns::INFRARED", to_string(AddOns::INFRARED));
|
||||||
|
EXPECT_STREQ("AddOns::INFRARED2", to_string(AddOns::INFRARED2));
|
||||||
|
}
|
||||||
|
|
||||||
TEST(Format, VerifyToString) {
|
TEST(Format, VerifyToString) {
|
||||||
EXPECT_STREQ("Format::GREY", to_string(Format::GREY));
|
EXPECT_STREQ("Format::GREY", to_string(Format::GREY));
|
||||||
EXPECT_STREQ("Format::YUYV", to_string(Format::YUYV));
|
EXPECT_STREQ("Format::YUYV", to_string(Format::YUYV));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user