1 #ifndef DYNAMIC_DEPTH_INCLUDES_DYNAMIC_DEPTH_CAMERAS_H_ // NOLINT 2 #define DYNAMIC_DEPTH_INCLUDES_DYNAMIC_DEPTH_CAMERAS_H_ // NOLINT 3 4 #include <memory> 5 #include <string> 6 #include <unordered_map> 7 8 #include "dynamic_depth/camera.h" 9 #include "dynamic_depth/element.h" 10 #include "xmpmeta/xml/deserializer.h" 11 #include "xmpmeta/xml/serializer.h" 12 13 namespace dynamic_depth { 14 15 // Implements the Device:Cameras field from the Dynamic Depth specification, 16 // with serialization and deserialization for its child Camera elements. 17 class Cameras : public Element { 18 public: 19 void GetNamespaces( 20 std::unordered_map<string, string>* ns_name_href_map) override; 21 22 bool Serialize( 23 ::dynamic_depth::xmpmeta::xml::Serializer* serializer) const override; 24 25 // Creates this object from the given cameras. Returns null if the list is 26 // empty. 27 // If creation succeeds, ownership of the Camera objects are transferred to 28 // the resulting Cameras object. The vector of Camera objects will be cleared. 29 static std::unique_ptr<Cameras> FromCameraArray( 30 std::vector<std::unique_ptr<Camera>>* camera_list); 31 32 // Returns the deserialized cameras in a Cameras object, null if parsing 33 // failed for all the cameras. 34 static std::unique_ptr<Cameras> FromDeserializer( 35 const ::dynamic_depth::xmpmeta::xml::Deserializer& parent_deserializer); 36 37 // Returns the list of cameras. 38 const std::vector<const Camera*> GetCameras() const; 39 40 // Disallow copying. 41 Cameras(const Cameras&) = delete; 42 void operator=(const Cameras&) = delete; 43 44 private: 45 Cameras(); 46 47 std::vector<std::unique_ptr<Camera>> camera_list_; 48 }; 49 50 } // namespace dynamic_depth 51 52 #endif // DYNAMIC_DEPTH_INCLUDES_DYNAMIC_DEPTH_CAMERAS_H_ // NOLINT 53