Merge pull request #18452 from smirnov-alexey:as/export_serialization_api

[G-API] Export a part of serialization interface

* Initial stub

* Add test on serialization of a custom type

* Namespaces rework

* Fix isSupported in test struct

* Fix clang build and rework namespaces

* Remove redundant header
This commit is contained in:
Alexey Smirnov
2020-10-01 21:11:23 +03:00
committed by GitHub
parent 40b8b58bc6
commit a3e7c2d8e3
9 changed files with 442 additions and 401 deletions
+4 -4
View File
@@ -73,18 +73,18 @@ cv::GComputation::GComputation(cv::GProtoInputArgs &&ins,
};
}
cv::GComputation::GComputation(cv::gimpl::s11n::I::IStream &is)
cv::GComputation::GComputation(cv::gapi::s11n::IIStream &is)
: m_priv(new Priv())
{
m_priv->m_shape = gimpl::s11n::deserialize(is);
m_priv->m_shape = gapi::s11n::deserialize(is);
}
void cv::GComputation::serialize(cv::gimpl::s11n::I::OStream &os) const
void cv::GComputation::serialize(cv::gapi::s11n::IOStream &os) const
{
// Build a basic GModel and write the whole thing to the stream
auto pG = cv::gimpl::GCompiler::makeGraph(*m_priv);
std::vector<ade::NodeHandle> nhs(pG->nodes().begin(), pG->nodes().end());
gimpl::s11n::serialize(os, *pG, nhs);
gapi::s11n::serialize(os, *pG, nhs);
}
+1 -1
View File
@@ -29,7 +29,7 @@ public:
cv::GProtoArgs m_outs;
};
using Dump = cv::gimpl::s11n::GSerialized;
using Dump = cv::gapi::s11n::GSerialized;
using Shape = cv::util::variant
< Expr // An expression-based graph
+6 -6
View File
@@ -10,36 +10,36 @@
#include "backends/common/serialization.hpp"
std::vector<char> cv::gapi::serialize(const cv::GComputation &c) {
cv::gimpl::s11n::ByteMemoryOutStream os;
cv::gapi::s11n::ByteMemoryOutStream os;
c.serialize(os);
return os.data();
}
cv::GComputation cv::gapi::detail::getGraph(const std::vector<char> &p) {
cv::gimpl::s11n::ByteMemoryInStream is(p);
cv::gapi::s11n::ByteMemoryInStream is(p);
return cv::GComputation(is);
}
cv::GMetaArgs cv::gapi::detail::getMetaArgs(const std::vector<char> &p) {
cv::gimpl::s11n::ByteMemoryInStream is(p);
cv::gapi::s11n::ByteMemoryInStream is(p);
return meta_args_deserialize(is);
}
cv::GRunArgs cv::gapi::detail::getRunArgs(const std::vector<char> &p) {
cv::gimpl::s11n::ByteMemoryInStream is(p);
cv::gapi::s11n::ByteMemoryInStream is(p);
return run_args_deserialize(is);
}
std::vector<char> cv::gapi::serialize(const cv::GMetaArgs& ma)
{
cv::gimpl::s11n::ByteMemoryOutStream os;
cv::gapi::s11n::ByteMemoryOutStream os;
serialize(os, ma);
return os.data();
}
std::vector<char> cv::gapi::serialize(const cv::GRunArgs& ra)
{
cv::gimpl::s11n::ByteMemoryOutStream os;
cv::gapi::s11n::ByteMemoryOutStream os;
serialize(os, ra);
return os.data();
}