Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
facontidavide committed Feb 1, 2024
1 parent 09ea588 commit f321175
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
9 changes: 3 additions & 6 deletions data_tamer_cpp/include/data_tamer/channel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class LoggedValue
* @param value new value
* @param auto_enable if true and the current instance is disabled, call setEnabled(true)
*/
void set(const T& value, bool auto_enable = false);
void set(const T& value, bool auto_enable = true);

/// @brief get the stored value.
[[nodiscard]] T get();
Expand Down Expand Up @@ -416,7 +416,7 @@ inline void LoggedValue<T>::set(const T& val, bool auto_enable)
if (auto channel = channel_.lock())
{
value_ = val;
if (auto_enable)
if (!enabled_ && auto_enable)
{
channel->setEnabled(id_, true);
enabled_ = true;
Expand All @@ -425,10 +425,7 @@ inline void LoggedValue<T>::set(const T& val, bool auto_enable)
else
{
value_ = val;
if (!enabled_ && auto_enable)
{
enabled_ = true;
}
enabled_ |= auto_enable;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,11 @@ bool TypeField::operator==(const TypeField& other) const
inline Schema BuilSchemaFromText(const std::string& txt)
{
auto trimString = [](std::string& str) {
while (str.back() == ' ' || str.back() == '\r')
while (!str.empty() && (str.back() == ' ' || str.back() == '\r'))
{
str.pop_back();
}
while (str.front() == ' ' || str.front() == '\r')
while (!str.empty() && (str.front() == ' ' || str.front() == '\r'))
{
str.erase(0, 1);
}
Expand Down

0 comments on commit f321175

Please sign in to comment.