AGX Dynamics  2.35.0.1
PackingInfo.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 #ifndef AGXPOWERLINE_DETAIL_PACKING_INFO
18 #define AGXPOWERLINE_DETAIL_PACKING_INFO
19 
20 #include <agx/Integer.h>
21 #include <agx/Vector.h>
22 
23 namespace agx
24 {
25  class RigidBody;
26 }
27 
28 namespace agxStream
29 {
30  class InputArchive;
31  class OutputArchive;
32 }
33 
34 namespace agxPowerLine
35 {
36  namespace detail
37  {
38  struct Rotational;
39  template <typename DimensionType> class DimensionState1Dof;
40  using Rotational1DofState = DimensionState1Dof<Rotational>;
41  }
42 }
43 
44 namespace agxPowerLine
45 {
46  namespace detail
47  {
56  {
57  public:
58 
63 
69 
71 
72  const Rotational1DofState* operator[](const agx::UInt8 slot) const;
73 
75 
77 
78  bool contains(const Rotational1DofState* dimension) const;
79 
80  bool contains(const agx::RigidBody* body) const;
81 
82  bool isEmpty() const;
83 
84  bool isFull() const;
85 
86  int getSize() const;
87 
89 
91 
92  void erase(const Rotational1DofState* dimension);
93 
94  void newSlot(Rotational1DofState* dimension);
95 
96  void assertValid() const;
97 
100 
101  private:
102  // Mapping between the dimension state and slots in a RigidBody.
103  // All dimension states use the same body, and m_dimensions[i] use slot i
104  // in the RigidBody.
105  Rotational1DofState* m_dimensions[3];
106  };
107 
109  }
110 }
111 
112 #endif
Templated one dimensional dimension state.
Information about which DimensionState1Dof is using which slot in a RigidBody.
Definition: PackingInfo.h:56
void store(agxStream::OutputArchive &out) const
bool contains(const agx::RigidBody *body) const
PackingInfo()
A default-constructed PackingInfo is empty, i.e., it tracks no PhysicalDimension.
Rotational1DofState ** begin()
const Rotational1DofState * operator[](const agx::UInt8 slot) const
void newSlot(Rotational1DofState *dimension)
bool contains(const Rotational1DofState *dimension) const
void restore(agxStream::InputArchive &in)
PackingInfo(Rotational1DofState *dimension)
A packing info tracking the given dimension only.
Rotational1DofState *& operator[](const agx::UInt8 slot)
Rotational1DofState ** end()
void erase(const Rotational1DofState *dimension)
Class for reading a binary stream of serialized data.
Definition: InputArchive.h:52
Class for writing serialized data in binary format to a stream.
Definition: OutputArchive.h:57
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:55
DimensionState1Dof< Rotational > Rotational1DofState
agxPowerLine contains a collection of connected components that transport power across a system.
Definition: MotorUnit.h:24
This namespace contain classes for streaming classes into archives, ASCII, binary for storage (serial...
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
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.
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
uint8_t UInt8
Definition: Integer.h:38