summaryrefslogtreecommitdiff
path: root/includes/dynamic_depth/profile.h
blob: 7dfb0ea2370c3f2992897d584a38eb54096d3a16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#ifndef DYNAMIC_DEPTH_INCLUDES_DYNAMIC_DEPTH_PROFILE_H_  // NOLINT
#define DYNAMIC_DEPTH_INCLUDES_DYNAMIC_DEPTH_PROFILE_H_  // NOLINT

#include <memory>
#include <string>
#include <unordered_map>

#include "dynamic_depth/element.h"
#include "xmpmeta/xml/deserializer.h"
#include "xmpmeta/xml/serializer.h"

namespace dynamic_depth {

// Implements the Profile element in the Dynamic Depth specification, with
// serialization and deserialization.
class Profile : public Element {
 public:
  void GetNamespaces(
      std::unordered_map<string, string>* ns_name_href_map) override;

  bool Serialize(
      ::dynamic_depth::xmpmeta::xml::Serializer* serializer) const override;

  // Creates a Profile element from the given fields. Returns null if
  // the type is empty, or if the camera_indices are shorter than the
  // specified minimum length for types supported in the Dynamic Depth
  // specification. Type is case-sensitive. If wrong, this will be treated as an
  // unsupported type.
  static std::unique_ptr<Profile> FromData(
      const string& type, const std::vector<int>& camera_indices);

  // Returns the deserialized Profile, null if parsing fails.
  static std::unique_ptr<Profile> FromDeserializer(
      const ::dynamic_depth::xmpmeta::xml::Deserializer& parent_deserializer);

  // Returns the Profile type.
  const string& GetType() const;

  // Returns the camera indices.
  const std::vector<int>& GetCameraIndices() const;

  // Disallow copying.
  Profile(const Profile&) = delete;
  void operator=(const Profile&) = delete;

 private:
  Profile(const string& type, const std::vector<int>& camera_indices);

  string type_;
  std::vector<int> camera_indices_;
};

}  // namespace dynamic_depth

#endif // DYNAMIC_DEPTH_INCLUDES_DYNAMIC_DEPTH_PROFILE_H_  // NOLINT