| Face Engine SDK 5.32.0 A face detection, recognition and tracking engine.

IObject.h
Go to the documentation of this file.
1
8 #pragma once
9
10 #include <fsdk/IRefCounted.h>
11 #include <fsdk/Types.h>
12
13 namespace fsdk {
14
21 struct ISettingsProvider;
22
38 struct IArchive {
39
46 virtual bool write(const void* data, size_t size) = 0;
47
54 virtual bool read(void* data, size_t size) = 0;
55
60 virtual void setSizeHint(size_t hint) {
61 ((void)hint);
62 }
63
64 virtual ~IArchive() = default;
65 };
66
71 struct ISerializableObject : IRefCounted {
72
76 enum class Error : uint32_t {
77 Ok,
78 Size,
79 Signature,
80 ArchiveRead,
81 InputArchive,
82 ArchiveWrite,
83 };
84
91 enum Flags {
92
94 Default = 0,
95
103 NoSignature = 1
104 };
105
111 virtual void getSize(Sizer& sizer, uint32_t flags = Default) const noexcept = 0;
112
121 virtual Result<Error> load(IArchive* archive, uint32_t flags = Default) = 0;
122
131 virtual Result<Error> save(IArchive* archive, uint32_t flags = Default) const = 0;
132 };
133
137 template <>
138 struct ErrorTraits<ISerializableObject::Error> {
139
140 static bool isOk(ISerializableObject::Error error) noexcept {
141 return error == ISerializableObject::Error::Ok;
142 }
143
144 static const char* toString(ISerializableObject::Error error) noexcept {
145 switch(error) {
146 case ISerializableObject::Error::Ok:
147 return "Ok";
148 case ISerializableObject::Error::Size:
149 return "Size error";
150 case ISerializableObject::Error::Signature:
151 return "Signature error";
152 case ISerializableObject::Error::ArchiveRead:
153 return "Error during archive reading";
154 case ISerializableObject::Error::InputArchive:
155 return "Input archive is nullptr";
156 case ISerializableObject::Error::ArchiveWrite:
157 return "Error during archive writing";
158 default:
159 return "Unknown error";
160 }
161 }
162 };
163
167 struct IDataStorageObject : ISerializableObject {
168
174 virtual void clear() noexcept = 0;
175
183 virtual IRefCounted* getParentObject() const noexcept = 0;
184 };
185
187 } // namespace fsdk
fsdk::ISerializableObject::Error::ArchiveWrite
Error during archive writing,.
fsdk::IArchive::write
virtual bool write(const void *data, size_t size)=0
Write bytes to archive.
fsdk::ISerializableObject::save
virtual Result< Error > save(IArchive *archive, uint32_t flags=Default) const =0
Save object to archive.
fsdk
SDK namespace.
Definition: IAGSEstimator.h:8
fsdk::ISerializableObject::Error::InputArchive
Input archive is nullptr.
fsdk::Result
A structure that encapsulates an action result enumeration.
Definition: Result.h:27
Types.h
Common data types and structures.
fsdk::ISerializableObject::Error::Ok
Ok.
fsdk::ISerializableObject::load
virtual Result< Error > load(IArchive *archive, uint32_t flags=Default)=0
Load object from archive.
fsdk::ISerializableObject::Error::ArchiveRead
Error during archive reading,.
fsdk::ISerializableObject
Serializable object interface.
Definition: IObject.h:71
fsdk::ErrorTraits
Definition: Result.h:8
fsdk::IRefCounted
Base strong reference counted object interface.
Definition: IRefCounted.h:37
fsdk::ISerializableObject::getSize
virtual void getSize(Sizer &sizer, uint32_t flags=Default) const noexcept=0
Estimate size of this object binary data.
fsdk::ISerializableObject::Error::Signature
Invalid signature.
fsdk::ISerializableObject::Default
Default serialization mode.
Definition: IObject.h:94
fsdk::IArchive::setSizeHint
virtual void setSizeHint(size_t hint)
Set size hint.
Definition: IObject.h:60
fsdk::ISerializableObject::Error
Error
Serialization nerror codes.
Definition: IObject.h:76
fsdk::ISerializableObject::Flags
Flags
Serialization flags.
Definition: IObject.h:91
fsdk::ISerializableObject::NoSignature
Omit object signature.
Definition: IObject.h:103
fsdk::IDataStorageObject::getParentObject
virtual IRefCounted * getParentObject() const noexcept=0
Get parent object (one that has created this).
fsdk::IDataStorageObject
Data storage object interface helper.
Definition: IObject.h:167
fsdk::IDataStorageObject::clear
virtual void clear() noexcept=0
Clear object data.
fsdk::IArchive
Archive interface.
Definition: IObject.h:38
fsdk::IArchive::read
virtual bool read(void *data, size_t size)=0
Read bytes from archive.
fsdk::ISerializableObject::Error::Size
Not enough space.
fsdk::Sizer
Helper entity to measure size of dynamic objects in memory.
Definition: Sizer.h:9
IRefCounted.h
Reference counted object interface.