diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2024-06-13 02:52:15 +0300 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2024-06-16 03:28:25 +0300 |
commit | 64ed07d4d057411c3fb669dc1faa27e61efd2811 (patch) | |
tree | b36313020388589728048d7e14b4a16947a2bce6 /src/ipa/libipa/vector.cpp | |
parent | 922686067a2d610a93072cc9bbd3d9758087f4d1 (diff) |
ipa: libipa: vector: Specialize YamlObject getter
Implement a specialization of the YamlObject::Getter structure to
support deserializing ipa::Vector objects from YAML data.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Diffstat (limited to 'src/ipa/libipa/vector.cpp')
-rw-r--r-- | src/ipa/libipa/vector.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/ipa/libipa/vector.cpp b/src/ipa/libipa/vector.cpp index 5de4ae48..4e987d82 100644 --- a/src/ipa/libipa/vector.cpp +++ b/src/ipa/libipa/vector.cpp @@ -148,6 +148,23 @@ namespace ipa { * \return True if the two vectors are not equal, false otherwise */ +#ifndef __DOXYGEN__ +bool vectorValidateYaml(const YamlObject &obj, unsigned int size) +{ + if (!obj.isList()) + return false; + + if (obj.size() != size) { + LOG(Vector, Error) + << "Wrong number of values in YAML vector: expected " + << size << ", got " << obj.size(); + return false; + } + + return true; +} +#endif /* __DOXYGEN__ */ + } /* namespace ipa */ } /* namespace libcamera */ |