Control Libraries 7.4.0
Loading...
Searching...
No Matches
AnalogIOState.hpp
1#pragma once
2
3#include "state_representation/IOState.hpp"
4
6
7class AnalogIOState : public IOState<double> {
8public:
13
19 explicit AnalogIOState(const std::string& name, unsigned int nb_ios = 0);
20
26 AnalogIOState(const std::string& name, const std::vector<std::string>& io_names);
27
32 AnalogIOState(const AnalogIOState& state);
33
40 static AnalogIOState Zero(const std::string& name, unsigned int nb_ios);
41
48 static AnalogIOState Zero(const std::string& name, const std::vector<std::string>& names);
49
56 static AnalogIOState Random(const std::string& name, unsigned int nb_ios);
57
64 static AnalogIOState Random(const std::string& name, const std::vector<std::string>& names);
65
72
76 AnalogIOState copy() const;
77
81 void reset() override;
82
86 void set_zero();
87
94 friend std::ostream& operator<<(std::ostream& os, const AnalogIOState& state);
95
96protected:
97
103 friend void swap(AnalogIOState& state1, AnalogIOState& state2);
104
108 std::string to_string() const override;
109};
110
111inline void swap(AnalogIOState& state1, AnalogIOState& state2) {
112 swap(static_cast<IOState<double>&>(state1), static_cast<IOState<double>&>(state2));
113}
114
115}// namespace state_representation
void reset() override
Reset the object to a post-construction state.
static AnalogIOState Zero(const std::string &name, unsigned int nb_ios)
Constructor for a zero analog IO state.
std::string to_string() const override
Convert the state to its string representation.
AnalogIOState()
Empty constructor for an analog IO state.
friend void swap(AnalogIOState &state1, AnalogIOState &state2)
Swap the values of the IO states.
void set_zero()
Set the analog IO state to zero data.
AnalogIOState copy() const
Return a copy of the analog IO state.
AnalogIOState & operator=(const AnalogIOState &state)
Copy assignment operator that has to be defined to the custom assignment operator.
static AnalogIOState Random(const std::string &name, unsigned int nb_ios)
Constructor for an analog IO state with random data.
friend std::ostream & operator<<(std::ostream &os, const AnalogIOState &state)
Overload the ostream operator for printing.
Core state variables and objects.
void swap(AnalogIOState &state1, AnalogIOState &state2)