65 lines
2.4 KiB
C
65 lines
2.4 KiB
C
|
|
// This file was generated by generate-classes.
|
||
|
|
// DO NOT EDIT THIS FILE!
|
||
|
|
#pragma once
|
||
|
|
|
||
|
|
#include <Cesium3DTiles/Library.h>
|
||
|
|
#include <CesiumUtility/ExtensibleObject.h>
|
||
|
|
#include <CesiumUtility/JsonValue.h>
|
||
|
|
|
||
|
|
#include <string>
|
||
|
|
#include <unordered_map>
|
||
|
|
|
||
|
|
namespace Cesium3DTiles {
|
||
|
|
/**
|
||
|
|
* @brief An object containing a reference to a class from a metadata schema,
|
||
|
|
* and property values that conform to the properties of that class.
|
||
|
|
*/
|
||
|
|
struct CESIUM3DTILES_API MetadataEntity
|
||
|
|
: public CesiumUtility::ExtensibleObject {
|
||
|
|
/**
|
||
|
|
* @brief The original name of this type.
|
||
|
|
*/
|
||
|
|
static constexpr const char* TypeName = "MetadataEntity";
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief The class that property values conform to. The value shall be a
|
||
|
|
* class ID declared in the `classes` dictionary of the metadata schema.
|
||
|
|
*/
|
||
|
|
std::string classProperty;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief A dictionary, where each key corresponds to a property ID in the
|
||
|
|
* class' `properties` dictionary and each value contains the property values.
|
||
|
|
* The type of the value shall match the property definition: For `BOOLEAN`
|
||
|
|
* use `true` or `false`. For `STRING` use a JSON string. For numeric types
|
||
|
|
* use a JSON number. For `ENUM` use a valid enum `name`, not an integer
|
||
|
|
* value. For `ARRAY`, `VECN`, and `MATN` types use a JSON array containing
|
||
|
|
* values matching the `componentType`. Required properties shall be included
|
||
|
|
* in this dictionary.
|
||
|
|
*/
|
||
|
|
std::unordered_map<std::string, CesiumUtility::JsonValue> properties;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* @brief Calculates the size in bytes of this object, including the contents
|
||
|
|
* of all collections, pointers, and strings. This will NOT include the size
|
||
|
|
* of any extensions attached to the object. Calling this method may be slow
|
||
|
|
* as it requires traversing the object's entire structure.
|
||
|
|
*/
|
||
|
|
int64_t getSizeBytes() const {
|
||
|
|
int64_t accum = 0;
|
||
|
|
accum += int64_t(sizeof(MetadataEntity));
|
||
|
|
accum += CesiumUtility::ExtensibleObject::getSizeBytes() -
|
||
|
|
int64_t(sizeof(CesiumUtility::ExtensibleObject));
|
||
|
|
accum += int64_t(this->classProperty.capacity() * sizeof(char));
|
||
|
|
accum += int64_t(
|
||
|
|
this->properties.bucket_count() *
|
||
|
|
(sizeof(std::string) + sizeof(CesiumUtility::JsonValue)));
|
||
|
|
for (const auto& [k, v] : this->properties) {
|
||
|
|
accum += int64_t(k.capacity() * sizeof(char) - sizeof(std::string));
|
||
|
|
accum += int64_t(sizeof(CesiumUtility::JsonValue));
|
||
|
|
}
|
||
|
|
return accum;
|
||
|
|
}
|
||
|
|
};
|
||
|
|
} // namespace Cesium3DTiles
|