This structure allows to implement serialization routines for custom types.
More...
#include <opencv2/gapi/s11n/base.hpp>
template<typename T>
struct cv::gapi::s11n::detail::S11N< T >
This structure allows to implement serialization routines for custom types.
The default S11N for custom types is not implemented.
- Note
- When providing an overloaded implementation for S11N with your type don't inherit it from NotImplemented structure.
-
There are lots of overloaded >> and << operators for basic and OpenCV/G-API types which can be utilized when serializing a custom type.
Example of usage:
namespace gapi {
namespace s11n {
namespace detail {
template<>
struct S11N<SimpleCustomType> {
os << p.val;
}
SimpleCustomType p;
is >> p.val;
return p;
}
};
template<> struct S11N<SimpleCustomType2> {
static void serialize(IOStream &os,
const SimpleCustomType2 &p) {
os << p.val << p.name << p.vec << p.mmap;
}
SimpleCustomType2 p;
is >> p.val >> p.name >> p.vec >> p.mmap;
return p;
}
};
}
}
}
}
"black box" representation of the file storage associated with a file on disk.
Definition: core.hpp:106
This structure is an interface for deserialization routines.
Definition: s11n.hpp:199
This structure is an interface for serialization routines.
Definition: s11n.hpp:173
This structure allows to implement serialization routines for custom types.
Definition: base.hpp:47
static T deserialize(IIStream &)
This function allows user to deserialize their custom type.
Definition: base.hpp:63
static void serialize(IOStream &, const T &)
This function allows user to serialize their custom type.
Definition: base.hpp:54
◆ deserialize()
This function allows user to deserialize their custom type.
- Note
- The default overload throws an exception if called. User need to properly overload the function to use it.
◆ serialize()
This function allows user to serialize their custom type.
- Note
- The default overload throws an exception if called. User need to properly overload the function to use it.
The documentation for this struct was generated from the following file: