60#ifndef guWhiteboard_FrequencyLimits_h
61#define guWhiteboard_FrequencyLimits_h
63#ifdef WHITEBOARD_POSTER_STRING_CONVERSION
72#undef guWhiteboard_FrequencyLimits_DEFINED
73#define guWhiteboard_FrequencyLimits_DEFINED
75#undef FrequencyLimits_DEFINED
76#define FrequencyLimits_DEFINED
90 void init(int16_t t_lo_freq = 0, int16_t t_hi_freq = 0) {
101 this->init(t_lo_freq, t_hi_freq);
142 return !(*
this == t_other);
152 return !(*
this == t_other);
185#ifdef WHITEBOARD_POSTER_STRING_CONVERSION
195#ifdef USE_WB_FREQUENCY_LIMITS_C_CONVERSION
198 std::string descr = buffer;
201 std::ostringstream ss;
202 ss <<
"lo_freq=" <<
static_cast<signed>(this->
lo_freq());
204 ss <<
"hi_freq=" <<
static_cast<signed>(this->
hi_freq());
210#ifdef USE_WB_FREQUENCY_LIMITS_C_CONVERSION
213 std::string toString = buffer;
216 std::ostringstream ss;
217 ss << static_cast<signed>(this->
lo_freq());
219 ss << static_cast<signed>(this->
hi_freq());
224#ifdef USE_WB_FREQUENCY_LIMITS_C_CONVERSION
229 char * str_cstr =
const_cast<char *
>(t_str.c_str());
230 size_t temp_length = strlen(str_cstr);
231 int length = (temp_length <= INT_MAX) ? static_cast<int>(
static_cast<ssize_t
>(temp_length)) : -1;
236 char* var_str = &var_str_buffer[0];
238 char* key = &key_buffer[0];
245 if (index == 0 && str_cstr[0] ==
'{') {
251 for (
int i = index; i < length; i++) {
253 if (bracecount == 0 && str_cstr[i] ==
'=') {
258 if (bracecount == 0 && isspace(str_cstr[i])) {
265 if (bracecount == 0 && str_cstr[i] ==
',') {
269 if (str_cstr[i] ==
'{') {
273 if (str_cstr[i] ==
'}') {
275 if (bracecount < 0) {
280 if (i == length - 1) {
284 if (endKey >= startKey && endKey - startKey < length) {
285 strncpy(key, str_cstr + startKey,
static_cast<size_t>((endKey - startKey) + 1));
286 key[(endKey - startKey) + 1] = 0;
290 strncpy(var_str, str_cstr + startVar,
static_cast<size_t>((index - startVar) + 1));
291 var_str[(index - startVar) + 1] = 0;
297 if (strlen(key) > 0) {
298 if (0 == strcmp(
"lo_freq", key)) {
300 }
else if (0 == strcmp(
"hi_freq", key)) {
310 this->
set_lo_freq(
static_cast<int16_t
>(atoi(var_str)));
315 this->
set_hi_freq(
static_cast<int16_t
>(atoi(var_str)));
322 }
while(index < length);
Provides a C++ wrapper around wb_frequency_limits.
const int16_t & lo_freq() const
void set_hi_freq(const int16_t &t_newValue)
FrequencyLimits(const struct wb_frequency_limits &t_other)
Copy Constructor.
std::string description()
FrequencyLimits(int16_t t_lo_freq=0, int16_t t_hi_freq=0)
Create a new FrequencyLimits.
FrequencyLimits & operator=(const FrequencyLimits &t_other)
Copy Assignment Operator.
const int16_t & hi_freq() const
void set_lo_freq(const int16_t &t_newValue)
bool operator==(const FrequencyLimits &t_other) const
FrequencyLimits(const std::string &t_str)
String Constructor.
bool operator!=(const FrequencyLimits &t_other) const
void from_string(const std::string &t_str)
FrequencyLimits(const FrequencyLimits &t_other)
Copy Constructor.
WHITEBOARD_POSTER_STRING_CONVERSION.
int16_t hi_freq
high frequency bound in Hz
int16_t lo_freq
low frequency bound in Hz
const char * wb_frequency_limits_to_string(const struct wb_frequency_limits *self, char *toString, size_t bufferSize)
Convert to a string.
struct wb_frequency_limits * wb_frequency_limits_from_string(struct wb_frequency_limits *self, const char *str)
Convert from a string.
const char * wb_frequency_limits_description(const struct wb_frequency_limits *self, char *descString, size_t bufferSize)
Convert to a description string.
#define FREQUENCY_LIMITS_DESC_BUFFER_SIZE
#define FREQUENCY_LIMITS_TO_STRING_BUFFER_SIZE