Files

70 lines
2.1 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 <cstdint>
#include <optional>
#include <string>
namespace Cesium3DTiles {
/**
* @brief A buffer is a binary blob. It is either the binary chunk of the
* subtree file, or an external buffer referenced by a URI.
*/
struct CESIUM3DTILES_API BufferSpec : public CesiumUtility::ExtensibleObject {
/**
* @brief The original name of this type.
*/
static constexpr const char* TypeName = "Buffer";
/**
* @brief The URI (or IRI) of the file that contains the binary buffer data.
* Relative paths are relative to the file containing the buffer JSON. `uri`
* is required when using the JSON subtree format and not required when using
* the binary subtree format - when omitted the buffer refers to the binary
* chunk of the subtree file. Data URIs are not allowed.
*/
std::optional<std::string> uri;
/**
* @brief The length of the buffer in bytes.
*/
int64_t byteLength = int64_t();
/**
* @brief The name of the buffer.
*/
std::optional<std::string> name;
/**
* @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(BufferSpec));
accum += CesiumUtility::ExtensibleObject::getSizeBytes() -
int64_t(sizeof(CesiumUtility::ExtensibleObject));
if (this->uri) {
accum += int64_t(this->uri->capacity() * sizeof(char));
}
if (this->name) {
accum += int64_t(this->name->capacity() * sizeof(char));
}
return accum;
}
protected:
/**
* @brief This class is not meant to be instantiated directly. Use {@link Buffer} instead.
*/
BufferSpec() = default;
friend struct Buffer;
};
} // namespace Cesium3DTiles