VisionWorks Toolkit Reference

December 18, 2015 | 1.2 Release

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Utility

Detailed Description

Defines NVXIO Utility API.

Data Structures

struct  nvxio::ContextGuard
 ContextGuard is a wrapper for vx_context. More...
 

Macros

#define NVXIO_ASSERT(cond)
 Checks a condition. More...
 
#define NVXIO_CHECK_REFERENCE(ref)   NVXIO_ASSERT(ref != 0 && vxGetStatus((vx_reference)ref) == VX_SUCCESS)
 Checks a reference. More...
 
#define NVXIO_SAFE_CALL(vxOp)
 Performs an operation. More...
 
#define NVXIO_THROW_EXCEPTION(msg)
 Throws std::runtime_error exception. More...
 

Functions

void nvxio::checkIfContextIsValid (vx_context context)
 Checks whether the context is valid and throws an exception in case of failure. More...
 
template<typename T , vx_size N>
vx_size nvxio::dimOf (T(&)[N])
 Returns the size of an array (the N template argument). More...
 
template<typename T , typename... Args>
std::unique_ptr< T > nvxio::makeUP (Args &&...args)
 make_unique function. More...
 
void VX_CALLBACK nvxio::stdoutLogCallback (vx_context context, vx_reference ref, vx_status status, const vx_char string[])
 The callback for OpenVX error logs, which prints messages to standard output. More...
 

Variables

const vx_float64 nvxio::PI = 3.1415926535897932
 Double-precision PI. More...
 
const vx_float32 nvxio::PI_F = 3.14159265f
 Float-precision PI. More...
 

Macro Definition Documentation

#define NVXIO_THROW_EXCEPTION (   msg)
Value:
do { \
std::ostringstream ostr_; \
ostr_ << msg; \
throw std::runtime_error(ostr_.str()); \
} while(0)

Throws std::runtime_error exception.

Parameters
[in]msgA message with content related to the exception.
See also
NVXIO APIs

Definition at line 63 of file Utility.hpp.

#define NVXIO_SAFE_CALL (   vxOp)
Value:
do \
{ \
vx_status status = (vxOp); \
if (status != VX_SUCCESS) \
{ \
NVXIO_THROW_EXCEPTION(# vxOp << " failure [status = " << status << "]" << " in file " << __FILE__ << " line " << __LINE__); \
} \
} while (0)
No error.
Definition: vx_types.h:414
vx_enum vx_status
A formal status type with known fixed size.
Definition: vx_types.h:421
#define NVXIO_THROW_EXCEPTION(msg)
Throws std::runtime_error exception.
Definition: Utility.hpp:63

Performs an operation.

If the operation has failed then it throws std::runtime_error exception.

Parameters
[in]vxOpA function to be called. The function must have vx_status return value.
See also
NVXIO APIs

Definition at line 77 of file Utility.hpp.

#define NVXIO_ASSERT (   cond)
Value:
do \
{ \
bool status = (cond); \
if (!status) \
{ \
NVXIO_THROW_EXCEPTION(# cond << " failure in file " << __FILE__ << " line " << __LINE__); \
} \
} while (0)
#define NVXIO_THROW_EXCEPTION(msg)
Throws std::runtime_error exception.
Definition: Utility.hpp:63

Checks a condition.

If the condition is false then it throws std::runtime_error exception.

Parameters
[in]condExpression to be evaluated.
See also
NVXIO APIs

Definition at line 93 of file Utility.hpp.

#define NVXIO_CHECK_REFERENCE (   ref)    NVXIO_ASSERT(ref != 0 && vxGetStatus((vx_reference)ref) == VX_SUCCESS)

Checks a reference.

If the reference is not valid then it throws std::runtime_error exception.

Parameters
[in]refReference to be checked.
See also
NVXIO APIs

Definition at line 109 of file Utility.hpp.

Function Documentation

template<typename T , vx_size N>
vx_size nvxio::dimOf ( T(&)  [N])

Returns the size of an array (the N template argument).

See also
NVXIO APIs

Definition at line 118 of file Utility.hpp.

void VX_CALLBACK nvxio::stdoutLogCallback ( vx_context  context,
vx_reference  ref,
vx_status  status,
const vx_char  string[] 
)

The callback for OpenVX error logs, which prints messages to standard output.

Must be used as a parameter for vxRegisterLogCallback.

Parameters
[in]contextSpecifies the OpenVX context.
[in]refSpecifies the reference to the object that generated the error message.
[in]statusSpecifies the error code.
[in]stringSpecifies the error message.
void nvxio::checkIfContextIsValid ( vx_context  context)

Checks whether the context is valid and throws an exception in case of failure.

Parameters
[in]contextSpecifies the context to check.
See also
NVXIO APIs

Referenced by nvxio::ContextGuard::ContextGuard().

template<typename T , typename... Args>
std::unique_ptr<T> nvxio::makeUP ( Args &&...  args)

make_unique function.

See also
NVXIO APIs

Definition at line 184 of file Utility.hpp.

Variable Documentation

const vx_float64 nvxio::PI = 3.1415926535897932

Double-precision PI.

See also
NVXIO APIs

Definition at line 127 of file Utility.hpp.

const vx_float32 nvxio::PI_F = 3.14159265f

Float-precision PI.

See also
NVXIO APIs

Definition at line 133 of file Utility.hpp.