xref: /aosp_15_r20/external/dynamic_depth/includes/dynamic_depth/profile.h (revision a62be0856e8e1158f43b03e41bbad10f4d005fde)
1 #ifndef DYNAMIC_DEPTH_INCLUDES_DYNAMIC_DEPTH_PROFILE_H_  // NOLINT
2 #define DYNAMIC_DEPTH_INCLUDES_DYNAMIC_DEPTH_PROFILE_H_  // NOLINT
3 
4 #include <memory>
5 #include <string>
6 #include <unordered_map>
7 
8 #include "dynamic_depth/element.h"
9 #include "xmpmeta/xml/deserializer.h"
10 #include "xmpmeta/xml/serializer.h"
11 
12 namespace dynamic_depth {
13 
14 // Implements the Profile element in the Dynamic Depth specification, with
15 // serialization and deserialization.
16 class Profile : public Element {
17  public:
18   void GetNamespaces(
19       std::unordered_map<string, string>* ns_name_href_map) override;
20 
21   bool Serialize(
22       ::dynamic_depth::xmpmeta::xml::Serializer* serializer) const override;
23 
24   // Creates a Profile element from the given fields. Returns null if
25   // the type is empty, or if the camera_indices are shorter than the
26   // specified minimum length for types supported in the Dynamic Depth
27   // specification. Type is case-sensitive. If wrong, this will be treated as an
28   // unsupported type.
29   static std::unique_ptr<Profile> FromData(
30       const string& type, const std::vector<int>& camera_indices);
31 
32   // Returns the deserialized Profile, null if parsing fails.
33   static std::unique_ptr<Profile> FromDeserializer(
34       const ::dynamic_depth::xmpmeta::xml::Deserializer& parent_deserializer);
35 
36   // Returns the Profile type.
37   const string& GetType() const;
38 
39   // Returns the camera indices.
40   const std::vector<int>& GetCameraIndices() const;
41 
42   // Disallow copying.
43   Profile(const Profile&) = delete;
44   void operator=(const Profile&) = delete;
45 
46  private:
47   Profile(const string& type, const std::vector<int>& camera_indices);
48 
49   string type_;
50   std::vector<int> camera_indices_;
51 };
52 
53 }  // namespace dynamic_depth
54 
55 #endif // DYNAMIC_DEPTH_INCLUDES_DYNAMIC_DEPTH_PROFILE_H_  // NOLINT
56