61 lines
2.0 KiB
C++
61 lines
2.0 KiB
C++
// This file was generated by generate-classes.
|
|
// DO NOT EDIT THIS FILE!
|
|
#pragma once
|
|
|
|
#include <Cesium3DTiles/Library.h>
|
|
#include <Cesium3DTiles/PropertyStatistics.h>
|
|
#include <CesiumUtility/ExtensibleObject.h>
|
|
|
|
#include <cstdint>
|
|
#include <optional>
|
|
#include <string>
|
|
#include <unordered_map>
|
|
|
|
namespace Cesium3DTiles {
|
|
/**
|
|
* @brief Statistics about entities that conform to a class that was defined in
|
|
* a metadata schema.
|
|
*/
|
|
struct CESIUM3DTILES_API ClassStatistics final
|
|
: public CesiumUtility::ExtensibleObject {
|
|
/**
|
|
* @brief The original name of this type.
|
|
*/
|
|
static constexpr const char* TypeName = "ClassStatistics";
|
|
|
|
/**
|
|
* @brief The number of entities that conform to the class.
|
|
*/
|
|
std::optional<int64_t> count;
|
|
|
|
/**
|
|
* @brief A dictionary, where each key corresponds to a property ID in the
|
|
* class' `properties` dictionary and each value is an object containing
|
|
* statistics about property values.
|
|
*/
|
|
std::unordered_map<std::string, Cesium3DTiles::PropertyStatistics> 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(ClassStatistics));
|
|
accum += CesiumUtility::ExtensibleObject::getSizeBytes() -
|
|
int64_t(sizeof(CesiumUtility::ExtensibleObject));
|
|
accum += int64_t(
|
|
this->properties.bucket_count() *
|
|
(sizeof(std::string) + sizeof(Cesium3DTiles::PropertyStatistics)));
|
|
for (const auto& [k, v] : this->properties) {
|
|
accum += int64_t(k.capacity() * sizeof(char) - sizeof(std::string));
|
|
accum +=
|
|
v.getSizeBytes() - int64_t(sizeof(Cesium3DTiles::PropertyStatistics));
|
|
}
|
|
return accum;
|
|
}
|
|
};
|
|
} // namespace Cesium3DTiles
|