nfd::tools::nfdc::FindFace Class Reference

Procedure to find a face. More...

#include <tools/nfdc/face-helpers.hpp>

+ Inheritance diagram for nfd::tools::nfdc::FindFace:
+ Collaboration diagram for nfd::tools::nfdc::FindFace:

Public Types

enum class  Code {
  OK = 0 ,
  ERROR = 1 ,
  NOT_FOUND = 3 ,
  CANONIZE_ERROR = 4 ,
  AMBIGUOUS = 5 ,
  NOT_STARTED = -1 ,
  IN_PROGRESS = -2
}
 
enum class  DisambiguationStyle { LOCAL_URI = 1 }
 

Public Member Functions

 FindFace (ExecuteContext &ctx)
 
Code execute (const FaceQueryFilter &filter, bool allowMulti=false)
 Find face by FaceQueryFilter. More...
 
Code execute (const FaceUri &faceUri, bool allowMulti=false)
 Find face by FaceUri. More...
 
Code execute (const std::any &faceIdOrUri, bool allowMulti=false)
 Find face by FaceId or FaceUri. More...
 
Code execute (uint64_t faceId)
 Find face by FaceId. More...
 
const std::string & getErrorReason () const
 
uint64_t getFaceId () const
 
std::set< uint64_t > getFaceIds () const
 
const FaceStatus & getFaceStatus () const
 
const std::vector< FaceStatus > & getResults () const
 
void printDisambiguation (std::ostream &os, DisambiguationStyle style) const
 Print results for disambiguation. More...
 

Detailed Description

Procedure to find a face.

Definition at line 47 of file face-helpers.hpp.

Member Enumeration Documentation

◆ Code

Enumerator
OK 

found exactly one face, or found multiple faces when allowMulti is true

ERROR 

unspecified error

NOT_FOUND 

found zero face

CANONIZE_ERROR 

error during FaceUri canonization

AMBIGUOUS 

found multiple faces and allowMulti is false

NOT_STARTED 

for internal use

IN_PROGRESS 

for internal use

Definition at line 50 of file face-helpers.hpp.

◆ DisambiguationStyle

Enumerator
LOCAL_URI 

print FaceId and LocalUri

Definition at line 60 of file face-helpers.hpp.

Constructor & Destructor Documentation

◆ FindFace()

nfd::tools::nfdc::FindFace::FindFace ( ExecuteContext ctx)
explicit

Definition at line 36 of file face-helpers.cpp.

Member Function Documentation

◆ execute() [1/4]

FindFace::Code nfd::tools::nfdc::FindFace::execute ( const FaceQueryFilter &  filter,
bool  allowMulti = false 
)

Find face by FaceQueryFilter.

Precondition
execute has not been invoked

Definition at line 70 of file face-helpers.cpp.

◆ execute() [2/4]

FindFace::Code nfd::tools::nfdc::FindFace::execute ( const FaceUri &  faceUri,
bool  allowMulti = false 
)

Find face by FaceUri.

Precondition
execute has not been invoked

Definition at line 42 of file face-helpers.cpp.

◆ execute() [3/4]

FindFace::Code nfd::tools::nfdc::FindFace::execute ( const std::any &  faceIdOrUri,
bool  allowMulti = false 
)

Find face by FaceId or FaceUri.

Parameters
faceIdOrUrieither a FaceId (uint64_t) or a FaceUri
allowMultieffective only if faceIdOrUri contains a FaceUri
Exceptions
std::bad_any_castfaceIdOrUri is neither uint64_t nor FaceUri

Definition at line 58 of file face-helpers.cpp.

◆ execute() [4/4]

FindFace::Code nfd::tools::nfdc::FindFace::execute ( uint64_t  faceId)

Find face by FaceId.

Precondition
execute has not been invoked

Definition at line 50 of file face-helpers.cpp.

◆ getErrorReason()

const std::string& nfd::tools::nfdc::FindFace::getErrorReason ( ) const
inline

Definition at line 120 of file face-helpers.hpp.

◆ getFaceId()

uint64_t nfd::tools::nfdc::FindFace::getFaceId ( ) const
inline

Definition at line 114 of file face-helpers.hpp.

◆ getFaceIds()

std::set< uint64_t > nfd::tools::nfdc::FindFace::getFaceIds ( ) const
Returns
FaceId for all results

Definition at line 151 of file face-helpers.cpp.

◆ getFaceStatus()

const FaceStatus & nfd::tools::nfdc::FindFace::getFaceStatus ( ) const
Returns
a single face status
Precondition
getResults().size() == 1

Definition at line 161 of file face-helpers.cpp.

◆ getResults()

const std::vector<FaceStatus>& nfd::tools::nfdc::FindFace::getResults ( ) const
inline
Returns
face status for all results

Definition at line 97 of file face-helpers.hpp.

◆ printDisambiguation()

void nfd::tools::nfdc::FindFace::printDisambiguation ( std::ostream &  os,
DisambiguationStyle  style 
) const

Print results for disambiguation.

Definition at line 168 of file face-helpers.cpp.