Loading [MathJax]/extensions/TeX/AMSmath.js
Radium Engine  1.5.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
Sequence.hpp
1 #pragma once
2 
3 #include <Core/Animation/Pose.hpp>
4 #include <Core/CoreMacros.hpp>
5 #include <Core/Utils/CircularIndex.hpp>
6 #include <vector>
7 
8 namespace Ra {
9 namespace Core {
10 namespace Animation {
11 
12 using Frame = Pose;
13 using FrameSet = std::vector<Frame>;
14 
19 class Sequence
20 {
21  public:
23  // Specify if the sequence stores trasformations to be applied or
24  // poses to be assigned.
25  enum class PoseType { Pose_RELATIVE, Pose_ABSOLUTE };
26 
28  Sequence(); // Default constructor
29  Sequence( const Sequence& sequence ); // Copy constructor
30 
32  virtual ~Sequence();
33 
35  virtual uint size() const = 0; // Return the size of the sequence
36  virtual void clear(); // Clear the sequence. By default does nothing
37 
39  inline bool isEmpty() const; // Return true if the size of the sequence is equal to zero
40 
42  inline PoseType getPoseType() const; // Get the type of the poses stored
43  inline void setPoseType( const PoseType& type ); // Set the type of the poses stored
44 
46  virtual FrameSet getSequence() const = 0; // Return the set of frames
47  virtual void setSequence( const FrameSet& set ); // Set the frame set
48 
50  virtual Frame frame( const int i ) const = 0; // Get the i-th frame.
51  virtual void setFrame( const int i, const Frame& frame ); // Set the i-th frame to frame
52 
53  inline Frame nextFrame() const; // Return the frame in the next position
54  inline Frame prevFrame() const; // Return the frame in the prev position
55  inline Frame currentFrame() const; // Return the frame in the current position
56  inline Frame firstFrame() const; // Return the frame in the first position
57  inline Frame lastFrame() const; // Return the frame in the last position
58 
60  inline uint nextFrameIndex() const; // Return the index of the next frame
61  inline uint prevFrameIndex() const; // Return the index of the prev frame
62  inline uint currentFrameIndex() const; // Return the index of the current frame
63  inline uint firstFrameIndex() const; // Return the index of the first frame
64  inline uint lastFrameIndex() const; // Return the index of the last frame
65 
67  virtual void insertFrame( const Frame& frame,
68  const int i ); // Insert a frame at the i-th position
69  inline void insertNext( const Frame& frame ); // Insert a frame at the next position
70  inline void insertPrev( const Frame& frame ); // Insert a frame at the prev position
71  inline void insertCurrent( const Frame& frame ); // Insert a frame at the current position
72  inline void insertFirst( const Frame& frame ); // Insert a frame at the first position
73  inline void insertLast( const Frame& frame ); // Insert a frame at the last position
74 
76  virtual void removeFrame( const int i ); // Remove the frame at the i-th position
77  inline void removeNext(); // Remove the frame at the next position
78  inline void removePrev(); // Remove the frame at the prev position
79  inline void removeCurrent(); // Remove the frame at the current position
80  inline void removeFirst(); // Remove the frame at the first position
81  inline void removeLast(); // Remove the frame at the last position
82 
84  inline void moveToFrame( const int i ); // Move to frame i
85  inline void moveToNextFrame(); // Move to next frame
86  inline void moveToPrevFrame(); // Move to prev frame
87  inline void moveToFirstFrame(); // Move to first frame
88  inline void moveToLastFrame(); // Move to last frame
89  inline void reset(); // Reset the sequence
90 
91  private:
93  Utils::CircularIndex m_idx;
94  PoseType m_type;
95 };
96 
97 } // namespace Animation
98 } // namespace Core
99 } // namespace Ra
virtual FrameSet getSequence() const =0
SEQUENCE INTERFACE.
virtual uint size() const =0
SIZE INTERFACE.
bool isEmpty() const
QUERY.
virtual void clear()
INTERFACE.
Definition: Sequence.cpp:16
virtual ~Sequence()
DESTRUCTOR.
Definition: Sequence.cpp:13
virtual void insertFrame(const Frame &frame, const int i)
INSERT POSE.
Definition: Sequence.cpp:19
virtual Frame frame(const int i) const =0
POSE INTERFACE.
PoseType getPoseType() const
POSE TYPE.
virtual void removeFrame(const int i)
REMOVE POSE.
Definition: Sequence.cpp:20
void moveToFrame(const int i)
SEQUENCE FLOW.
uint nextFrameIndex() const
INDEX.
Definition: Cage.cpp:3