xref: /aosp_15_r20/external/dynamic_depth/includes/dynamic_depth/profiles.h (revision a62be0856e8e1158f43b03e41bbad10f4d005fde)
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 
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 
23   bool Serialize(
24       ::dynamic_depth::xmpmeta::xml::Serializer* serializer) const override;
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(
36       const ::dynamic_depth::xmpmeta::xml::Deserializer& parent_deserializer);
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
54 
55 #endif // DYNAMIC_DEPTH_INCLUDES_DYNAMIC_DEPTH_PROFILES_H_  // NOLINT
56