Spaces:
Sleeping
Sleeping
File size: 1,745 Bytes
dc2106c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
// Copyright (c) ONNX Project Contributors
/*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#define ONNX_UNUSED_PARAMETER(x) (void)(x)
#ifdef ONNX_NO_EXCEPTIONS
#include <iostream>
#define ONNX_THROW(...) \
do { \
std::cerr << ONNX_NAMESPACE::MakeString(__VA_ARGS__); \
abort(); \
} while (false)
#define ONNX_THROW_EX(ex) \
do { \
std::cerr << ex.what() << std::endl; \
abort(); \
} while (false)
#define ONNX_TRY if (true)
#define ONNX_CATCH(x) else if (false)
#define ONNX_HANDLE_EXCEPTION(func)
#else
#define ONNX_THROW(...) throw std::runtime_error(ONNX_NAMESPACE::MakeString(__VA_ARGS__))
#define ONNX_THROW_EX(ex) throw ex
#define ONNX_TRY try
#define ONNX_CATCH(x) catch (x)
#define ONNX_HANDLE_EXCEPTION(func) func()
#endif
// Macros to disable the copy and/or assignment methods
// These are usually placed in the private: declarations for a class.
#define ONNX_DISALLOW_COPY(TypeName) TypeName(const TypeName&) = delete
#define ONNX_DISALLOW_ASSIGNMENT(TypeName) TypeName& operator=(const TypeName&) = delete
#define ONNX_DISALLOW_COPY_AND_ASSIGNMENT(TypeName) \
ONNX_DISALLOW_COPY(TypeName); \
ONNX_DISALLOW_ASSIGNMENT(TypeName)
#define ONNX_DISALLOW_MOVE(TypeName) \
TypeName(TypeName&&) = delete; \
TypeName& operator=(TypeName&&) = delete
#define ONNX_DISALLOW_COPY_ASSIGNMENT_AND_MOVE(TypeName) \
ONNX_DISALLOW_COPY_AND_ASSIGNMENT(TypeName); \
ONNX_DISALLOW_MOVE(TypeName)
|