Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-17 09:03:52

0001 // Copyright (c) ONNX Project Contributors
0002 
0003 /*
0004  * SPDX-License-Identifier: Apache-2.0
0005  */
0006 
0007 #pragma once
0008 
0009 #define ONNX_UNUSED_PARAMETER(x) (void)(x)
0010 
0011 #ifdef ONNX_NO_EXCEPTIONS
0012 #include <iostream>
0013 #define ONNX_THROW(...)                                   \
0014   do {                                                    \
0015     std::cerr << ONNX_NAMESPACE::MakeString(__VA_ARGS__); \
0016     abort();                                              \
0017   } while (false)
0018 
0019 #define ONNX_THROW_EX(ex)                \
0020   do {                                   \
0021     std::cerr << ex.what() << std::endl; \
0022     abort();                             \
0023   } while (false)
0024 
0025 #define ONNX_TRY if (true)
0026 #define ONNX_CATCH(x) else if (false)
0027 #define ONNX_HANDLE_EXCEPTION(func)
0028 
0029 #else
0030 #define ONNX_THROW(...) throw std::runtime_error(ONNX_NAMESPACE::MakeString(__VA_ARGS__))
0031 #define ONNX_THROW_EX(ex) throw ex
0032 
0033 #define ONNX_TRY try
0034 #define ONNX_CATCH(x) catch (x)
0035 #define ONNX_HANDLE_EXCEPTION(func) func()
0036 #endif
0037 
0038 // Macros to disable the copy and/or assignment methods
0039 // These are usually placed in the private: declarations for a class.
0040 
0041 #define ONNX_DISALLOW_COPY(TypeName) TypeName(const TypeName&) = delete
0042 
0043 #define ONNX_DISALLOW_ASSIGNMENT(TypeName) TypeName& operator=(const TypeName&) = delete
0044 
0045 #define ONNX_DISALLOW_COPY_AND_ASSIGNMENT(TypeName) \
0046   ONNX_DISALLOW_COPY(TypeName);                     \
0047   ONNX_DISALLOW_ASSIGNMENT(TypeName)
0048 
0049 #define ONNX_DISALLOW_MOVE(TypeName) \
0050   TypeName(TypeName&&) = delete;     \
0051   TypeName& operator=(TypeName&&) = delete
0052 
0053 #define ONNX_DISALLOW_COPY_ASSIGNMENT_AND_MOVE(TypeName) \
0054   ONNX_DISALLOW_COPY_AND_ASSIGNMENT(TypeName);           \
0055   ONNX_DISALLOW_MOVE(TypeName)