NIST Biometric Evaluation Framework
Software components for biometric technology evaluations
Classes | Public Member Functions | List of all members
BiometricEvaluation::Framework::API< T > Class Template Reference

A convenient way to execute biometric technology evaluation API methods safely. More...

#include <be_framework_api.h>

Classes

class  Result
 The result of an operation. More...
 

Public Member Functions

 API ()
 Constructor. More...
 
Result call (const std::function< T(void)> &operation, const std::function< void(const Result &)> &success={}, const std::function< void(const Result &)> &failure={})
 Invoke an operation. More...
 
bool protectionsEnabled () const
 Obtain whether or not all protections enabled by this object are enabled. More...
 
void setProtectionsEnabled (const bool protectionsEnabled)
 Wholesale change of process protections enabled by this object. More...
 
bool willRethrowExceptions () const
 Obtain whether or not exceptions caught in call() will be rethrown. More...
 
void setRethrowExceptions (const bool shouldRethrow)
 Change whether or not exceptions caught in call() should be rethrown. More...
 
void setCatchExceptions (const bool catchExceptions)
 Set whether or not to catch exceptions from call(), triggering the failure block. More...
 
bool willCatchExceptions () const
 Obtain whether or not exceptions raised in call() will be caught, triggering the failure block. More...
 
std::shared_ptr< BiometricEvaluation::Time::TimergetTimer () noexcept
 Obtain the timer object. More...
 
std::shared_ptr< BiometricEvaluation::Time::WatchdoggetWatchdog () noexcept
 Obtain the watchdog timer object. More...
 
std::shared_ptr< BiometricEvaluation::Error::SignalManagergetSignalManager () noexcept
 Obtain the signal manager object. More...
 

Detailed Description

template<typename T>
class BiometricEvaluation::Framework::API< T >

A convenient way to execute biometric technology evaluation API methods safely.

Note
One API object should be instantiated per process/thread.

Definition at line 63 of file be_framework_api.h.

Constructor & Destructor Documentation

◆ API()

template<typename T >
BiometricEvaluation::Framework::API< T >::API

Constructor.

Definition at line 451 of file be_framework_api.h.

Member Function Documentation

◆ call()

template<typename T >
BiometricEvaluation::Framework::API< T >::Result BiometricEvaluation::Framework::API< T >::call ( const std::function< T(void)> &  operation,
const std::function< void(const Result &)> &  success = {},
const std::function< void(const Result &)> &  failure = {} 
)

Invoke an operation.

@detail Invoking operations within this method implicitly wraps the operation in a SignalManager, Watchdog, and Timer, and follows evaluation best practices for calling an API operation.

Parameters
operationA reference to a function that returns a Status. (i.e., an API method).
successOperations invoked if operation returns.
failureOperations invoked if we abort the operation.
rethrowExceptionsWhether or not to rethrow an exception caught from operation.
Returns
Analytics about the return of operation.
Exceptions
...Exceptions raised from operation, if caught (willCatchExceptions() is true), are rethrown when API::willRethrowExceptions() is true.
Note
success is called and currentState == APICurrentState::Completed if operation returns, regardless of the Code of operation's Status.

Definition at line 464 of file be_framework_api.h.

◆ protectionsEnabled()

template<typename T >
bool BiometricEvaluation::Framework::API< T >::protectionsEnabled ( ) const
inline

Obtain whether or not all protections enabled by this object are enabled.

Protections include:

  • Catching exceptions
  • Not rethrowing exceptions
  • Enabling WatchdogTimer
  • Enabling SignalManager
Returns
true if all protections are enabled, false if one or more protections are disabled.
Note
Individual protection statuses may be queried through their respective objects/methods.

Definition at line 269 of file be_framework_api.h.

◆ setProtectionsEnabled()

template<typename T >
void BiometricEvaluation::Framework::API< T >::setProtectionsEnabled ( const bool  protectionsEnabled)
inline

Wholesale change of process protections enabled by this object.

Protections include:

  • Catching exceptions
  • Not rethrowing exceptions
  • Enabling WatchdogTimer
  • Enabling SignalManager
Parameters
protectionsEnabledtrue if all protections should be enabled, false if all protections should be disabled.
Note
Protections can be enabled or disabled individually through their respective objects/methods.

Definition at line 298 of file be_framework_api.h.

◆ willRethrowExceptions()

template<typename T >
bool BiometricEvaluation::Framework::API< T >::willRethrowExceptions ( ) const
inline

Obtain whether or not exceptions caught in call() will be rethrown.

Returns
true if exceptions raised in call() will be rethrown, false otherwise.
Note
Exceptions will not be caught (and thus not rethrown) if willCatchExceptions() is false.

Definition at line 323 of file be_framework_api.h.

◆ setRethrowExceptions()

template<typename T >
void BiometricEvaluation::Framework::API< T >::setRethrowExceptions ( const bool  shouldRethrow)
inline

Change whether or not exceptions caught in call() should be rethrown.

Parameters
shouldRethrowtrue if exceptions raised in call() will be rethrown, false otherwise.
Note
Exceptions will not be caught (and thus not rethrown) if willCatchExceptions() is false.

Definition at line 343 of file be_framework_api.h.

◆ setCatchExceptions()

template<typename T >
void BiometricEvaluation::Framework::API< T >::setCatchExceptions ( const bool  catchExceptions)
inline

Set whether or not to catch exceptions from call(), triggering the failure block.

Parameters
catchExceptionstrue if call()'s operation should be executed within a try block, false otherwise.

Definition at line 359 of file be_framework_api.h.

◆ willCatchExceptions()

template<typename T >
bool BiometricEvaluation::Framework::API< T >::willCatchExceptions ( ) const
inline

Obtain whether or not exceptions raised in call() will be caught, triggering the failure block.

Returns
true if call()'s operation will be executed within a try block, false otherwise.

Definition at line 375 of file be_framework_api.h.

◆ getTimer()

template<typename T >
std::shared_ptr< BiometricEvaluation::Time::Timer > BiometricEvaluation::Framework::API< T >::getTimer ( )
inlinenoexcept

Obtain the timer object.

Returns
Timer object.

Definition at line 389 of file be_framework_api.h.

◆ getWatchdog()

template<typename T >
std::shared_ptr< BiometricEvaluation::Time::Watchdog > BiometricEvaluation::Framework::API< T >::getWatchdog ( )
inlinenoexcept

Obtain the watchdog timer object.

Returns
Watchdog timer object.

Definition at line 404 of file be_framework_api.h.

◆ getSignalManager()

template<typename T >
std::shared_ptr< BiometricEvaluation::Error::SignalManager > BiometricEvaluation::Framework::API< T >::getSignalManager ( )
inlinenoexcept

Obtain the signal manager object.

Returns
Signal manager object.

Definition at line 419 of file be_framework_api.h.


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