1 #ifndef DYNAMIC_DEPTH_INCLUDES_DYNAMIC_DEPTH_PLANES_H_ // NOLINT 2 #define DYNAMIC_DEPTH_INCLUDES_DYNAMIC_DEPTH_PLANES_H_ // NOLINT 3 4 #include <memory> 5 #include <string> 6 #include <unordered_map> 7 8 #include "dynamic_depth/element.h" 9 #include "dynamic_depth/plane.h" 10 #include "xmpmeta/xml/deserializer.h" 11 #include "xmpmeta/xml/serializer.h" 12 13 namespace dynamic_depth { 14 15 // THe list of planes in a Dynamic Depth Device t ype. 16 class Planes : public Element { 17 public: 18 // Creates this object from the given planes. Returns null if the list is 19 // empty, null, or contains null elements. 20 // If creation succeeds, ownership of the Plane objects are transferred to 21 // the resulting Planes object. The pointer to the vector of Plane objects 22 // will be replaced with the plane_list_, whose contents are not necessarily 23 // defined. 24 static std::unique_ptr<Planes> FromPlaneArray( 25 std::vector<std::unique_ptr<Plane>>* plane_list); 26 27 // Returns the deserialized cameras in a Planes object, null if parsing 28 // failed for all the planes, one of the planes is null, or the list of 29 // planes was empty. 30 static std::unique_ptr<Planes> FromDeserializer( 31 const ::dynamic_depth::xmpmeta::xml::Deserializer& parent_deserializer); 32 33 // Disallow copying. 34 Planes(const Planes&) = delete; 35 Plane& operator=(const Planes&) = delete; 36 37 void GetNamespaces( 38 std::unordered_map<string, string>* ns_name_href_map) override; 39 40 // Returns false if the list of planes is empty, or serialization fails. 41 bool Serialize( 42 ::dynamic_depth::xmpmeta::xml::Serializer* serializer) const override; 43 44 // Returns the number of plane elements in this Plane object. 45 int GetPlaneCount() const; 46 47 // Returns the ith plane, which is guaranteed not to be null because 48 // FromPlaneArray or FromDeserializer would have failed to construct a valid 49 // Planes object. 50 const Plane* GetPlaneAt(int i) const; 51 52 private: 53 Planes(); 54 55 std::vector<std::unique_ptr<Plane>> plane_list_; 56 }; 57 58 } // namespace dynamic_depth 59 60 #endif // DYNAMIC_DEPTH_INCLUDES_DYNAMIC_DEPTH_PLANES_H_ // NOLINT 61