AGX Dynamics  2.35.0.1
LinkController.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, 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 
#define AGXPHYSICS_EXPORT
Interface class used by internal objects running in parallel.
Interface and placeholder of controllers/helpers for wires.
Definition: Wire.h:62
Inheritance with partial specialization due to bug with ref_ptr containers.
This class is a combined container which has the find complexity of a HashTable, deterministic iterat...
Definition: SetVector.h:38
Base class for Singletons that should have its shutdown called explicitly before exit of the applicat...
Definition: Singleton.h:31
Templated vector class.
Definition: agx/Vector.h:53
Smart pointer for handling referenced counted objects.
Definition: ref_ptr.h:30
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: macros.h:97
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: macros.h:96
The agxSDK namespace contain classes to bridge the collision detection system and the dynamical simul...
Definition: Constraint.h:31
Implements a Wire model with adaptive resolution.
Definition: MergedBody.h:40
int32_t Int32
Definition: Integer.h:45
bool Bool
Definition: Integer.h:48
void AGXPHYSICS_EXPORT shutdown()
Shutdown agx.