Changeset View
Changeset View
Standalone View
Standalone View
extern/draco/draco/src/draco/compression/config/draco_options.h
- This file was moved from extern/draco/dracoenc/src/draco/compression/config/draco_options.h.
| Show First 20 Lines • Show All 153 Lines • ▼ Show 20 Lines | Options *DracoOptions<AttributeKeyT>::GetAttributeOptions( | ||||
| return &it->second; | return &it->second; | ||||
| } | } | ||||
| template <typename AttributeKeyT> | template <typename AttributeKeyT> | ||||
| int DracoOptions<AttributeKeyT>::GetAttributeInt(const AttributeKeyT &att_key, | int DracoOptions<AttributeKeyT>::GetAttributeInt(const AttributeKeyT &att_key, | ||||
| const std::string &name, | const std::string &name, | ||||
| int default_val) const { | int default_val) const { | ||||
| const Options *const att_options = FindAttributeOptions(att_key); | const Options *const att_options = FindAttributeOptions(att_key); | ||||
| if (att_options && att_options->IsOptionSet(name)) | if (att_options && att_options->IsOptionSet(name)) { | ||||
| return att_options->GetInt(name, default_val); | return att_options->GetInt(name, default_val); | ||||
| } | |||||
| return global_options_.GetInt(name, default_val); | return global_options_.GetInt(name, default_val); | ||||
| } | } | ||||
| template <typename AttributeKeyT> | template <typename AttributeKeyT> | ||||
| void DracoOptions<AttributeKeyT>::SetAttributeInt(const AttributeKeyT &att_key, | void DracoOptions<AttributeKeyT>::SetAttributeInt(const AttributeKeyT &att_key, | ||||
| const std::string &name, | const std::string &name, | ||||
| int val) { | int val) { | ||||
| GetAttributeOptions(att_key)->SetInt(name, val); | GetAttributeOptions(att_key)->SetInt(name, val); | ||||
| } | } | ||||
| template <typename AttributeKeyT> | template <typename AttributeKeyT> | ||||
| float DracoOptions<AttributeKeyT>::GetAttributeFloat( | float DracoOptions<AttributeKeyT>::GetAttributeFloat( | ||||
| const AttributeKeyT &att_key, const std::string &name, | const AttributeKeyT &att_key, const std::string &name, | ||||
| float default_val) const { | float default_val) const { | ||||
| const Options *const att_options = FindAttributeOptions(att_key); | const Options *const att_options = FindAttributeOptions(att_key); | ||||
| if (att_options && att_options->IsOptionSet(name)) | if (att_options && att_options->IsOptionSet(name)) { | ||||
| return att_options->GetFloat(name, default_val); | return att_options->GetFloat(name, default_val); | ||||
| } | |||||
| return global_options_.GetFloat(name, default_val); | return global_options_.GetFloat(name, default_val); | ||||
| } | } | ||||
| template <typename AttributeKeyT> | template <typename AttributeKeyT> | ||||
| void DracoOptions<AttributeKeyT>::SetAttributeFloat( | void DracoOptions<AttributeKeyT>::SetAttributeFloat( | ||||
| const AttributeKeyT &att_key, const std::string &name, float val) { | const AttributeKeyT &att_key, const std::string &name, float val) { | ||||
| GetAttributeOptions(att_key)->SetFloat(name, val); | GetAttributeOptions(att_key)->SetFloat(name, val); | ||||
| } | } | ||||
| template <typename AttributeKeyT> | template <typename AttributeKeyT> | ||||
| bool DracoOptions<AttributeKeyT>::GetAttributeBool(const AttributeKeyT &att_key, | bool DracoOptions<AttributeKeyT>::GetAttributeBool(const AttributeKeyT &att_key, | ||||
| const std::string &name, | const std::string &name, | ||||
| bool default_val) const { | bool default_val) const { | ||||
| const Options *const att_options = FindAttributeOptions(att_key); | const Options *const att_options = FindAttributeOptions(att_key); | ||||
| if (att_options && att_options->IsOptionSet(name)) | if (att_options && att_options->IsOptionSet(name)) { | ||||
| return att_options->GetBool(name, default_val); | return att_options->GetBool(name, default_val); | ||||
| } | |||||
| return global_options_.GetBool(name, default_val); | return global_options_.GetBool(name, default_val); | ||||
| } | } | ||||
| template <typename AttributeKeyT> | template <typename AttributeKeyT> | ||||
| void DracoOptions<AttributeKeyT>::SetAttributeBool(const AttributeKeyT &att_key, | void DracoOptions<AttributeKeyT>::SetAttributeBool(const AttributeKeyT &att_key, | ||||
| const std::string &name, | const std::string &name, | ||||
| bool val) { | bool val) { | ||||
| GetAttributeOptions(att_key)->SetBool(name, val); | GetAttributeOptions(att_key)->SetBool(name, val); | ||||
| } | } | ||||
| template <typename AttributeKeyT> | template <typename AttributeKeyT> | ||||
| template <typename DataTypeT> | template <typename DataTypeT> | ||||
| bool DracoOptions<AttributeKeyT>::GetAttributeVector( | bool DracoOptions<AttributeKeyT>::GetAttributeVector( | ||||
| const AttributeKey &att_key, const std::string &name, int num_dims, | const AttributeKey &att_key, const std::string &name, int num_dims, | ||||
| DataTypeT *val) const { | DataTypeT *val) const { | ||||
| const Options *const att_options = FindAttributeOptions(att_key); | const Options *const att_options = FindAttributeOptions(att_key); | ||||
| if (att_options && att_options->IsOptionSet(name)) | if (att_options && att_options->IsOptionSet(name)) { | ||||
| return att_options->GetVector(name, num_dims, val); | return att_options->GetVector(name, num_dims, val); | ||||
| } | |||||
| return global_options_.GetVector(name, num_dims, val); | return global_options_.GetVector(name, num_dims, val); | ||||
| } | } | ||||
| template <typename AttributeKeyT> | template <typename AttributeKeyT> | ||||
| template <typename DataTypeT> | template <typename DataTypeT> | ||||
| void DracoOptions<AttributeKeyT>::SetAttributeVector( | void DracoOptions<AttributeKeyT>::SetAttributeVector( | ||||
| const AttributeKey &att_key, const std::string &name, int num_dims, | const AttributeKey &att_key, const std::string &name, int num_dims, | ||||
| const DataTypeT *val) { | const DataTypeT *val) { | ||||
| GetAttributeOptions(att_key)->SetVector(name, val, num_dims); | GetAttributeOptions(att_key)->SetVector(name, val, num_dims); | ||||
| } | } | ||||
| template <typename AttributeKeyT> | template <typename AttributeKeyT> | ||||
| bool DracoOptions<AttributeKeyT>::IsAttributeOptionSet( | bool DracoOptions<AttributeKeyT>::IsAttributeOptionSet( | ||||
| const AttributeKey &att_key, const std::string &name) const { | const AttributeKey &att_key, const std::string &name) const { | ||||
| const Options *const att_options = FindAttributeOptions(att_key); | const Options *const att_options = FindAttributeOptions(att_key); | ||||
| if (att_options) | if (att_options) { | ||||
| return att_options->IsOptionSet(name); | return att_options->IsOptionSet(name); | ||||
| } | |||||
| return global_options_.IsOptionSet(name); | return global_options_.IsOptionSet(name); | ||||
| } | } | ||||
| template <typename AttributeKeyT> | template <typename AttributeKeyT> | ||||
| void DracoOptions<AttributeKeyT>::SetAttributeOptions( | void DracoOptions<AttributeKeyT>::SetAttributeOptions( | ||||
| const AttributeKey &att_key, const Options &options) { | const AttributeKey &att_key, const Options &options) { | ||||
| Options *att_options = GetAttributeOptions(att_key); | Options *att_options = GetAttributeOptions(att_key); | ||||
| *att_options = options; | *att_options = options; | ||||
| } | } | ||||
| } // namespace draco | } // namespace draco | ||||
| #endif // DRACO_SRC_DRACO_COMPRESSION_CONFIG_DRACO_OPTIONS_H_ | #endif // DRACO_SRC_DRACO_COMPRESSION_CONFIG_DRACO_OPTIONS_H_ | ||||