Changeset View
Changeset View
Standalone View
Standalone View
extern/draco/dracoenc/src/draco/metadata/metadata.h
| Context not available. | |||||
| #include <cstring> | #include <cstring> | ||||
| #include <memory> | #include <memory> | ||||
| #include <string> | #include <string> | ||||
| #include <unordered_map> | #include <map> | ||||
| #include <vector> | #include <vector> | ||||
| #include "draco/core/hash_utils.h" | #include "draco/core/hash_utils.h" | ||||
| Context not available. | |||||
| // accessing entries of common data types. For now, developers need to know | // accessing entries of common data types. For now, developers need to know | ||||
| // the type of entries they are requesting. | // the type of entries they are requesting. | ||||
| void AddEntryInt(const std::string &name, int32_t value); | void AddEntryInt(const std::string &name, int32_t value); | ||||
| // Returns false if Metadata does not contain an entry with a key of |name|. | |||||
| // This function does not guarantee that entry's type is int32_t. | |||||
| bool GetEntryInt(const std::string &name, int32_t *value) const; | bool GetEntryInt(const std::string &name, int32_t *value) const; | ||||
| void AddEntryIntArray(const std::string &name, | void AddEntryIntArray(const std::string &name, | ||||
| const std::vector<int32_t> &value); | const std::vector<int32_t> &value); | ||||
| // Returns false if Metadata does not contain an entry with a key of |name|. | |||||
| // This function does not guarantee that entry's type is a vector of int32_t. | |||||
| bool GetEntryIntArray(const std::string &name, | bool GetEntryIntArray(const std::string &name, | ||||
| std::vector<int32_t> *value) const; | std::vector<int32_t> *value) const; | ||||
| void AddEntryDouble(const std::string &name, double value); | void AddEntryDouble(const std::string &name, double value); | ||||
| // Returns false if Metadata does not contain an entry with a key of |name|. | |||||
| // This function does not guarantee that entry's type is double. | |||||
| bool GetEntryDouble(const std::string &name, double *value) const; | bool GetEntryDouble(const std::string &name, double *value) const; | ||||
| void AddEntryDoubleArray(const std::string &name, | void AddEntryDoubleArray(const std::string &name, | ||||
| const std::vector<double> &value); | const std::vector<double> &value); | ||||
| // Returns false if Metadata does not contain an entry with a key of |name|. | |||||
| // This function does not guarantee that entry's type is a vector of double. | |||||
| bool GetEntryDoubleArray(const std::string &name, | bool GetEntryDoubleArray(const std::string &name, | ||||
| std::vector<double> *value) const; | std::vector<double> *value) const; | ||||
| void AddEntryString(const std::string &name, const std::string &value); | void AddEntryString(const std::string &name, const std::string &value); | ||||
| // Returns false if Metadata does not contain an entry with a key of |name|. | |||||
| // This function does not guarantee that entry's type is std::string. | |||||
| bool GetEntryString(const std::string &name, std::string *value) const; | bool GetEntryString(const std::string &name, std::string *value) const; | ||||
| // Add a blob of data as an entry. | // Add a blob of data as an entry. | ||||
| void AddEntryBinary(const std::string &name, | void AddEntryBinary(const std::string &name, | ||||
| const std::vector<uint8_t> &value); | const std::vector<uint8_t> &value); | ||||
| // Returns false if Metadata does not contain an entry with a key of |name|. | |||||
| // This function does not guarantee that entry's type is a vector of uint8_t. | |||||
| bool GetEntryBinary(const std::string &name, | bool GetEntryBinary(const std::string &name, | ||||
| std::vector<uint8_t> *value) const; | std::vector<uint8_t> *value) const; | ||||
| Context not available. | |||||
| void RemoveEntry(const std::string &name); | void RemoveEntry(const std::string &name); | ||||
| int num_entries() const { return static_cast<int>(entries_.size()); } | int num_entries() const { return static_cast<int>(entries_.size()); } | ||||
| const std::unordered_map<std::string, EntryValue> &entries() const { | const std::map<std::string, EntryValue> &entries() const { | ||||
| return entries_; | return entries_; | ||||
| } | } | ||||
| const std::unordered_map<std::string, std::unique_ptr<Metadata>> | const std::map<std::string, std::unique_ptr<Metadata>> | ||||
| &sub_metadatas() const { | &sub_metadatas() const { | ||||
| return sub_metadatas_; | return sub_metadatas_; | ||||
| } | } | ||||
| Context not available. | |||||
| return itr->second.GetValue(entry_value); | return itr->second.GetValue(entry_value); | ||||
| } | } | ||||
| std::unordered_map<std::string, EntryValue> entries_; | std::map<std::string, EntryValue> entries_; | ||||
| std::unordered_map<std::string, std::unique_ptr<Metadata>> sub_metadatas_; | std::map<std::string, std::unique_ptr<Metadata>> sub_metadatas_; | ||||
| friend struct MetadataHasher; | friend struct MetadataHasher; | ||||
| }; | }; | ||||
| Context not available. | |||||