Helios++
Helios software for LiDAR simulations
DynSequentiableMovingObject.h
1 #pragma once
2 
3 #include <scene/dynamic/DynMovingObject.h>
4 #include <scene/dynamic/DynSequencer.h>
5 
21 private:
22  // *** SERIALIZATION *** //
23  // *********************** //
24  friend class boost::serialization::access;
33  template <typename Archive>
34  void serialize(Archive &ar, const unsigned int version){
35  boost::serialization::void_cast_register<
38  >();
39  ar &boost::serialization::base_object<
41  >(*this);
42  ar &dmSequencer;
43  }
44 
45 protected:
46  // *** ATTRIBUTES *** //
47  // ******************** //
52 
53 public:
54  // *** CONSTRUCTION / DESTRUCTION *** //
55  // ************************************ //
64  ScenePart const &sp,
65  bool const shallowPrimitives=false
66  ) : DynMovingObject(sp, shallowPrimitives) {}
70  DynSequentiableMovingObject(string const id) : DynMovingObject(id) {}
74  DynSequentiableMovingObject(vector<Primitive *> const &primitives) :
75  DynMovingObject(primitives)
76  {}
81  string const id,
82  vector<Primitive *> const &primitives
83  ) : DynMovingObject(id, primitives)
84  {}
85  virtual ~DynSequentiableMovingObject() = default;
86 
87  // *** DYNAMIC BEHAVIOR *** //
88  // ************************** //
100  bool doSimStep() override;
101 protected:
106  void fillMotionQueues();
107 
108 public:
109  // *** GETTERs and SETTERs *** //
110  // ***************************** //
117  inline void addSequence(shared_ptr<DynSequence<DynMotion>> dmSequence)
118  {return dmSequencer.add(dmSequence);}
126  inline void removeSequence(string const & id)
127  {return dmSequencer.remove(id);}
136  inline shared_ptr<DynSequence<DynMotion>> getSequence(string const &id)
137  {return dmSequencer.get(id);}
147  inline bool hasSequences(string const &id) {return dmSequencer.has(id);}
153  inline void clearSequences() {dmSequencer.clear();}
154 };
Implementation of a dynamic object which supports dynamic motions (extended rigid motions)
Definition: DynMovingObject.h:39
Dynamic sequence is a set of elements that must be applied during dynamic simulations to provide dyna...
Definition: DynSequence.h:37
bool has(string const &id)
Check if the dynamic sequencer has a dynamic sequence with given identifier.
Definition: DynSequencer.h:109
void add(shared_ptr< DynSequence< T >> dynseq)
Add the dynamic sequence to the sequencer.
shared_ptr< DynSequence< T > > get(string const &id)
Get the dynamic sequence with given identifier.
void clear()
Remove all dynamic sequences composing the dynamic sequencer.
Definition: DynSequencer.h:114
void remove(string const &id)
Remove the dynamic sequence with given identifier.
Definition: DynSequencer.h:95
Implementation of a dynamic object which supports sequentiable dynamic motions.
Definition: DynSequentiableMovingObject.h:20
void fillMotionQueues()
Fill motion queues with dynamic motions coming from dynamic sequencer.
Definition: DynSequentiableMovingObject.cpp:17
DynSequencer< DynMotion > dmSequencer
Dynamic motion sequencer.
Definition: DynSequentiableMovingObject.h:51
DynSequentiableMovingObject(string const id)
Definition: DynSequentiableMovingObject.h:70
DynSequentiableMovingObject(string const id, vector< Primitive * > const &primitives)
Definition: DynSequentiableMovingObject.h:80
void addSequence(shared_ptr< DynSequence< DynMotion >> dmSequence)
Add the dynamic sequence of dynamic motions to the dynamic motion sequencer.
Definition: DynSequentiableMovingObject.h:117
DynSequentiableMovingObject(vector< Primitive * > const &primitives)
Definition: DynSequentiableMovingObject.h:74
void serialize(Archive &ar, const unsigned int version)
Serialize a dynamic sequentiable moving object o a stream of bytes.
Definition: DynSequentiableMovingObject.h:34
void clearSequences()
Remove all dynamic sequences of dynamic motions composing the dynamic sequencer.
Definition: DynSequentiableMovingObject.h:153
DynSequentiableMovingObject(ScenePart const &sp, bool const shallowPrimitives=false)
Definition: DynSequentiableMovingObject.h:63
shared_ptr< DynSequence< DynMotion > > getSequence(string const &id)
Get the dynamic sequence of dynamic motions with given identifier.
Definition: DynSequentiableMovingObject.h:136
void removeSequence(string const &id)
Remove the dynamic sequence of dynamic motions with given identifier.
Definition: DynSequentiableMovingObject.h:126
bool doSimStep() override
Sequentiable dynamic motions behavior implementation.
Definition: DynSequentiableMovingObject.cpp:9
bool hasSequences(string const &id)
Check if the dynamic sequencer has a dynamic sequence of dynamic motions with given identifier.
Definition: DynSequentiableMovingObject.h:147
Class representing a scene part.
Definition: ScenePart.h:20