AGX Dynamics  2.37.2.0
agx.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2024. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are 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 #ifdef _MSC_VER
18 # pragma warning(push)
19 # pragma warning(disable: 4251) // warning C4251: class X needs to have dll-interface to be used by clients of class Y
20 #endif
21 
22 #ifndef AGX_AGX_H
23 #define AGX_AGX_H
24 
25 
26 
27 #include <agx/config.h>
28 #include <agx/macros.h>
29 #include <agx/build_flags.h>
30 
31 #include <agx/agxPhysics_export.h>
32 #include <agx/agxCore_export.h>
33 #include <string.h>
34 
35 #include <agx/Math.h>
36 #include <agx/stdint.h>
37 #include <agx/debug.h>
38 
39 // Workaround for a bug in Visual Studio 2008-2013 where a C2039 could be issued when referencing a function foo
40 // defined in the same unnamed namespace with ::foo.
41 // See http://stackoverflow.com/questions/5503901/how-to-correctly-reference-a-function-in-an-anonymous-namespace
42 namespace {}
43 
48 namespace agx
49 {
54  void AGXPHYSICS_EXPORT init();
55 
63 
68 
82  {
83  public:
84  AutoInit();
85  ~AutoInit();
86  };
87 
110  };
111 
114 
115 
121 
126  void AGXCORE_EXPORT setNumThreads(size_t numThreads);
127 
133 
139 
140  class Thread;
145 
146 
153 
158 
163 
168 
174  template <typename T>
175  AGX_FORCE_INLINE operator T() const {
176  return (T) - 1;
177  }
178 
179  // Comparison operators
180  template <typename T>
181  AGX_FORCE_INLINE bool operator == (T val) const {
182  return val == (T) - 1;
183  }
184 
185  template <typename T>
186  AGX_FORCE_INLINE bool operator != (T val) const {
187  return val != (T) - 1;
188  }
189  };
190 
191 
192  // Comparison operators
193  template <typename T>
195  {
196  return val == (T) - 1;
197  }
198 
199  template <typename T>
201  {
202  return val != (T) - 1;
203  }
204 
206 }
207 
214 namespace agxCore
215 {
219  void AGXCORE_EXPORT init();
220 
224  void AGXCORE_EXPORT shutdown();
225 
229  bool AGXCORE_EXPORT isShutdown();
230 }
231 
232 #endif
agx::Index AGXCORE_EXPORT getNumThreads()
void AGXPHYSICS_EXPORT init()
Initialize AGX Dynamics API including thread resources and must be executed before using the AGX API...
void AGXPHYSICS_EXPORT shutdown()
Shutdown of the AGX Dynamics API will be done when the number of shutdown matches the number of calls...
agx::Thread is a representation of an OS specific implementation of a computational thread...
Definition: Thread.h:198
BuildConfiguration
Specifies flags set at build time. Used when querying what is enabled in this current build...
Definition: agx.h:89
bool AGXCORE_EXPORT isBuiltWith(BuildConfiguration config)
AGXCORE_EXPORT bool getEntityCreationThreadSafe()
bool AGXPHYSICS_EXPORT isShutdown()
bool operator==(T val, InvalidIndexStruct)
Definition: agx.h:194
std::string AGXCORE_EXPORT getBuildConfigurationString(BuildConfiguration config)
#define AGXPHYSICS_EXPORT
UInt64 AGXCORE_EXPORT getStartTick()
AGXCORE_EXPORT const InvalidIndexStruct InvalidIndex
#define AGX_FORCE_INLINE
Definition: Object.h:59
agx::Index AGXCORE_EXPORT getNumThreadsIncludingRegistered()
void AGXCORE_EXPORT resetStartTick()
Reset the startTick value to the current tick.
AGXCORE_EXPORT void setEntityCreationThreadSafe(bool)
Iff true you can move the entity to another thread (but you may only use it from one thread at the ti...
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
AGXCORE_EXPORT Thread * getCurrentThread()
UInt32 Index
Definition: Integer.h:52
void AGXCORE_EXPORT setNumThreads(size_t numThreads)
Set the number of threads to use (including the main thread).
uint64_t UInt64
Definition: Integer.h:41
bool operator!=(T val, InvalidIndexStruct)
Definition: agx.h:200
Convenience class to automatically call agx::init / agx::shutdown.
Definition: agx.h:81
Tag for invalid UInt values.
Definition: agx.h:173
#define AGXCORE_EXPORT
Contains function for initialization and shutdown of agxCore library when agxPhysics is not used...