1 #ifndef DYNAMIC_DEPTH_INCLUDES_DYNAMIC_DEPTH_CONTAINER_H_  // NOLINT
2 #define DYNAMIC_DEPTH_INCLUDES_DYNAMIC_DEPTH_CONTAINER_H_  // NOLINT
3 
4 #include <memory>
5 #include <string>
6 #include <unordered_map>
7 
8 #include "dynamic_depth/element.h"
9 #include "dynamic_depth/item.h"
10 
11 namespace dynamic_depth {
12 
13 // A Container that holds a directory / array of file Item elementss. Files
14 // at the end of the image appear in the same sequential order as the Item
15 // elements held in an instance of this object.
16 class Container : 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 this object from the given items. Returns null if the list is
25   // empty. If creation succeeds, ownership of the Item objects are transferred
26   // to the resulting Container object. The vector of Item objects will be
27   // cleared.
28   static std::unique_ptr<Container> FromItems(
29       std::vector<std::unique_ptr<Item>>* items);
30 
31   // Returns the deserialized item elements, null if parsing failed for all
32   // items.
33   static std::unique_ptr<Container> FromDeserializer(
34       const ::dynamic_depth::xmpmeta::xml::Deserializer& parent_deserializer);
35 
36   // Returns the list of cameras.
37   const std::vector<const Item*> GetItems() const;
38 
39   // Disallow copying.
40   Container(const Container&) = delete;
41   void operator=(const Container&) = delete;
42 
43  private:
44   Container();
45 
46   std::vector<std::unique_ptr<Item>> items_;
47 };
48 
49 }  // namespace dynamic_depth
50 
51 #endif // DYNAMIC_DEPTH_INCLUDES_DYNAMIC_DEPTH_CONTAINER_H_  // NOLINT
52