AGX Dynamics  2.38.0.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 
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
agxPowerLine::detail::PackingInfo::getSize
int getSize() const
Vector.h
agxPowerLine::detail::PackingInfo
Information about which DimensionState1Dof is using which slot in a RigidBody.
Definition: PackingInfo.h:55
agx::Vector< agxPowerLine::detail::PackingInfo >
agxStream::out
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.
Definition: OutputArchive.h:412
agx::RigidBody
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:51
agxPowerLine::detail::PackingInfo::getBody
agx::RigidBody * getBody()
agxPowerLine::detail::PackingInfo::getFreeSlot
agx::UInt8 getFreeSlot() const
agxPowerLine::detail::PackingInfo::newSlot
void newSlot(Rotational1DofState *dimension)
agxPowerLine::detail::PackingInfo::isFull
bool isFull() const
agxPowerLine::detail::PackingInfo::begin
Rotational1DofState ** begin()
agx
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
Definition: AddedMassInteraction.h:22
agxStream::in
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:399
agx::UInt8
uint8_t UInt8
Definition: Integer.h:30
Integer.h
agxPowerLine::detail::PackingInfo::assertValid
void assertValid() const
agxPowerLine::detail::PackingInfo::isEmpty
bool isEmpty() const
agxPowerLine::detail::PackingInfo::contains
bool contains(const Rotational1DofState *dimension) const
agxPowerLine::detail::Rotational1DofState
DimensionState1Dof< Rotational > Rotational1DofState
Definition: DimensionState.h:453
agxStream::OutputArchive
Class for writing serialized data in binary format to a stream.
Definition: OutputArchive.h:56
agxPowerLine::detail::PackingInfo::store
void store(agxStream::OutputArchive &out) const
agxStream::InputArchive
Class for reading a binary stream of serialized data.
Definition: InputArchive.h:50
agxPowerLine
agxPowerLine contains a collection of connected components that transport power across a system.
Definition: MotorUnit.h:23
agxPowerLine::detail::PackingInfo::restore
void restore(agxStream::InputArchive &in)
agxPowerLine::detail::PackingInfo::end
Rotational1DofState ** end()
agxPowerLine::detail::DimensionState1Dof
Templated one dimensional dimension state.
Definition: DimensionState.h:210
agxStream
This namespace contain classes for streaming classes into archives, ASCII, binary for storage (serial...
Definition: ElementaryConstraint.h:31
agxPowerLine::detail::PackingInfo::operator[]
Rotational1DofState *& operator[](const agx::UInt8 slot)
agxPowerLine::detail::PackingInfo::erase
void erase(const Rotational1DofState *dimension)
agxPowerLine::detail::PackingInfo::PackingInfo
PackingInfo()
A default-constructed PackingInfo is empty, i.e., it tracks no PhysicalDimension.