Face Engine SDK 5.25.0
A face detection, recognition and tracking engine.
Loading...
Searching...
No Matches
fsdk::IDescriptorBatch Struct Referenceabstract

Descriptor batch interface. More...

#include <IDescriptor.h>

Inheritance diagram for fsdk::IDescriptorBatch:
fsdk::IDataStorageObject fsdk::ISerializableObject fsdk::IRefCounted

Public Types

enum class  Error : uint32_t {
  Ok , InvalidInput , BatchFull , Incompatible ,
  Internal , IoError , OutOfRange
}
 Descriptor batch error enumeration. More...
 
- Public Types inherited from fsdk::ISerializableObject
enum class  Error : uint32_t {
  Ok , Size , Signature , ArchiveRead ,
  InputArchive , ArchiveWrite
}
 Serialization nerror codes. More...
 
enum  Flags { Default = 0 , NoSignature = 1 }
 Serialization flags. More...
 

Public Member Functions

virtual Result< Erroradd (IDescriptor *descriptor) noexcept=0
 Add a descriptor to the batch.
 
virtual Result< Erroradd (IDescriptorBatch *batch, uint32_t offset=0) noexcept=0
 Add a given descriptor batch content to the current batch. Descriptors to copy from the source batch are selected based on offset parameter.
 
virtual Result< Erroradd (IDescriptorBatch *batch, uint32_t offset, uint32_t count) noexcept=0
 Add a descriptor batch content to the batch. Descriptors to copy from the source bath are selected based on count and offset parameters.
 
virtual Result< ErrorremoveFast (uint32_t index) noexcept=0
 Remove a descriptor from batch.
 
virtual Result< ErrorremoveSlow (uint32_t index) noexcept=0
 Remove a descriptor from batch.
 
virtual Result< MultiError< ISerializableObject::Error, Error > > loadAndAdd (IArchive *archive)=0
 Load a descriptor/descriptors from archive and add it to the batch.
 
virtual uint32_t getMaxCount () const noexcept=0
 Get maximum number of descriptors in this batch.
 
virtual uint32_t getCount () const noexcept=0
 Get actual number of descriptors in this batch.
 
virtual uint32_t getModelVersion () const noexcept=0
 Get algorithm model version the descriptors in this batch were created with.
 
virtual DescriptorType getDescriptorType () const noexcept=0
 Get type of descriptor.
 
virtual uint32_t getDescriptorLength () const noexcept=0
 Get length of one descriptor. Specified by version of descriptors in batch.
 
virtual ResultValue< FSDKError, IDescriptorPtr > getDescriptorSlow (uint32_t index) const noexcept=0
 Get descriptor from batch by index with copying.
 
virtual ResultValue< FSDKError, IDescriptorPtr > getDescriptorFast (uint32_t index) noexcept=0
 Get descriptor from batch by index without copying.
 
- Public Member Functions inherited from fsdk::IDataStorageObject
virtual void clear () noexcept=0
 Clear object data.
 
virtual IRefCountedgetParentObject () const noexcept=0
 Get parent object (one that has created this).
 
- Public Member Functions inherited from fsdk::ISerializableObject
virtual void getSize (Sizer &sizer, uint32_t flags=Default) const noexcept=0
 Estimate size of this object binary data.
 
virtual Result< Errorload (IArchive *archive, uint32_t flags=Default)=0
 Load object from archive.
 
virtual Result< Errorsave (IArchive *archive, uint32_t flags=Default) const =0
 Save object to archive.
 
- Public Member Functions inherited from fsdk::IRefCounted
virtual int32_t retain () noexcept=0
 Increase strong reference count.
 
virtual int32_t retainLocked () noexcept=0
 Increase strong reference count thread safely.
 
virtual int32_t release () noexcept=0
 Decrease strong reference count.
 
virtual int32_t getRefCount () const noexcept=0
 Get actual strong reference count.
 
virtual int32_t retainWeak () noexcept=0
 Increase weak reference count.
 
virtual int32_t releaseWeak () noexcept=0
 Decrease weak reference count.
 
virtual int32_t getWeakRefCount () const noexcept=0
 Get actual weak reference count.
 

Detailed Description

Descriptor batch interface.

Used for matching large continous sets of descriptors.

A batch is created with a reserved memory for descriptors that can not be later extended. Thus descriptors can be add()'ed until the memory reservation is exceeded.

Memory reservation size can be obtained via getMaxCount() function. The batch me be reset via clear() function. It does not deallocate memory reservation. Instead, it resets internal counter allowing to re-populate the batch via add() again.

Member Enumeration Documentation

◆ Error

enum class fsdk::IDescriptorBatch::Error : uint32_t
strong

Descriptor batch error enumeration.

Used for descriptor batch related errors indication.

Enumerator
Ok 

No error.

InvalidInput 

Invalid input (Ex: null pointer while a valid object is expected).

BatchFull 

Batch is full.

Incompatible 

Trying to add an incompatible descriptor.

Internal 

An internal processing error (Ex: memopry allocation or misalignment).

IoError 

Error while trying open/read/write file.

OutOfRange 

Error while accessing descriptor out of range.

Member Function Documentation

◆ add() [1/3]

virtual Result< Error > fsdk::IDescriptorBatch::add ( IDescriptor * descriptor)
pure virtualnoexcept

Add a descriptor to the batch.

Parameters
[in]descriptordescriptor to add. Descriptor data is copied and to internal reference is held, thus it is safe to release the source descriptor object later.
Returns
Result with one of the error codes specified by DescriptorBatchError.
See also
IDescriptor, Result and Error for details.

