Merge pull request #18496 from AsyaPronina:comp_args_serialization
Serialization && deserialization for compile arguments * Initial stub * Add test on serialization of a custom type * Namespaces rework * Fix isSupported in test struct * Fix clang lookup issue * Initial implementation * Drop the isSupported flag * Initial implementation * Removed internal header inclusion * Switched to public API * Implemented serialization * Adding desirialize: WIP * Fixed merge errors * Implemented * Final polishing * Addressed review comments and added debug throw * Added FluidROI test * Polishing * Polishing * Polishing * Polishing * Polishing * Updated CMakeLists.txt * Fixed comments * Addressed review comments * Removed decay from deserialize_arg * Addressed review comments * Removed extra inclusion * Fixed Win64 warning * Update gcommon.hpp * Update serialization.cpp * Update gcommon.hpp * gapi: drop GAPI_EXPORTS_W_SIMPLE from GCompileArg Co-authored-by: Smirnov Alexey <alexey.smirnov@intel.com> Co-authored-by: AsyaPronina <155jj@mail.ru>
This commit is contained in:
committed by
GitHub
parent
46ccde82cf
commit
af2f8c69f0
@@ -21,7 +21,7 @@ namespace opencv_test
|
||||
{
|
||||
std::string method;
|
||||
};
|
||||
}
|
||||
} // namespace opencv_test
|
||||
|
||||
namespace cv
|
||||
{
|
||||
@@ -31,11 +31,11 @@ namespace cv
|
||||
{
|
||||
static const char* tag()
|
||||
{
|
||||
return "org.opencv.test..background_substractor_state_params";
|
||||
return "org.opencv.test.background_substractor_state_params";
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
} // namespace detail
|
||||
} // namespace cv
|
||||
|
||||
namespace opencv_test
|
||||
{
|
||||
|
||||
@@ -34,6 +34,17 @@ namespace detail {
|
||||
} // namespace gapi
|
||||
} // namespace cv
|
||||
|
||||
|
||||
namespace cv {
|
||||
namespace detail {
|
||||
template<> struct CompileArgTag<MyCustomType> {
|
||||
static const char* tag() {
|
||||
return "org.opencv.test.mycustomtype";
|
||||
}
|
||||
};
|
||||
} // namespace detail
|
||||
} // namespace cv
|
||||
|
||||
namespace opencv_test {
|
||||
|
||||
struct S11N_Basic: public ::testing::Test {
|
||||
@@ -511,4 +522,15 @@ TEST_F(S11N_Basic, Test_Custom_Type) {
|
||||
MyCustomType new_var = cv::gapi::s11n::detail::S11N<MyCustomType>::deserialize(is);
|
||||
EXPECT_EQ(var, new_var);
|
||||
}
|
||||
|
||||
TEST_F(S11N_Basic, Test_Custom_CompileArg) {
|
||||
MyCustomType customVar{1248, "World", {1280, 720, 640, 480}, {{5, 32434142342}, {7, 34242432}}};
|
||||
|
||||
std::vector<char> sArgs = cv::gapi::serialize(cv::compile_args(customVar));
|
||||
|
||||
GCompileArgs dArgs = cv::gapi::deserialize<GCompileArgs, MyCustomType>(sArgs);
|
||||
|
||||
MyCustomType dCustomVar = cv::gapi::getCompileArg<MyCustomType>(dArgs).value();
|
||||
EXPECT_EQ(customVar, dCustomVar);
|
||||
}
|
||||
} // namespace opencv_test
|
||||
|
||||
Reference in New Issue
Block a user