| Message ID | 20260113000808.15395-11-laurent.pinchart@ideasonboard.com |
|---|---|
| State | New |
| Headers | show |
| Series |
|
| Related | show |
2026. 01. 13. 1:07 keltezéssel, Laurent Pinchart írta: > In preparation for support to set the value of a YamlObject, rename the > Getter structure to Accessor. The structure will be extended with a > set() function. > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > --- Looks ok. Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> > include/libcamera/internal/matrix.h | 2 +- > include/libcamera/internal/vector.h | 2 +- > include/libcamera/internal/yaml_parser.h | 6 +++--- > src/ipa/libipa/lsc_polynomial.h | 2 +- > src/ipa/libipa/pwl.cpp | 2 +- > src/libcamera/yaml_parser.cpp | 24 ++++++++++++------------ > 6 files changed, 19 insertions(+), 19 deletions(-) > > diff --git a/include/libcamera/internal/matrix.h b/include/libcamera/internal/matrix.h > index 1842389f2b22..67761cb6037d 100644 > --- a/include/libcamera/internal/matrix.h > +++ b/include/libcamera/internal/matrix.h > @@ -200,7 +200,7 @@ std::ostream &operator<<(std::ostream &out, const Matrix<T, Rows, Cols> &m) > } > > template<typename T, unsigned int Rows, unsigned int Cols> > -struct YamlObject::Getter<Matrix<T, Rows, Cols>> { > +struct YamlObject::Accessor<Matrix<T, Rows, Cols>> { > std::optional<Matrix<T, Rows, Cols>> get(const YamlObject &obj) const > { > if (!matrixValidateYaml(obj, Rows * Cols)) > diff --git a/include/libcamera/internal/vector.h b/include/libcamera/internal/vector.h > index 16b6aef0b38f..cfd8882ce0e6 100644 > --- a/include/libcamera/internal/vector.h > +++ b/include/libcamera/internal/vector.h > @@ -347,7 +347,7 @@ std::ostream &operator<<(std::ostream &out, const Vector<T, Rows> &v) > } > > template<typename T, unsigned int Rows> > -struct YamlObject::Getter<Vector<T, Rows>> { > +struct YamlObject::Accessor<Vector<T, Rows>> { > std::optional<Vector<T, Rows>> get(const YamlObject &obj) const > { > if (!vectorValidateYaml(obj, Rows)) > diff --git a/include/libcamera/internal/yaml_parser.h b/include/libcamera/internal/yaml_parser.h > index 03d6a05e2d0f..0ff026706682 100644 > --- a/include/libcamera/internal/yaml_parser.h > +++ b/include/libcamera/internal/yaml_parser.h > @@ -173,7 +173,7 @@ public: > template<typename T> > std::optional<T> get() const > { > - return Getter<T>{}.get(*this); > + return Accessor<T>{}.get(*this); > } > > template<typename T, typename U> > @@ -213,7 +213,7 @@ private: > LIBCAMERA_DISABLE_COPY_AND_MOVE(YamlObject) > > template<typename T> > - friend struct Getter; > + friend struct Accessor; > friend class YamlParserContext; > > enum class Type { > @@ -224,7 +224,7 @@ private: > }; > > template<typename T, typename Enable = void> > - struct Getter { > + struct Accessor { > std::optional<T> get(const YamlObject &obj) const; > }; > > diff --git a/src/ipa/libipa/lsc_polynomial.h b/src/ipa/libipa/lsc_polynomial.h > index c898faeb13db..df3a0d4b39c4 100644 > --- a/src/ipa/libipa/lsc_polynomial.h > +++ b/src/ipa/libipa/lsc_polynomial.h > @@ -81,7 +81,7 @@ private: > #ifndef __DOXYGEN__ > > template<> > -struct YamlObject::Getter<ipa::LscPolynomial> { > +struct YamlObject::Accessor<ipa::LscPolynomial> { > std::optional<ipa::LscPolynomial> get(const YamlObject &obj) const > { > std::optional<double> cx = obj["cx"].get<double>(); > diff --git a/src/ipa/libipa/pwl.cpp b/src/ipa/libipa/pwl.cpp > index 72b63c4d068d..f38573e69c13 100644 > --- a/src/ipa/libipa/pwl.cpp > +++ b/src/ipa/libipa/pwl.cpp > @@ -435,7 +435,7 @@ std::string Pwl::toString() const > */ > template<> > std::optional<ipa::Pwl> > -YamlObject::Getter<ipa::Pwl>::get(const YamlObject &obj) const > +YamlObject::Accessor<ipa::Pwl>::get(const YamlObject &obj) const > { > /* Treat a single value as single point PWL. */ > if (obj.isValue()) { > diff --git a/src/libcamera/yaml_parser.cpp b/src/libcamera/yaml_parser.cpp > index 72580e901ddd..a21e589fdd86 100644 > --- a/src/libcamera/yaml_parser.cpp > +++ b/src/libcamera/yaml_parser.cpp > @@ -134,7 +134,7 @@ std::size_t YamlObject::size() const > > template<> > std::optional<bool> > -YamlObject::Getter<bool>::get(const YamlObject &obj) const > +YamlObject::Accessor<bool>::get(const YamlObject &obj) const > { > if (obj.type_ != Type::Value) > return std::nullopt; > @@ -148,7 +148,7 @@ YamlObject::Getter<bool>::get(const YamlObject &obj) const > } > > template<typename T> > -struct YamlObject::Getter<T, std::enable_if_t< > +struct YamlObject::Accessor<T, std::enable_if_t< > std::is_same_v<int8_t, T> || > std::is_same_v<uint8_t, T> || > std::is_same_v<int16_t, T> || > @@ -173,23 +173,23 @@ struct YamlObject::Getter<T, std::enable_if_t< > } > }; > > -template struct YamlObject::Getter<int8_t>; > -template struct YamlObject::Getter<uint8_t>; > -template struct YamlObject::Getter<int16_t>; > -template struct YamlObject::Getter<uint16_t>; > -template struct YamlObject::Getter<int32_t>; > -template struct YamlObject::Getter<uint32_t>; > +template struct YamlObject::Accessor<int8_t>; > +template struct YamlObject::Accessor<uint8_t>; > +template struct YamlObject::Accessor<int16_t>; > +template struct YamlObject::Accessor<uint16_t>; > +template struct YamlObject::Accessor<int32_t>; > +template struct YamlObject::Accessor<uint32_t>; > > template<> > std::optional<float> > -YamlObject::Getter<float>::get(const YamlObject &obj) const > +YamlObject::Accessor<float>::get(const YamlObject &obj) const > { > return obj.get<double>(); > } > > template<> > std::optional<double> > -YamlObject::Getter<double>::get(const YamlObject &obj) const > +YamlObject::Accessor<double>::get(const YamlObject &obj) const > { > if (obj.type_ != Type::Value) > return std::nullopt; > @@ -210,7 +210,7 @@ YamlObject::Getter<double>::get(const YamlObject &obj) const > > template<> > std::optional<std::string> > -YamlObject::Getter<std::string>::get(const YamlObject &obj) const > +YamlObject::Accessor<std::string>::get(const YamlObject &obj) const > { > if (obj.type_ != Type::Value) > return std::nullopt; > @@ -220,7 +220,7 @@ YamlObject::Getter<std::string>::get(const YamlObject &obj) const > > template<> > std::optional<Size> > -YamlObject::Getter<Size>::get(const YamlObject &obj) const > +YamlObject::Accessor<Size>::get(const YamlObject &obj) const > { > if (obj.type_ != Type::List) > return std::nullopt;
diff --git a/include/libcamera/internal/matrix.h b/include/libcamera/internal/matrix.h index 1842389f2b22..67761cb6037d 100644 --- a/include/libcamera/internal/matrix.h +++ b/include/libcamera/internal/matrix.h @@ -200,7 +200,7 @@ std::ostream &operator<<(std::ostream &out, const Matrix<T, Rows, Cols> &m) } template<typename T, unsigned int Rows, unsigned int Cols> -struct YamlObject::Getter<Matrix<T, Rows, Cols>> { +struct YamlObject::Accessor<Matrix<T, Rows, Cols>> { std::optional<Matrix<T, Rows, Cols>> get(const YamlObject &obj) const { if (!matrixValidateYaml(obj, Rows * Cols)) diff --git a/include/libcamera/internal/vector.h b/include/libcamera/internal/vector.h index 16b6aef0b38f..cfd8882ce0e6 100644 --- a/include/libcamera/internal/vector.h +++ b/include/libcamera/internal/vector.h @@ -347,7 +347,7 @@ std::ostream &operator<<(std::ostream &out, const Vector<T, Rows> &v) } template<typename T, unsigned int Rows> -struct YamlObject::Getter<Vector<T, Rows>> { +struct YamlObject::Accessor<Vector<T, Rows>> { std::optional<Vector<T, Rows>> get(const YamlObject &obj) const { if (!vectorValidateYaml(obj, Rows)) diff --git a/include/libcamera/internal/yaml_parser.h b/include/libcamera/internal/yaml_parser.h index 03d6a05e2d0f..0ff026706682 100644 --- a/include/libcamera/internal/yaml_parser.h +++ b/include/libcamera/internal/yaml_parser.h @@ -173,7 +173,7 @@ public: template<typename T> std::optional<T> get() const { - return Getter<T>{}.get(*this); + return Accessor<T>{}.get(*this); } template<typename T, typename U> @@ -213,7 +213,7 @@ private: LIBCAMERA_DISABLE_COPY_AND_MOVE(YamlObject) template<typename T> - friend struct Getter; + friend struct Accessor; friend class YamlParserContext; enum class Type { @@ -224,7 +224,7 @@ private: }; template<typename T, typename Enable = void> - struct Getter { + struct Accessor { std::optional<T> get(const YamlObject &obj) const; }; diff --git a/src/ipa/libipa/lsc_polynomial.h b/src/ipa/libipa/lsc_polynomial.h index c898faeb13db..df3a0d4b39c4 100644 --- a/src/ipa/libipa/lsc_polynomial.h +++ b/src/ipa/libipa/lsc_polynomial.h @@ -81,7 +81,7 @@ private: #ifndef __DOXYGEN__ template<> -struct YamlObject::Getter<ipa::LscPolynomial> { +struct YamlObject::Accessor<ipa::LscPolynomial> { std::optional<ipa::LscPolynomial> get(const YamlObject &obj) const { std::optional<double> cx = obj["cx"].get<double>(); diff --git a/src/ipa/libipa/pwl.cpp b/src/ipa/libipa/pwl.cpp index 72b63c4d068d..f38573e69c13 100644 --- a/src/ipa/libipa/pwl.cpp +++ b/src/ipa/libipa/pwl.cpp @@ -435,7 +435,7 @@ std::string Pwl::toString() const */ template<> std::optional<ipa::Pwl> -YamlObject::Getter<ipa::Pwl>::get(const YamlObject &obj) const +YamlObject::Accessor<ipa::Pwl>::get(const YamlObject &obj) const { /* Treat a single value as single point PWL. */ if (obj.isValue()) { diff --git a/src/libcamera/yaml_parser.cpp b/src/libcamera/yaml_parser.cpp index 72580e901ddd..a21e589fdd86 100644 --- a/src/libcamera/yaml_parser.cpp +++ b/src/libcamera/yaml_parser.cpp @@ -134,7 +134,7 @@ std::size_t YamlObject::size() const template<> std::optional<bool> -YamlObject::Getter<bool>::get(const YamlObject &obj) const +YamlObject::Accessor<bool>::get(const YamlObject &obj) const { if (obj.type_ != Type::Value) return std::nullopt; @@ -148,7 +148,7 @@ YamlObject::Getter<bool>::get(const YamlObject &obj) const } template<typename T> -struct YamlObject::Getter<T, std::enable_if_t< +struct YamlObject::Accessor<T, std::enable_if_t< std::is_same_v<int8_t, T> || std::is_same_v<uint8_t, T> || std::is_same_v<int16_t, T> || @@ -173,23 +173,23 @@ struct YamlObject::Getter<T, std::enable_if_t< } }; -template struct YamlObject::Getter<int8_t>; -template struct YamlObject::Getter<uint8_t>; -template struct YamlObject::Getter<int16_t>; -template struct YamlObject::Getter<uint16_t>; -template struct YamlObject::Getter<int32_t>; -template struct YamlObject::Getter<uint32_t>; +template struct YamlObject::Accessor<int8_t>; +template struct YamlObject::Accessor<uint8_t>; +template struct YamlObject::Accessor<int16_t>; +template struct YamlObject::Accessor<uint16_t>; +template struct YamlObject::Accessor<int32_t>; +template struct YamlObject::Accessor<uint32_t>; template<> std::optional<float> -YamlObject::Getter<float>::get(const YamlObject &obj) const +YamlObject::Accessor<float>::get(const YamlObject &obj) const { return obj.get<double>(); } template<> std::optional<double> -YamlObject::Getter<double>::get(const YamlObject &obj) const +YamlObject::Accessor<double>::get(const YamlObject &obj) const { if (obj.type_ != Type::Value) return std::nullopt; @@ -210,7 +210,7 @@ YamlObject::Getter<double>::get(const YamlObject &obj) const template<> std::optional<std::string> -YamlObject::Getter<std::string>::get(const YamlObject &obj) const +YamlObject::Accessor<std::string>::get(const YamlObject &obj) const { if (obj.type_ != Type::Value) return std::nullopt; @@ -220,7 +220,7 @@ YamlObject::Getter<std::string>::get(const YamlObject &obj) const template<> std::optional<Size> -YamlObject::Getter<Size>::get(const YamlObject &obj) const +YamlObject::Accessor<Size>::get(const YamlObject &obj) const { if (obj.type_ != Type::List) return std::nullopt;
In preparation for support to set the value of a YamlObject, rename the Getter structure to Accessor. The structure will be extended with a set() function. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> --- include/libcamera/internal/matrix.h | 2 +- include/libcamera/internal/vector.h | 2 +- include/libcamera/internal/yaml_parser.h | 6 +++--- src/ipa/libipa/lsc_polynomial.h | 2 +- src/ipa/libipa/pwl.cpp | 2 +- src/libcamera/yaml_parser.cpp | 24 ++++++++++++------------ 6 files changed, 19 insertions(+), 19 deletions(-)