AGXDynamics  2.31.1.0
agx.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2021. 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 #include <agx/config.h>
27 #include <agx/macros.h>
28 #include <agx/build_flags.h>
29 
30 #include <agx/agxPhysics_export.h>
31 #include <agx/agxCore_export.h>
32 #include <string.h>
33 
34 #include <agx/Math.h>
35 #include <agx/stdint.h>
36 #include <agx/debug.h>
37 
38 // Workaround for a bug in Visual Studio 2008-2013 where a C2039 could be issued when referencing a function foo
39 // defined in the same unnamed namespace with ::foo.
40 // See http://stackoverflow.com/questions/5503901/how-to-correctly-reference-a-function-in-an-anonymous-namespace
41 namespace {}
42 
47 namespace agx
48 {
52  void AGXPHYSICS_EXPORT init();
53 
58 
63 
75  {
76  public:
77  AutoInit();
78  ~AutoInit();
79  };
80 
81 
82 
107  };
108 
111 
112 
118 
123  void AGXCORE_EXPORT setNumThreads(size_t numThreads);
124 
130 
136 
137  class Thread;
142 
143 
150 
155 
160 
165 
171  template <typename T>
172  AGX_FORCE_INLINE operator T() const {
173  return (T) - 1;
174  }
175 
176  // Comparison operators
177  template <typename T>
178  AGX_FORCE_INLINE bool operator == (T val) const {
179  return val == (T) - 1;
180  }
181 
182  template <typename T>
183  AGX_FORCE_INLINE bool operator != (T val) const {
184  return val != (T) - 1;
185  }
186  };
187 
188 
189  // Comparison operators
190  template <typename T>
192  {
193  return val == (T) - 1;
194  }
195 
196  template <typename T>
198  {
199  return val != (T) - 1;
200  }
201 
203 }
204 
206 namespace agxCore
207 {
211  void AGXCORE_EXPORT init();
212 
216  void AGXCORE_EXPORT shutdown();
217 
221  bool AGXCORE_EXPORT isShutdown();
222 }
223 
224 #ifdef _MSC_VER
225 # pragma warning(pop)
226 #endif
227 
228 #endif
agx::Index AGXCORE_EXPORT getNumThreads()
void AGXPHYSICS_EXPORT init()
Initialize agx.
void AGXPHYSICS_EXPORT shutdown()
Shutdown agx.
agx::Thread is a representation of an OS specific implementation of a computational thread...
Definition: Thread.h:197
BuildConfiguration
Specifies flags set at build time. Used when querying what is enabled in this current build...
Definition: agx.h:84
bool AGXCORE_EXPORT isBuiltWith(BuildConfiguration config)
AGXCORE_EXPORT bool getEntityCreationThreadSafe()
bool AGXPHYSICS_EXPORT isShutdown()
bool operator==(T val, InvalidIndexStruct)
Definition: agx.h:191
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:63
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...
Namespace agx 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:197
Convenience class to automatically call agx::init / agx::shutdown.
Definition: agx.h:74
Tag for invalid UInt values.
Definition: agx.h:170
#define AGXCORE_EXPORT
Contains function for initialization and shutdown of agxCore. NOTE: Only use these when using agxCore...
Definition: agx.h:206