AGXDynamics  2.31.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SubGraph.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 
18 #ifndef AGXPOWERLINE_SUB_GRAPH_ROUTER_H
19 #define AGXPOWERLINE_SUB_GRAPH_ROUTER_H
20 
21 #include <agxModel/export.h>
22 #include <agx/Constraint.h>
23 
24 namespace agx
25 {
26  class RigidBody;
27 }
28 
29 namespace agxPowerLine
30 {
31  class PowerLine;
32  class PhysicalDimension;
33  class Connector;
34  class Unit;
35 
38 
43 }
44 
45 namespace agxUtil
46 {
47  class ConstraintHolder;
48 }
49 
50 namespace agxPowerLine
51 {
52 
55 
56 
61  {
62  public:
63 
64  SubGraph();
65 
70  void setName(const agx::Name& name);
71 
75  const agx::Name& getName() const;
76 
77  SubGraph* getEnclosingGraph();
78  const SubGraph* getEnclosingGraph() const;
79 
80  SubGraph* getRootEnclosingGraph();
81  const SubGraph* getRootEnclosingGraph() const;
82 
83  Unit* getEnclosingUnit();
84  const Unit* getEnclosingUnit() const;
85 
86  Connector* getEnclosingConnector();
87  const Connector* getEnclosingConnector() const;
88 
92  bool isEnclosedWithin(const SubGraph* component) const;
93 
98  virtual void getConnectorsRecursive(ConnectorPtrVector& connectors);
99 
104  virtual void getUnitsRecursive(UnitPtrVector& units);
105 
106 
107  // Methods called by the rest of the PowerLine frame work.
108  public:
109 
110  virtual bool addNotification(agxSDK::Simulation* simulation) =0;
111 
112  virtual void prepareForStore();
113  virtual void prepareForRestore();
114 
115 
116  const agxPowerLine::UnitRefVector& getInternalUnits() const;
117  const agxPowerLine::ConnectorRefVector& getInternalConnectors() const;
118  virtual bool removeNotification(agxUtil::ConstraintHolder* holder, agxSDK::Simulation* simulation) = 0;
119 
120 
121  void spreadPowerLineToGraph();
122 
133  virtual bool preUpdate(agx::Real timeStep);
134  virtual bool postUpdate(agx::Real timeStep);
135 
139  virtual bool store(agxStream::StorageStream& str) const;
140 
144  virtual bool restore(agxStream::StorageStream& str);
145 
147  virtual void restore(agxStream::InputArchive& in) override;
148  virtual void store(agxStream::OutputArchive& out) const override;
149 
150  protected:
151  virtual ~SubGraph();
152 
153  void addInternalUnit(agxPowerLine::Unit* unit);
154  void addInternalConnector(agxPowerLine::Connector* connector);
155 
156  void removeInternalUnit(agxPowerLine::Unit* unit);
157  void removeInternalConnector(agxPowerLine::Connector* connector);
158 
159  agx::Bool replaceInternalUnit(agxPowerLine::Unit* oldUnit, agxPowerLine::Unit* newUnit);
160 
161  protected:
167  };
168 
169 
170 }
171 
172 #endif
InputRef< T > in(const char *name, T &obj)
Create an object with a name and a reference to the object that should be restored (usually a pointer...
Definition: InputArchive.h:400
Links two connections together.
Definition: Connector.h:53
Utility class to hold custom implementations of constraints.
Definition: agxUtil.h:384
SubGraphObserver m_enclosingGraph
Definition: SubGraph.h:162
OutputRef< Serializable > out(const char *name, const Serializable *obj)
Return an object that contain the name and the object that should be serialized to an archive...
AGX_DECLARE_VECTOR_TYPES(SubGraph)
bool Bool
Definition: Integer.h:48
Pure virtual class.
Definition: Unit.h:72
PowerLine * m_powerLine
Definition: SubGraph.h:165
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:248
Representation of a name string.
Definition: Name.h:32
Base class providing referencing counted objects.
Definition: Referenced.h:113
Templated vector class.
Definition: Vector.h:52
agx::Vector< UnitRef > UnitRefVector
Definition: Connector.h:47
agx::ref_ptr< Unit > UnitRef
Definition: Connector.h:46
agx::Vector< ConnectorRef > ConnectorRefVector
Definition: Connector.h:406
Class for reading a binary stream of serialized data.
Definition: InputArchive.h:51
Abstract base class for storing/restoring a line/drums with version control.
Definition: StorageStream.h:48
agx::Vector< Unit * > UnitPtrVector
UnitRefVector m_internalUnits
Definition: SubGraph.h:163
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
Definition: Serializable.h:44
Class for writing serialized data in binary format to a stream.
Definition: OutputArchive.h:56
agx::ref_ptr< Connector > ConnectorRef
Definition: Connector.h:405
Simulation is a class that bridges the collision space agxCollide::Space and the dynamic simulation s...
Definition: Simulation.h:121
#define AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE(T)
Use this in a pure abstract Serializable class to add the required methods Important: Use full namesp...
Definition: Serializable.h:220
#define AGXMODEL_EXPORT
double Real
Definition: Real.h:42
PowerLine is the base class for a system of power transfer integrated into the rigid body simulation...
Definition: PowerLine.h:70
ConnectorRefVector m_internalConnectors
Definition: SubGraph.h:164
agx::Vector< Connector * > ConnectorPtrVector
Definition: Connector.h:402