summaryrefslogtreecommitdiff
path: root/includes/dynamic_depth/profiles.h
blob: 0088ec34d53a1653034d51ae8bc21e85b1688b55 (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_PROFILES_H_  // NOLINT
#define DYNAMIC_DEPTH_INCLUDES_DYNAMIC_DEPTH_PROFILES_H_  // NOLINT

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

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

namespace dynamic_depth {

// Implements the Device:Profiles field from the Dynamic Depth specification,
// with serialization and deserialization for its child Profile elements.
class Profiles : public Element {
 public:
  // Interface methods.
  void GetNamespaces(
      std::unordered_map<string, string>* ns_name_href_map) override;

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

  // Static methods.

  // Creates this object from the given profiles. If the list is empty, returns
  // a unique_ptr owning nothing.
  static std::unique_ptr<Profiles> FromProfileArray(
      std::vector<std::unique_ptr<Profile>>* profile_list);

  // Returns the deserialized profiles in a Profiles object, a unique_ptr owning
  // nothing if parsing failed for all the profiles.
  static std::unique_ptr<Profiles> FromDeserializer(
      const ::dynamic_depth::xmpmeta::xml::Deserializer& parent_deserializer);

  // Non-static methods.

  // Returns the list of cameras.
  const std::vector<const Profile*> GetProfiles() const;

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

 private:
  Profiles() = default;

  std::vector<std::unique_ptr<Profile>> profile_list_;
};

}  // namespace dynamic_depth

#endif // DYNAMIC_DEPTH_INCLUDES_DYNAMIC_DEPTH_PROFILES_H_  // NOLINT