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

#include <be_memory_autobuffer.h>

Public Types

using value_type = T
 Manage a memory buffer. More...
 
using reference = T &
 
using const_reference = const T &
 

Public Member Functions

 operator T* ()
 
T * operator-> ()
 
AutoBufferoperator= (const AutoBuffer &other)
 
 AutoBuffer ()
 
 AutoBuffer (T *data)
 
 AutoBuffer (int(*ctor)(T **), void(*dtor)(T *), int(*copyCtor)(T **, T *)=nullptr)
 
 AutoBuffer (const AutoBuffer &copy)
 
 ~AutoBuffer ()
 

Detailed Description

template<class T>
class BiometricEvaluation::Memory::AutoBuffer< T >

Definition at line 20 of file be_memory_autobuffer.h.

Member Typedef Documentation

◆ value_type

template<class T >
using BiometricEvaluation::Memory::AutoBuffer< T >::value_type = T

Manage a memory buffer.

It's easier to think of AutoBuffer as a wrapper for a pointer rather than the object it truly is. Therefore, you can interact with the AutoBuffer object exactly how you would a traditional pointer, without worrying about memory management.

Say you wanted to use an ANSI_NIST* but didn't want to be responsible for allocating or freeing the memory. Create an AutoBuffer object like:

AutoBuffer<ANSI_NIST> obj = AutoBuffer(allocator_fn,
    deallocator_fn[, copy_constructor]);

Notice the AutoBuffer is for ANSI_NIST and not ANSI_NIST*, since AutoBuffer will handle the pointer for you. You can pass the AutoBuffer<ANSI_NIST> object to any function that takes an ANSI_NIST*. For example, it's perfectly valid to pass our 'obj' object above to:

write_fmttext(FILE *, ANSI_NIST *)

If you want to access a member from 'obj', you can use the dereference operator just like you would on a regular ANSI_NIST*:

int size = obj->num_bytes;

Definition at line 56 of file be_memory_autobuffer.h.

◆ reference

template<class T >
using BiometricEvaluation::Memory::AutoBuffer< T >::reference = T&

Definition at line 58 of file be_memory_autobuffer.h.

◆ const_reference

template<class T >
using BiometricEvaluation::Memory::AutoBuffer< T >::const_reference = const T&

Definition at line 59 of file be_memory_autobuffer.h.

Constructor & Destructor Documentation

◆ AutoBuffer() [1/4]

template<class T >
BiometricEvaluation::Memory::AutoBuffer< T >::AutoBuffer

Definition at line 156 of file be_memory_autobuffer.h.

◆ AutoBuffer() [2/4]

template<class T >
BiometricEvaluation::Memory::AutoBuffer< T >::AutoBuffer ( T *  data)

Definition at line 189 of file be_memory_autobuffer.h.

◆ AutoBuffer() [3/4]

template<class T >
BiometricEvaluation::Memory::AutoBuffer< T >::AutoBuffer ( int(*)(T **)  ctor,
void(*)(T *)  dtor,
int(*)(T **, T *)  copyCtor = nullptr 
)

Definition at line 163 of file be_memory_autobuffer.h.

◆ AutoBuffer() [4/4]

template<class T >
BiometricEvaluation::Memory::AutoBuffer< T >::AutoBuffer ( const AutoBuffer< T > &  copy)

Definition at line 202 of file be_memory_autobuffer.h.

◆ ~AutoBuffer()

Definition at line 229 of file be_memory_autobuffer.h.

Member Function Documentation

◆ operator T*()

template<class T >
BiometricEvaluation::Memory::AutoBuffer< T >::operator T*

Definition at line 109 of file be_memory_autobuffer.h.

◆ operator->()

template<class T >
T * BiometricEvaluation::Memory::AutoBuffer< T >::operator->

Definition at line 115 of file be_memory_autobuffer.h.

◆ operator=()

template<class T >
BiometricEvaluation::Memory::AutoBuffer< T > & BiometricEvaluation::Memory::AutoBuffer< T >::operator= ( const AutoBuffer< T > &  other)

Definition at line 122 of file be_memory_autobuffer.h.


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