Eino-Ville Talvala | 09f199a | 2018-11-15 15:49:02 -0800 | [diff] [blame] | 1 | #ifndef DYNAMIC_DEPTH_INCLUDES_DYNAMIC_DEPTH_PROFILES_H_ // NOLINT |
| 2 | #define DYNAMIC_DEPTH_INCLUDES_DYNAMIC_DEPTH_PROFILES_H_ // NOLINT |
| 3 | |
| 4 | #include <memory> |
| 5 | #include <string> |
| 6 | #include <unordered_map> |
| 7 | |
| 8 | #include "dynamic_depth/element.h" |
| 9 | #include "dynamic_depth/profile.h" |
| 10 | #include "xmpmeta/xml/deserializer.h" |
| 11 | #include "xmpmeta/xml/serializer.h" |
| 12 | |
Eino-Ville Talvala | 09f199a | 2018-11-15 15:49:02 -0800 | [diff] [blame] | 13 | namespace dynamic_depth { |
| 14 | |
| 15 | // Implements the Device:Profiles field from the Dynamic Depth specification, |
| 16 | // with serialization and deserialization for its child Profile elements. |
| 17 | class Profiles : public Element { |
| 18 | public: |
| 19 | // Interface methods. |
| 20 | void GetNamespaces( |
| 21 | std::unordered_map<string, string>* ns_name_href_map) override; |
| 22 | |
Emilian Peev | 104751a | 2019-01-09 19:02:52 +0000 | [diff] [blame] | 23 | bool Serialize( |
| 24 | ::dynamic_depth::xmpmeta::xml::Serializer* serializer) const override; |
Eino-Ville Talvala | 09f199a | 2018-11-15 15:49:02 -0800 | [diff] [blame] | 25 | |
| 26 | // Static methods. |
| 27 | |
| 28 | // Creates this object from the given profiles. If the list is empty, returns |
| 29 | // a unique_ptr owning nothing. |
| 30 | static std::unique_ptr<Profiles> FromProfileArray( |
| 31 | std::vector<std::unique_ptr<Profile>>* profile_list); |
| 32 | |
| 33 | // Returns the deserialized profiles in a Profiles object, a unique_ptr owning |
| 34 | // nothing if parsing failed for all the profiles. |
| 35 | static std::unique_ptr<Profiles> FromDeserializer( |
Emilian Peev | 104751a | 2019-01-09 19:02:52 +0000 | [diff] [blame] | 36 | const ::dynamic_depth::xmpmeta::xml::Deserializer& parent_deserializer); |
Eino-Ville Talvala | 09f199a | 2018-11-15 15:49:02 -0800 | [diff] [blame] | 37 | |
| 38 | // Non-static methods. |
| 39 | |
| 40 | // Returns the list of cameras. |
| 41 | const std::vector<const Profile*> GetProfiles() const; |
| 42 | |
| 43 | // Disallow copying |
| 44 | Profiles(const Profiles&) = delete; |
| 45 | void operator=(const Profiles&) = delete; |
| 46 | |
| 47 | private: |
| 48 | Profiles() = default; |
| 49 | |
| 50 | std::vector<std::unique_ptr<Profile>> profile_list_; |
| 51 | }; |
| 52 | |
| 53 | } // namespace dynamic_depth |
Eino-Ville Talvala | 09f199a | 2018-11-15 15:49:02 -0800 | [diff] [blame] | 54 | |
| 55 | #endif // DYNAMIC_DEPTH_INCLUDES_DYNAMIC_DEPTH_PROFILES_H_ // NOLINT |