AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
Json.h
Go to the documentation of this file.
1/*
2Copyright 2007-2024. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx Simulation AB.
15*/
16
17/*
18This source code has been taken and modified by Algoryx Simulation AB
19from 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 <json/json.h>
30
31#define agxJsonVerify(x, element) \
32if (!(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) \
45if (!(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, ...) \
58if (!(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
71namespace agx
72{
73
74}
75
76#endif /* AGX_JSON_H */
The agx namespace contains the dynamics/math part of the AGX Dynamics API.