blob: 0088ec34d53a1653034d51ae8bc21e85b1688b55 [file] [log] [blame]
Eino-Ville Talvala09f199a2018-11-15 15:49:02 -08001#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 Talvala09f199a2018-11-15 15:49:02 -080013namespace dynamic_depth {
14
15// Implements the Device:Profiles field from the Dynamic Depth specification,
16// with serialization and deserialization for its child Profile elements.
17class Profiles : public Element {
18 public:
19 // Interface methods.
20 void GetNamespaces(
21 std::unordered_map<string, string>* ns_name_href_map) override;
22
Emilian Peev104751a2019-01-09 19:02:52 +000023 bool Serialize(
24 ::dynamic_depth::xmpmeta::xml::Serializer* serializer) const override;
Eino-Ville Talvala09f199a2018-11-15 15:49:02 -080025
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 Peev104751a2019-01-09 19:02:52 +000036 const ::dynamic_depth::xmpmeta::xml::Deserializer& parent_deserializer);
Eino-Ville Talvala09f199a2018-11-15 15:49:02 -080037
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 Talvala09f199a2018-11-15 15:49:02 -080054
55#endif // DYNAMIC_DEPTH_INCLUDES_DYNAMIC_DEPTH_PROFILES_H_ // NOLINT