Message ID | 20200229164254.23604-8-laurent.pinchart@ideasonboard.com |
---|---|
State | Superseded |
Headers | show |
Series |
|
Related | show |
Heya, On 29/02/2020 16:42, Laurent Pinchart wrote: > From: Jacopo Mondi <jacopo@jmondi.org> > > Reorder functions in ControlValue class to group const methods together. > > Cosmetic change only. Well ok then... > > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> The code moves in the header vs the cpp differ, but that could be because they were out of sync already or git decided to match different hunks moving? Otherwise as it's cosmetic only I think we can assume it's safe: Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > --- > include/libcamera/controls.h | 10 ++-- > src/libcamera/controls.cpp | 94 ++++++++++++++++++------------------ > 2 files changed, 52 insertions(+), 52 deletions(-) > > diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h > index 458b84e8fa8c..9f8a9031bd74 100644 > --- a/include/libcamera/controls.h > +++ b/include/libcamera/controls.h > @@ -33,11 +33,6 @@ public: > ControlType type() const { return type_; } > bool isNone() const { return type_ == ControlTypeNone; } > > - template<typename T> > - const T &get() const; > - template<typename T> > - void set(const T &value); > - > std::string toString() const; > > bool operator==(const ControlValue &other) const; > @@ -46,6 +41,11 @@ public: > return !(*this == other); > } > > + template<typename T> > + const T &get() const; > + template<typename T> > + void set(const T &value); > + > private: > ControlType type_; > > diff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp > index 0031cd064da9..613e6d768c0f 100644 > --- a/src/libcamera/controls.cpp > +++ b/src/libcamera/controls.cpp > @@ -112,6 +112,53 @@ ControlValue::ControlValue(int64_t value) > * \return True if the value type is ControlTypeNone, false otherwise > */ > > +/** > + * \brief Assemble and return a string describing the value > + * \return A string describing the ControlValue > + */ > +std::string ControlValue::toString() const > +{ > + switch (type_) { > + case ControlTypeNone: > + return "<None>"; > + case ControlTypeBool: > + return bool_ ? "True" : "False"; > + case ControlTypeInteger32: > + return std::to_string(integer32_); > + case ControlTypeInteger64: > + return std::to_string(integer64_); > + } > + > + return "<ValueType Error>"; > +} > + > +/** > + * \brief Compare ControlValue instances for equality > + * \return True if the values have identical types and values, false otherwise > + */ > +bool ControlValue::operator==(const ControlValue &other) const > +{ > + if (type_ != other.type_) > + return false; > + > + switch (type_) { > + case ControlTypeBool: > + return bool_ == other.bool_; > + case ControlTypeInteger32: > + return integer32_ == other.integer32_; > + case ControlTypeInteger64: > + return integer64_ == other.integer64_; > + default: > + return false; > + } > +} > + > +/** > + * \fn bool ControlValue::operator!=() > + * \brief Compare ControlValue instances for non equality > + * \return False if the values have identical types and values, true otherwise > + */ > + > /** > * \fn template<typename T> const T &ControlValue::get() const > * \brief Get the control value > @@ -175,53 +222,6 @@ void ControlValue::set<int64_t>(const int64_t &value) > } > #endif /* __DOXYGEN__ */ > > -/** > - * \brief Assemble and return a string describing the value > - * \return A string describing the ControlValue > - */ > -std::string ControlValue::toString() const > -{ > - switch (type_) { > - case ControlTypeNone: > - return "<None>"; > - case ControlTypeBool: > - return bool_ ? "True" : "False"; > - case ControlTypeInteger32: > - return std::to_string(integer32_); > - case ControlTypeInteger64: > - return std::to_string(integer64_); > - } > - > - return "<ValueType Error>"; > -} > - > -/** > - * \brief Compare ControlValue instances for equality > - * \return True if the values have identical types and values, false otherwise > - */ > -bool ControlValue::operator==(const ControlValue &other) const > -{ > - if (type_ != other.type_) > - return false; > - > - switch (type_) { > - case ControlTypeBool: > - return bool_ == other.bool_; > - case ControlTypeInteger32: > - return integer32_ == other.integer32_; > - case ControlTypeInteger64: > - return integer64_ == other.integer64_; > - default: > - return false; > - } > -} > - > -/** > - * \fn bool ControlValue::operator!=() > - * \brief Compare ControlValue instances for non equality > - * \return False if the values have identical types and values, true otherwise > - */ > - > /** > * \class ControlId > * \brief Control static metadata >
diff --git a/include/libcamera/controls.h b/include/libcamera/controls.h index 458b84e8fa8c..9f8a9031bd74 100644 --- a/include/libcamera/controls.h +++ b/include/libcamera/controls.h @@ -33,11 +33,6 @@ public: ControlType type() const { return type_; } bool isNone() const { return type_ == ControlTypeNone; } - template<typename T> - const T &get() const; - template<typename T> - void set(const T &value); - std::string toString() const; bool operator==(const ControlValue &other) const; @@ -46,6 +41,11 @@ public: return !(*this == other); } + template<typename T> + const T &get() const; + template<typename T> + void set(const T &value); + private: ControlType type_; diff --git a/src/libcamera/controls.cpp b/src/libcamera/controls.cpp index 0031cd064da9..613e6d768c0f 100644 --- a/src/libcamera/controls.cpp +++ b/src/libcamera/controls.cpp @@ -112,6 +112,53 @@ ControlValue::ControlValue(int64_t value) * \return True if the value type is ControlTypeNone, false otherwise */ +/** + * \brief Assemble and return a string describing the value + * \return A string describing the ControlValue + */ +std::string ControlValue::toString() const +{ + switch (type_) { + case ControlTypeNone: + return "<None>"; + case ControlTypeBool: + return bool_ ? "True" : "False"; + case ControlTypeInteger32: + return std::to_string(integer32_); + case ControlTypeInteger64: + return std::to_string(integer64_); + } + + return "<ValueType Error>"; +} + +/** + * \brief Compare ControlValue instances for equality + * \return True if the values have identical types and values, false otherwise + */ +bool ControlValue::operator==(const ControlValue &other) const +{ + if (type_ != other.type_) + return false; + + switch (type_) { + case ControlTypeBool: + return bool_ == other.bool_; + case ControlTypeInteger32: + return integer32_ == other.integer32_; + case ControlTypeInteger64: + return integer64_ == other.integer64_; + default: + return false; + } +} + +/** + * \fn bool ControlValue::operator!=() + * \brief Compare ControlValue instances for non equality + * \return False if the values have identical types and values, true otherwise + */ + /** * \fn template<typename T> const T &ControlValue::get() const * \brief Get the control value @@ -175,53 +222,6 @@ void ControlValue::set<int64_t>(const int64_t &value) } #endif /* __DOXYGEN__ */ -/** - * \brief Assemble and return a string describing the value - * \return A string describing the ControlValue - */ -std::string ControlValue::toString() const -{ - switch (type_) { - case ControlTypeNone: - return "<None>"; - case ControlTypeBool: - return bool_ ? "True" : "False"; - case ControlTypeInteger32: - return std::to_string(integer32_); - case ControlTypeInteger64: - return std::to_string(integer64_); - } - - return "<ValueType Error>"; -} - -/** - * \brief Compare ControlValue instances for equality - * \return True if the values have identical types and values, false otherwise - */ -bool ControlValue::operator==(const ControlValue &other) const -{ - if (type_ != other.type_) - return false; - - switch (type_) { - case ControlTypeBool: - return bool_ == other.bool_; - case ControlTypeInteger32: - return integer32_ == other.integer32_; - case ControlTypeInteger64: - return integer64_ == other.integer64_; - default: - return false; - } -} - -/** - * \fn bool ControlValue::operator!=() - * \brief Compare ControlValue instances for non equality - * \return False if the values have identical types and values, true otherwise - */ - /** * \class ControlId * \brief Control static metadata