AGX Dynamics  2.35.0.1
Json.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2022. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, is copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 /*
18 This source code has been taken and modified by Algoryx Simulation AB
19 from the source and under the license given below.
20 */
21 
22 #ifndef AGX_JSON_H
23 #define AGX_JSON_H
24 
25 #include <agx/debug.h>
26 
28 #include <external/json/json.h>
29 #include <agx/PopDisableWarnings.h>
30 
31 #define agxJsonVerify(x, element) \
32 if (!(x)) \
33 { \
34  std::stringstream __stream; \
35  __stream << agx::buildErrorString("[%s:%u] agxVerify failed: `%s'", "", __FILE__, __LINE__, #x) << std::endl; \
36  __stream << "==============================================================================" << std::endl; \
37  __stream << agxJson::StyledWriter().write(element); \
38  __stream << "==============================================================================" << std::endl; \
39  const std::string& __string = __stream.str(); \
40  std::cerr << __string << std::endl; \
41  agxThrow std::runtime_error(__string); \
42 }
43 
44 #define agxJsonVerify1(x, element, msg) \
45 if (!(x)) \
46 { \
47  std::stringstream __stream; \
48  __stream << agx::buildErrorString("[%s:%u] agxVerify failed: `%s', ", "%s", __FILE__, __LINE__, #x, msg) << std::endl; \
49  __stream << "==============================================================================" << std::endl; \
50  __stream << agxJson::StyledWriter().write(element); \
51  __stream << "==============================================================================" << std::endl; \
52  const std::string& __string = __stream.str(); \
53  std::cerr << __string << std::endl; \
54  agxThrow std::runtime_error(__string); \
55 }
56 
57 #define agxJsonVerifyN(x, element, format, ...) \
58 if (!(x)) \
59 { \
60  std::stringstream __stream; \
61  __stream << agx::buildErrorString("[%s:%u] agxVerify failed: `%s', ", format, __FILE__, __LINE__, #x, ##__VA_ARGS__) << std::endl; \
62  __stream << "==============================================================================" << std::endl; \
63  __stream << agxJson::StyledWriter().write(element); \
64  __stream << "==============================================================================" << std::endl; \
65  const std::string& __string = __stream.str(); \
66  std::cerr << __string << std::endl; \
67  agxThrow std::runtime_error(__string); \
68 }
69 
70 
71 namespace agx
72 {
73 
74 }
75 
76 #endif /* AGX_JSON_H */
The agx namespace contains the dynamics/math part of the AGX Dynamics API.