15
15
16
16
#include " compiler/gmodel.hpp"
17
17
18
+ #if (defined _WIN32 || defined _WIN64) && defined _MSC_VER
19
+ #pragma warning(disable: 4702)
20
+ #endif
21
+
18
22
namespace cv {
19
23
namespace gimpl {
20
24
namespace s11n {
@@ -85,6 +89,8 @@ GAPI_EXPORTS I::IStream& operator>> (I::IStream& is, cv::Scalar &s);
85
89
GAPI_EXPORTS I::OStream& operator << (I::OStream& os, const cv::Mat &m);
86
90
GAPI_EXPORTS I::IStream& operator >> (I::IStream& is, cv::Mat &m);
87
91
92
+
93
+
88
94
// G-API types /////////////////////////////////////////////////////////////////
89
95
90
96
GAPI_EXPORTS I::OStream& operator << (I::OStream& os, cv::util::monostate );
@@ -111,6 +117,11 @@ GAPI_EXPORTS I::IStream& operator>> (I::IStream& is, cv::gimpl::Protocol &
111
117
GAPI_EXPORTS I::OStream& operator << (I::OStream& os, const cv::GArg &arg);
112
118
GAPI_EXPORTS I::IStream& operator >> (I::IStream& is, cv::GArg &arg);
113
119
120
+ // Forward declaration
121
+ // I::OStream& operator<< (I::OStream& os, const cv::GRunArg &arg);
122
+ // I::IStream& operator>> (I::IStream& is, cv::GRunArg &arg);
123
+
124
+
114
125
GAPI_EXPORTS I::OStream& operator << (I::OStream& os, const cv::GKernel &k);
115
126
GAPI_EXPORTS I::IStream& operator >> (I::IStream& is, cv::GKernel &k);
116
127
@@ -126,6 +137,20 @@ GAPI_EXPORTS I::IStream& operator>> (I::IStream& is, cv::GOpaqueDesc &);
126
137
GAPI_EXPORTS I::OStream& operator << (I::OStream& os, const cv::GArrayDesc &);
127
138
GAPI_EXPORTS I::IStream& operator >> (I::IStream& is, cv::GArrayDesc &);
128
139
140
+ #if !defined(GAPI_STANDALONE)
141
+ GAPI_EXPORTS I::OStream& operator << (I::OStream& os, const cv::UMat &);
142
+ GAPI_EXPORTS I::IStream& operator >> (I::IStream& is, cv::UMat &);
143
+ #endif // !defined(GAPI_STANDALONE)
144
+
145
+ GAPI_EXPORTS I::OStream& operator << (I::OStream& os, const cv::gapi::wip::IStreamSource::Ptr &);
146
+ GAPI_EXPORTS I::IStream& operator >> (I::IStream& is, cv::gapi::wip::IStreamSource::Ptr &);
147
+
148
+ GAPI_EXPORTS I::OStream& operator << (I::OStream& os, const cv::detail::VectorRef &);
149
+ GAPI_EXPORTS I::IStream& operator >> (I::IStream& is, cv::detail::VectorRef &);
150
+
151
+ GAPI_EXPORTS I::OStream& operator << (I::OStream& os, const cv::detail::OpaqueRef &);
152
+ GAPI_EXPORTS I::IStream& operator >> (I::IStream& is, cv::detail::OpaqueRef &);
153
+
129
154
GAPI_EXPORTS I::OStream& operator << (I::OStream& os, const cv::gimpl::RcDesc &rc);
130
155
GAPI_EXPORTS I::IStream& operator >> (I::IStream& is, cv::gimpl::RcDesc &rc);
131
156
@@ -163,31 +188,6 @@ GAPI_EXPORTS GSerialized deserialize(I::IStream& is);
163
188
GAPI_EXPORTS void reconstruct (const GSerialized &s, ade::Graph &g);
164
189
165
190
// Legacy //////////////////////////////////////////////////////////////////////
166
-
167
-
168
- // Generic: vector serialization ///////////////////////////////////////////////
169
- template <typename T>
170
- I::OStream& operator << (I::OStream& os, const std::vector<T> &ts) {
171
- // const std::size_t sz = ts.size(); // explicitly specify type
172
- const uint32_t sz = (uint32_t )ts.size (); // explicitly specify type
173
- os << sz;
174
- for (auto &&v : ts) os << v;
175
- return os;
176
- }
177
- template <typename T>
178
- I::IStream& operator >> (I::IStream& is, std::vector<T> &ts) {
179
- // std::size_t sz = 0u;
180
- uint32_t sz = 0u ;
181
- is >> sz;
182
- if (sz == 0u ) {
183
- ts.clear ();
184
- } else {
185
- ts.resize (sz);
186
- for (auto &&i : ade::util::iota (sz)) is >> ts[i];
187
- }
188
- return is;
189
- }
190
-
191
191
// Generic: unordered_map serialization ////////////////////////////////////////
192
192
template <typename K, typename V>
193
193
I::OStream& operator << (I::OStream& os, const std::unordered_map<K, V> &m) {
@@ -256,6 +256,32 @@ I::IStream& operator>> (I::IStream& is, cv::util::variant<Ts...> &v) {
256
256
return detail::get_v<cv::util::variant<Ts...>, Ts...>(is, v, 0u , idx);
257
257
}
258
258
259
+ // Generic: vector serialization ///////////////////////////////////////////////
260
+ // Moved here to fix CLang issues https://clang.llvm.org/compatibility.html
261
+ // Unqualified lookup in templates
262
+ template <typename T>
263
+ I::OStream& operator << (I::OStream& os, const std::vector<T> &ts) {
264
+ // const std::size_t sz = ts.size(); // explicitly specify type
265
+ const uint32_t sz = (uint32_t )ts.size (); // explicitly specify type
266
+ os << sz;
267
+ for (auto &&v : ts) os << v;
268
+ return os;
269
+ }
270
+ template <typename T>
271
+ I::IStream& operator >> (I::IStream& is, std::vector<T> &ts) {
272
+ // std::size_t sz = 0u;
273
+ uint32_t sz = 0u ;
274
+ is >> sz;
275
+ if (sz == 0u ) {
276
+ ts.clear ();
277
+ }
278
+ else {
279
+ ts.resize (sz);
280
+ for (auto &&i : ade::util::iota (sz)) is >> ts[i];
281
+ }
282
+ return is;
283
+ }
284
+
259
285
// FIXME: Basic Stream implementaions //////////////////////////////////////////
260
286
261
287
// Basic in-memory stream implementations.
@@ -305,6 +331,10 @@ class GAPI_EXPORTS ByteMemoryInStream final: public I::IStream {
305
331
virtual I::IStream& operator >> (std::string &) override ;
306
332
};
307
333
334
+ GAPI_EXPORTS void serialize (I::OStream& os, const cv::GMetaArgs &ma);
335
+ GAPI_EXPORTS void serialize (I::OStream& os, const cv::GRunArgs &ra);
336
+ GAPI_EXPORTS GMetaArgs meta_args_deserialize (I::IStream& is);
337
+ GAPI_EXPORTS GRunArgs run_args_deserialize (I::IStream& is);
308
338
309
339
} // namespace s11n
310
340
} // namespace gimpl
0 commit comments