AGXDynamics  2.31.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PackingInfo.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 #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 
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 
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;
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
void restore(agxStream::InputArchive &in)
Rotational1DofState ** end()
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...
Rotational1DofState *& operator[](const agx::UInt8 slot)
uint8_t UInt8
Definition: Integer.h:38
void erase(const Rotational1DofState *dimension)
DimensionState1Dof< Rotational > Rotational1DofState
agx::UInt8 getFreeSlot() const
Information about which DimensionState1Dof is using which slot in a RigidBody.
Definition: PackingInfo.h:55
bool contains(const Rotational1DofState *dimension) const
PackingInfo()
A default-constructed PackingInfo is empty, i.e., it tracks no PhysicalDimension. ...
Templated one dimensional dimension state.
void store(agxStream::OutputArchive &out) const
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:52
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
Rotational1DofState ** begin()
void newSlot(Rotational1DofState *dimension)