◆ add() [2/3]

virtual Result< Error > fsdk::IDescriptorBatch::add ( IDescriptorBatch * batch,
uint32_t offset,
uint32_t count )
pure virtualnoexcept

Add a descriptor batch content to the batch. Descriptors to copy from the source bath are selected based on count and offset parameters.

Parameters
[in]batchbatch to take content from.
[in]offsetoffset of descriptors to copy.
[in]countcount of descriptors to copy.
Returns
Result with one of the error codes specified by DescriptorBatchError.
See also
IDescriptorBatch, Result and Error for details.
Note
Current batch should have enough free space to place all descriptors from the input batch.
All selected descriptors from the source batch will be placed right after all descriptors in the current batch.
All selected descriptors from the input batch are copied to the buffer of the current batch. So it is safe to release the source descriptor batch object later.

◆ add() [3/3]

virtual Result< Error > fsdk::IDescriptorBatch::add ( IDescriptorBatch * batch,
uint32_t offset = 0 )
pure virtualnoexcept

Add a given descriptor batch content to the current batch. Descriptors to copy from the source batch are selected based on offset parameter.

Parameters
[in]batchbatch to take content from. All descriptors from the input batch are copied to the buffer of the current batch. So it is safe to release the source descriptor batch object later.
[in]offsetoffset of descriptors to copy.
Returns
Result with one of the error codes specified by DescriptorBatchError.
See also
IDescriptorBatch, Result and Error for details.
Note
Current batch should have enough free space to place all descriptors from the input batch.
All selected descriptors from the source batch will be placed right after all descriptors in the current batch.
All selected descriptors from the input batch are copied to the buffer of the current batch. So it is safe to release the source descriptor batch object later.

◆ getCount()

virtual uint32_t fsdk::IDescriptorBatch::getCount ( ) const
pure virtualnoexcept

Get actual number of descriptors in this batch.

Returns
actual number of descriptors in this batch.

◆ getDescriptorFast()

virtual ResultValue< FSDKError, IDescriptorPtr > fsdk::IDescriptorBatch::getDescriptorFast ( uint32_t index)
pure virtualnoexcept

Get descriptor from batch by index without copying.

Parameters
[in]indexdescriptor index in batch.
Returns
ResultValue with error code and IDescriptorPtr instance.
See also
IDescriptorPtr, ResultValue and FSDKError for details.
Note
If you change achived descriptor - corresponded descriptor in batch will be changed.

◆ getDescriptorLength()

virtual uint32_t fsdk::IDescriptorBatch::getDescriptorLength ( ) const
pure virtualnoexcept

Get length of one descriptor. Specified by version of descriptors in batch.

Returns
Length of one descriptor in batch.

◆ getDescriptorSlow()

virtual ResultValue< FSDKError, IDescriptorPtr > fsdk::IDescriptorBatch::getDescriptorSlow ( uint32_t index) const
pure virtualnoexcept

Get descriptor from batch by index with copying.

Parameters
[in]indexdescriptor index in batch.
Returns
ResultValue with error code and IDescriptorPtr instance.
See also
IDescriptorPtr, ResultValue and FSDKError for details.

◆ getDescriptorType()

virtual DescriptorType fsdk::IDescriptorBatch::getDescriptorType ( ) const
pure virtualnoexcept

Get type of descriptor.

Note
This function only makes sense when there is at least one descriptor in the batch.
Returns
type as enum.
See also
DescriptorType for details.

◆ getMaxCount()

virtual uint32_t fsdk::IDescriptorBatch::getMaxCount ( ) const
pure virtualnoexcept

Get maximum number of descriptors in this batch.

Returns
maximum number of descriptors in this batch.

◆ getModelVersion()

virtual uint32_t fsdk::IDescriptorBatch::getModelVersion ( ) const
pure virtualnoexcept

Get algorithm model version the descriptors in this batch were created with.

Note
This function only makes sense when there is at least one descriptor in the batch. It will return 0 if the batch is empty.
Returns
Version as integral number.

◆ loadAndAdd()

virtual Result< MultiError< ISerializableObject::Error, Error > > fsdk::IDescriptorBatch::loadAndAdd ( IArchive * archive)
pure virtual

Load a descriptor/descriptors from archive and add it to the batch.

Note
This method supports both serialized IDescriptorBatch and IDescriptor.
Parameters
[in]archivearchive to read from.
Returns
MultiError result with codes specified by DescriptorBatchError and SerializationError.
Note
This method pass exceptions from user defined IArchive, but doesnt throw its own
See also
Result, IArchive, ISerializableObject::Error, Error and MultiError for details.

◆ removeFast()

virtual Result< Error > fsdk::IDescriptorBatch::removeFast ( uint32_t index)
pure virtualnoexcept

Remove a descriptor from batch.

Remove descriptor by swapping it with the last descriptor in batch. This breaks descriptor order.

Parameters
[in]indexdescriptor index.
Returns
Result with one of the error codes specified by DescriptorBatchError.
See also
Result and Error for details.

◆ removeSlow()

virtual Result< Error > fsdk::IDescriptorBatch::removeSlow ( uint32_t index)
pure virtualnoexcept

Remove a descriptor from batch.

Remove descriptor by shifting all the following descriptors back. This preserves descriptor order.

Parameters
[in]indexdescriptor index.
Returns
Result with one of the error codes specified by DescriptorBatchError.
See also
Result and Error for details.

The documentation for this struct was generated from the following file: