63#ifdef WHITEBOARD_POSTER_STRING_CONVERSION
87 void set(
int pin,
bool value) { value ?
set(pin) :
clr(pin); }
90 void reset(
int value = 0) { memset(
this, value,
sizeof(*
this)); }
93 bool operator==(
const IOPins &other)
const {
return memcmp(
this, &other,
sizeof(*
this)) == 0; }
95#ifdef WHITEBOARD_POSTER_STRING_CONVERSION
102 std::ostringstream ss;
108 ss << (first ?
"" :
",") << i;
118 std::istringstream iss(str);
120 for (
int i = 0; i < static_cast<int>(
IO_PIN_BIT_SIZE) && getline(iss, token,
','); i++)
122 const int n = atoi(token.c_str());
Class for controlling and getting the status of IO pins.
std::string description() const
convert to a string
IOPins(const std::string &pinvalues)
string constructor
bool get(int pin) const
pin value setter
void set(int pin, bool value)
set the given pin to the given value
void reset(int value=0)
set all pins to the given value
void from_string(const std::string &str)
convert from a string
bool operator==(const IOPins &other) const
comparison operator
void set(int pin)
pin value setter
void clr(int pin)
clear the given pin
#define IO_PIN_BIT_SIZE
bits available