aikido
ScopedState.hpp
1 #ifndef AIKIDO_STATESPACE_SCOPEDSTATE_HPP_
2 #define AIKIDO_STATESPACE_SCOPEDSTATE_HPP_
3 #include <memory>
4 
5 #include "aikido/statespace/StateHandle.hpp"
6 
7 namespace aikido {
8 namespace statespace {
9 
14 template <class _Handle>
15 class ScopedState : public _Handle
16 {
17 public:
18  using Handle = _Handle;
19  using typename Handle::QualifiedState;
20  using typename Handle::State;
21  using typename Handle::StateSpace;
22 
27  explicit ScopedState(const StateSpace* _space);
28 
29  virtual ~ScopedState();
30 
31  // ScopedState is uncopyable, must use std::move
32  ScopedState(const ScopedState&) = delete;
33  ScopedState& operator=(const ScopedState&) = delete;
34 
35  ScopedState(ScopedState&&) = default;
36  ScopedState& operator=(ScopedState&&) = default;
37 
39  ScopedState clone() const;
40 
41 private:
42  std::unique_ptr<char[]> mBuffer;
43 };
44 
45 } // namespace statespace
46 } // namespace aikido
47 
48 #include "detail/ScopedState-impl.hpp"
49 
50 #endif // ifndef AIKIDO_STATESPACE_SCOPEDSTATE_HPP_
CRTP RAII wrapper for a StateHandle.
Definition: ScopedState.hpp:15
ScopedState(const StateSpace *_space)
Construct a ScopedState by allocating a new state in _space.
Definition: ScopedState-impl.hpp:8
Format of serialized trajectory in YAML.
Definition: algorithm.hpp:4
Represents a Lie group and its associated Lie algebra, i.e.
Definition: StateSpace.hpp:33
ScopedState clone() const
Creates an identical clone of the state this ScopedState handles.
Definition: ScopedState-impl.hpp:25