Control Libraries 7.4.0
Loading...
Searching...
No Matches
SpatialState.hpp
1#pragma once
2
3#include "state_representation/State.hpp"
4
5namespace state_representation {
6
7class SpatialState : public State {
8public:
13
19 explicit SpatialState(const std::string& name, const std::string& reference_frame = "world");
20
24 SpatialState(const SpatialState& state);
25
31 friend void swap(SpatialState& state1, SpatialState& state2);
32
38 SpatialState& operator=(const SpatialState& state);
39
43 const std::string& get_reference_frame() const;
44
48 virtual void set_reference_frame(const std::string& reference_frame);
49
54 bool is_incompatible(const State& state) const override;
55
62 friend std::ostream& operator<<(std::ostream& os, const SpatialState& state);
63
64protected:
68 std::string to_string() const override;
69
70private:
71 std::string reference_frame_;
72};
73
74inline void swap(SpatialState& state1, SpatialState& state2) {
75 swap(static_cast<State&>(state1), static_cast<State&>(state2));
76 std::swap(state1.reference_frame_, state2.reference_frame_);
77}
78
79}// namespace state_representation
virtual void set_reference_frame(const std::string &reference_frame)
Setter of the reference frame.
bool is_incompatible(const State &state) const override
Check if the spatial state is incompatible for operations with the state given as argument.
SpatialState & operator=(const SpatialState &state)
Copy assignment operator that has to be defined to the custom assignment operator.
std::string to_string() const override
Convert the state to its string representation.
friend std::ostream & operator<<(std::ostream &os, const SpatialState &state)
Overload the ostream operator for printing.
const std::string & get_reference_frame() const
Getter of the reference frame as const reference.
friend void swap(SpatialState &state1, SpatialState &state2)
Swap the values of the two SpatialState.
Abstract class to represent a state.
Definition State.hpp:25
Core state variables and objects.
void swap(AnalogIOState &state1, AnalogIOState &state2)