common.h#

Portability macros for exception handling and class rule-of-five enforcement.

Provides two groups of macros:

Defines

ONNX_UNUSED_PARAMETER(x)#

Suppresses compiler warnings about an unreferenced function parameter.

Casts x to void so that compilers do not emit an unused-parameter diagnostic. Use this in function bodies where a parameter is intentionally left unused (e.g. in a no-op override or a debug-only code path).

Parameters:
  • x – The parameter name to mark as intentionally unused.

ONNX_THROW(...)#
ONNX_THROW_EX(ex)#
ONNX_TRY#
ONNX_CATCH(x)#
ONNX_HANDLE_EXCEPTION(func)#
ONNX_DISALLOW_COPY(TypeName)#

Deletes the copy constructor of TypeName.

Place inside a class body to prevent copy construction. Typically used together with ONNX_DISALLOW_ASSIGNMENT.

Parameters:
  • TypeName – The unqualified name of the enclosing class.

ONNX_DISALLOW_ASSIGNMENT(TypeName)#

Deletes the copy-assignment operator of TypeName.

Place inside a class body to prevent copy assignment. Typically used together with ONNX_DISALLOW_COPY.

Parameters:
  • TypeName – The unqualified name of the enclosing class.

ONNX_DISALLOW_COPY_AND_ASSIGNMENT(TypeName)#

Deletes both the copy constructor and copy-assignment operator of TypeName.

Expands to ONNX_DISALLOW_COPY followed by ONNX_DISALLOW_ASSIGNMENT, making the class non-copyable.

Parameters:
  • TypeName – The unqualified name of the enclosing class.

ONNX_DISALLOW_MOVE(TypeName)#

Deletes both the move constructor and move-assignment operator of TypeName.

Place inside a class body to prevent move construction and move assignment, making the class immovable.

Parameters:
  • TypeName – The unqualified name of the enclosing class.

ONNX_DISALLOW_COPY_ASSIGNMENT_AND_MOVE(TypeName)#

Deletes all copy and move special-member functions of TypeName.

Expands to ONNX_DISALLOW_COPY_AND_ASSIGNMENT followed by ONNX_DISALLOW_MOVE, making the class neither copyable nor movable.

Parameters:
  • TypeName – The unqualified name of the enclosing class.