AGX Dynamics  2.37.3.2
PackingInfo.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 
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 
62  PackingInfo();
63 
68  PackingInfo(Rotational1DofState* dimension);
69 
70  Rotational1DofState*& operator[](const agx::UInt8 slot);
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 
88  agx::UInt8 getFreeSlot() const;
89 
90  agx::RigidBody* getBody();
91 
92  void erase(const Rotational1DofState* dimension);
93 
94  void newSlot(Rotational1DofState* dimension);
95 
96  void assertValid() const;
97 
98  void store(agxStream::OutputArchive& out) const;
99  void restore(agxStream::InputArchive& in);
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
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...
uint8_t UInt8
Definition: Integer.h:38
DimensionState1Dof< Rotational > Rotational1DofState
agxPowerLine contains a collection of connected components that transport power across a system...
Definition: MotorUnit.h:23
Information about which DimensionState1Dof is using which slot in a RigidBody.
Definition: PackingInfo.h:55
Templated one dimensional dimension state.
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
LinearProbingHashSetImplementation< KeyT, HashT >::iterator begin(LinearProbingHashSetImplementation< KeyT, HashT > &set)
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:54
Class for reading a binary stream of serialized data.
Definition: InputArchive.h:51
Class for writing serialized data in binary format to a stream.
Definition: OutputArchive.h:56
LinearProbingHashSetImplementation< KeyT, HashT >::iterator end(LinearProbingHashSetImplementation< KeyT, HashT > &set)
This namespace contain classes for streaming classes into archives, ASCII, binary for storage (serial...