12#include "enrollment/Export.h"
40 const std::vector<std::shared_ptr<PrintTemplate>>& templates)
42 std::vector<std::shared_ptr<ICSTemplate>> icsTemplates(templates.size());
43 std::transform(templates.begin(),
46 [](
const auto& pt) { return pt != nullptr ? pt->GetICSRepresentation() : nullptr; });
60 const std::vector<std::shared_ptr<PrintTemplate>>& templates)
62 std::vector<std::shared_ptr<EmbeddingTemplate>> embeddings(templates.size());
63 std::transform(templates.begin(),
66 [](
const auto& pt) { return pt != nullptr ? pt->GetEmbeddingRepresentation() : nullptr; });
123 writer.Write(
"ics", t);
124 writer.Write(
"e", e);
136 explicit PrintTemplate(std::shared_ptr<ICSTemplate> icsTemplate)
137 : t(std::move(icsTemplate))
158 PrintTemplate(std::shared_ptr<ICSTemplate> icsTemplate, std::shared_ptr<EmbeddingTemplate> embedding)
159 : t(std::move(icsTemplate))
160 , e(std::move(embedding))
171 if (!ArePositionsSame(t, e))
186 explicit PrintTemplate(std::shared_ptr<EmbeddingTemplate> embedding)
188 , e(std::move(embedding))
196 [[nodiscard]]
bool operator==(
const PrintTemplate& other)
const noexcept
198 auto icsEqual = (t ==
nullptr && other.t ==
nullptr) ||
199 (t !=
nullptr && other.t !=
nullptr && t->icsTemplateData == other.t->icsTemplateData);
200 auto embEqual = (e ==
nullptr && other.e ==
nullptr) ||
201 (e !=
nullptr && other.e !=
nullptr &&
202 e->embeddingTemplateData == other.e->embeddingTemplateData);
203 return icsEqual && embEqual;
206 [[nodiscard]] std::size_t Hash() const noexcept
208 std::size_t h = t !=
nullptr ? detail::HashBytes(t->icsTemplateData) : 0U;
209 h = detail::HashCombine(h, e !=
nullptr ? detail::HashBytes(e->embeddingTemplateData) : 0U);
213 PrintTemplate() =
delete;
214 virtual ~PrintTemplate() =
default;
215 PrintTemplate(
const PrintTemplate& ap) =
default;
216 PrintTemplate(PrintTemplate&& ap) =
default;
217 PrintTemplate& operator=(
const PrintTemplate& ap) =
default;
218 PrintTemplate& operator=(PrintTemplate&& ap) =
default;
221 std::shared_ptr<ICSTemplate> t;
222 std::shared_ptr<EmbeddingTemplate> e;
224 static bool ArePositionsSame(
const std::shared_ptr<ICSTemplate>& i,
const std::shared_ptr<EmbeddingTemplate>& e)
226 if (!i->IsICSTemplateBiometricPositionKnown() || !e->IsEmbeddingTemplateBiometricPositionKnown())
230 return i->IsICSTemplateBiometricPositionKnown() == e->IsEmbeddingTemplateBiometricPositionKnown();
233 if (i->GetICSTemplateBiometricPosition() == e->GetEmbeddingTemplateBiometricPosition())
Base exception for all enrollment-sdk invalid argument exceptions.
Definition EnrollmentException.h:96
Null argument is not allowed.
Definition EnrollmentException.h:156
Holds various biometric representation types for print.
Definition PrintTemplate.h:26
void WriteTo(Writer &writer) const final
It serializes applicant print via provided Writer.
Definition PrintTemplate.h:120
PrintTemplate(std::shared_ptr< ICSTemplate > icsTemplate, std::shared_ptr< EmbeddingTemplate > embedding)
Constructs an PrintTemplate object with the provided ICSTemplate and embedding.
Definition PrintTemplate.h:157
bool HasEmbeddingRepresentation() const
Checks if the object has an embedding representation.
Definition PrintTemplate.h:111
bool HasIcsRepresentation() const
Checks if the object has an ICS representation.
Definition PrintTemplate.h:98
PrintTemplate(std::shared_ptr< ICSTemplate > icsTemplate)
Constructs an PrintTemplate object with the provided ICSTemplate.
Definition PrintTemplate.h:135
static std::vector< std::shared_ptr< EmbeddingTemplate > > ToEmbeddingTemplates(const std::vector< std::shared_ptr< PrintTemplate > > &templates)
Converts a PrintTemplate objects into an EmbeddingTemplate objects.
Definition PrintTemplate.h:58
static std::vector< std::shared_ptr< ICSTemplate > > ToICSTemplates(const std::vector< std::shared_ptr< PrintTemplate > > &templates)
Converts a PrintTemplate objects into a ICSTemplate objects.
Definition PrintTemplate.h:38
std::shared_ptr< ICSTemplate > GetICSRepresentation() const
Provides ICS (Innovatrics proprietary extracted template) representation of print.
Definition PrintTemplate.h:72
std::shared_ptr< EmbeddingTemplate > GetEmbeddingRepresentation() const
Retrieves the embedding representation associated with the object.
Definition PrintTemplate.h:85
PrintTemplate(std::shared_ptr< EmbeddingTemplate > embedding)
Constructs an PrintTemplate object with the provided embedding.
Definition PrintTemplate.h:185
Provides interface for serialization of all classes.
Definition Writer.h:164