AGX Dynamics  2.38.0.2
LinkController.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 #pragma once
17 
18 
19 #include <agxWire/Link.h>
20 
21 #include <agx/Singleton.h>
22 #include <agx/SetVector.h>
23 
25 
26 namespace agxSDK
27 {
28  class SimulationProxy;
29 }
30 
31 namespace agxWire
32 {
33  class AGXPHYSICS_EXPORT LinkController : public agx::Singleton
34  {
35  public:
36  typedef agx::Vector< agxWire::LinkRef > LinkRefContainer;
37 
38  public:
42  static agxWire::LinkController* instance();
43 
47  static agx::Bool hasInstance();
48 
49  public:
54  agxWire::LinkController::LinkRefContainer getLinks( const agxWire::Wire* wire ) const;
55 
56  public:
60  void update( agxWire::WireParallelCallbacksHandler::CallbackTypes type, agxSDK::SimulationProxy* simulationProxy );
61 
65  void onRemoveNotification( agxWire::Wire* wire );
66 
67  protected:
68  LinkController();
69  virtual ~LinkController();
70 
71  virtual void shutdown() override;
72 
73  void refCount( agxWire::LinkRef link, agx::Int32 count );
74 
75  friend class Link;
76  void onCreate( agxWire::Link* link );
77  void onDelete( agxWire::Link* link );
78 
79  void onConnect( agxWire::LinkRef link );
80  void onDisconnect( agxWire::LinkRef link );
81 
82  SINGLETON_CLASSNAME_METHOD();
83 
84  protected:
85  typedef agx::SetVector< agxWire::Link* > LinkContainer;
86  typedef agx::HashTable< agxWire::LinkRef, agx::UInt > LinkRefCountContainer;
87 
88  protected:
89  LinkContainer m_links;
90  LinkRefCountContainer m_linksRefCounter;
91 
92  private:
93  static LinkController* s_instance;
94  };
95 }
96 
agx::Vector
Templated vector class.
Definition: Vector.h:52
DOXYGEN_END_INTERNAL_BLOCK
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: macros.h:97
DOXYGEN_START_INTERNAL_BLOCK
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: macros.h:96
agxWire::Wire
Interface and placeholder of controllers/helpers for wires.
Definition: Wire.h:61
AGXPHYSICS_EXPORT
#define AGXPHYSICS_EXPORT
agx::ref_ptr
Smart pointer for handling referenced counted objects.
Definition: ref_ptr.h:29
agx::shutdown
void AGXPHYSICS_EXPORT shutdown()
Shutdown of the AGX Dynamics API will be done when the number of shutdown matches the number of calls...
agx::SetVector
This class is a combined container which has the find complexity of a HashTable, deterministic iterat...
Definition: SetVector.h:37
agxWire
Implements a Wire model with adaptive resolution.
Definition: MergedBody.h:39
agx::Singleton
Base class for Singletons that should have its shutdown called explicitly before exit of the applicat...
Definition: Singleton.h:30
agx::LinearProbingHashTable
Inheritance with partial specialization due to bug with ref_ptr containers.
Definition: LinearProbingHashTable.h:926
agx::Bool
bool Bool
Definition: Integer.h:40
Singleton.h
agxSDK
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
Definition: Constraint.h:30
agx::Int32
int32_t Int32
Definition: Integer.h:37
agxSDK::SimulationProxy
Interface class used by internal objects running in parallel.
Definition: SimulationProxy.h:49
SetVector.h