diff options
author | Eino-Ville Talvala <etalvala@google.com> | 2018-11-15 15:49:02 -0800 |
---|---|---|
committer | Eino-Ville Talvala <etalvala@google.com> | 2018-11-15 16:07:24 -0800 |
commit | 09f199a694ef5b956cabc368e40ab5ca11c64044 (patch) | |
tree | 456d184a3817c8b6524a90fc2da60893a2fc1895 /includes/dynamic_depth/planes.h | |
parent | 2d25fc4f6a7e7453f877958a2f3f59b6cc588ca4 (diff) | |
download | dynamic_depth-09f199a694ef5b956cabc368e40ab5ca11c64044.tar.gz |
Initial commit of libdynamic_depth
Dynamic depth is a standard for embedding depth maps and
other similar extensions into standard image files like JPEG.
Test: m libdynamic_depth
Bug: 109735087
Bug: 119211681
Change-Id: I0103b7d47e60dc8e3a3b277456903d76f727926f
Diffstat (limited to 'includes/dynamic_depth/planes.h')
-rw-r--r-- | includes/dynamic_depth/planes.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/includes/dynamic_depth/planes.h b/includes/dynamic_depth/planes.h new file mode 100644 index 0000000..c38aad4 --- /dev/null +++ b/includes/dynamic_depth/planes.h @@ -0,0 +1,61 @@ +#ifndef DYNAMIC_DEPTH_INCLUDES_DYNAMIC_DEPTH_PLANES_H_ // NOLINT +#define DYNAMIC_DEPTH_INCLUDES_DYNAMIC_DEPTH_PLANES_H_ // NOLINT + +#include <memory> +#include <string> +#include <unordered_map> + +#include "dynamic_depth/element.h" +#include "dynamic_depth/plane.h" +#include "xmpmeta/xml/deserializer.h" +#include "xmpmeta/xml/serializer.h" + +namespace photos_editing_formats { +namespace dynamic_depth { + +// THe list of planes in a Dynamic Depth Device t ype. +class Planes : public Element { + public: + // Creates this object from the given planes. Returns null if the list is + // empty, null, or contains null elements. + // If creation succeeds, ownership of the Plane objects are transferred to + // the resulting Planes object. The pointer to the vector of Plane objects + // will be replaced with the plane_list_, whose contents are not necessarily + // defined. + static std::unique_ptr<Planes> FromPlaneArray( + std::vector<std::unique_ptr<Plane>>* plane_list); + + // Returns the deserialized cameras in a Planes object, null if parsing + // failed for all the planes, one of the planes is null, or the list of + // planes was empty. + static std::unique_ptr<Planes> FromDeserializer( + const xml::Deserializer& parent_deserializer); + + // Disallow copying. + Planes(const Planes&) = delete; + Plane& operator=(const Planes&) = delete; + + void GetNamespaces( + std::unordered_map<string, string>* ns_name_href_map) override; + + // Returns false if the list of planes is empty, or serialization fails. + bool Serialize(xml::Serializer* serializer) const override; + + // Returns the number of plane elements in this Plane object. + int GetPlaneCount() const; + + // Returns the ith plane, which is guaranteed not to be null because + // FromPlaneArray or FromDeserializer would have failed to construct a valid + // Planes object. + const Plane* GetPlaneAt(int i) const; + + private: + Planes(); + + std::vector<std::unique_ptr<Plane>> plane_list_; +}; + +} // namespace dynamic_depth +} // namespace photos_editing_formats + +#endif // DYNAMIC_DEPTH_INCLUDES_DYNAMIC_DEPTH_PLANES_H_ // NOLINT |