stub_analytics_plugin  1.6
Network Optix Video Analytics SDK
Macros | Functions
utils.h File Reference
#include <cstring>
#include <cstdlib>
#include <memory>

Go to the source code of this file.

Macros

#define NX_KIT_API   /*empty*/
 

Functions

size_t nx::kit::utils::alignUp (size_t val, size_t alignment)
 
template<class MallocFunc >
void * nx::kit::utils::mallocAligned (size_t size, size_t alignment, MallocFunc mallocFunc)
 
void * nx::kit::utils::mallocAligned (size_t size, size_t alignment)
 
template<class FreeFunc >
void nx::kit::utils::freeAligned (void *ptr, FreeFunc freeFunc)
 
void nx::kit::utils::freeAligned (void *ptr)
 

Detailed Description

Variuos utilities.

This unit can be compiled in the context of any C++ project.

Function Documentation

◆ alignUp()

size_t nx::kit::utils::alignUp ( size_t  val,
size_t  alignment 
)
inline

Alignes val up to alignment boundary.

◆ freeAligned() [1/2]

template<class FreeFunc >
void nx::kit::utils::freeAligned ( void *  ptr,
FreeFunc  freeFunc 
)

Free ptr allocated with a call to mallocAligned().

NOTE: This function is as safe as ::free().

Parameters
freeFuncFunction with the signature void(void*), which is called to free the memory.

◆ freeAligned() [2/2]

void nx::kit::utils::freeAligned ( void *  ptr)
inline

Calls freeAligned() passing ::free as freeFunc.

◆ mallocAligned() [1/2]

template<class MallocFunc >
void* nx::kit::utils::mallocAligned ( size_t  size,
size_t  alignment,
MallocFunc  mallocFunc 
)

Allocate size bytes of data, aligned to alignment boundary.

NOTE: Allocated memory must be freed with a call to freeAligned().

NOTE: This function is as safe as ::malloc().

Parameters
mallocFuncFunction with the signature void*(size_t), which is called to allocate memory.

◆ mallocAligned() [2/2]

void* nx::kit::utils::mallocAligned ( size_t  size,
size_t  alignment 
)
inline

Calls mallocAligned() passing ::malloc as mallocFunc.