AGX Dynamics  2.35.0.1
LinkedStructureComponent.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 
17 #pragma once
18 
19 #include <agx/Referenced.h>
20 
21 #include <agxStream/Serializable.h>
22 
23 namespace agxSDK
24 {
25  class Simulation;
26  class LinkedStructure;
27 
30 
37  {
38  public:
43  const agx::Name& getName() const;
44 
50  void setName( const agx::Name& name );
51 
56 
61 
62  public:
64 
65  protected:
66  // Callbacks and set simulation and linked structure.
67  friend class LinkedStructure;
68 
73  virtual void onAddNotification( agxSDK::Simulation* simulation );
74 
78  virtual void onAddNotification( agxSDK::LinkedStructure* linkedStructure );
79 
84  virtual void onRemoveNotification( agxSDK::Simulation* simulation );
85 
89  virtual void onRemoveNotification( agxSDK::LinkedStructure* linkedStructure );
90 
94  virtual void onPreCollideStep();
95 
99  virtual void onPreStep();
100 
104  virtual void onPostStep();
105 
109  virtual void onLastStep();
110 
111  protected:
116  LinkedStructureComponent( const agx::Name& name = "" );
117 
122 
123  private:
129  void onAddToSimulation( agxSDK::Simulation* simulation );
130 
135  void onRemoveFromSimulation( agxSDK::Simulation* simulation );
136 
142  void setLinkedStructure( agxSDK::LinkedStructure* linkedStructure, agx::Bool silent = false );
144 
145  private:
146  agx::Name m_name;
147  LinkedStructure* m_linkedStructure;
148  };
149 }
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:248
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
Definition: Serializable.h:207
#define AGXPHYSICS_EXPORT
Base implementation of a component (e.g., specific functionality) in linked structures.
virtual void onPreStep()
Called on simulation pre step event - after user preStep.
LinkedStructureComponent(const agx::Name &name="")
Default, protected constructor.
virtual void onLastStep()
Called on simulation last step event - after user lastStep.
virtual void onRemoveNotification(agxSDK::LinkedStructure *linkedStructure)
Called when this component is removed from a linked structure.
agxSDK::Simulation * getSimulation() const
virtual void onPreCollideStep()
Called on simulation pre-collide step event - after user preCollide.
virtual void onPostStep()
Called on simulation post step event - after user postStep.
agxSDK::LinkedStructure * getLinkedStructure() const
virtual void onAddNotification(agxSDK::LinkedStructure *linkedStructure)
Called when this component is added to a linked structure.
void setName(const agx::Name &name)
Assign new name to this component.
const agx::Name & getName() const
virtual void onRemoveNotification(agxSDK::Simulation *simulation)
Called when removeNotification is executed when this linked structure is removed from the simulation.
virtual void onAddNotification(agxSDK::Simulation *simulation)
Called when addNotification is executed when this linked structure is added to the simulation.
virtual ~LinkedStructureComponent()
Reference counted object - protected destructor.
Basic implementation of any structure where bodies are linked/constrained together in a well defined ...
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition: Simulation.h:127
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
Definition: Serializable.h:45
Representation of a name string.
Definition: Name.h:33
Base class providing referencing counted objects.
Definition: Referenced.h:114
#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
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
bool Bool
Definition: Integer.h:48