cesium-native  0.41.0
CesiumUtility::ExtensibleObject Struct Reference

The base class for objects that have extensions and extras. More...

#include <CesiumUtility/ExtensibleObject.h>

Inheritance diagram for CesiumUtility::ExtensibleObject:
CesiumUtility::SharedAsset< ImageAsset > Cesium3DTiles::Asset Cesium3DTiles::Availability Cesium3DTiles::BoundingVolume Cesium3DTiles::BufferSpec Cesium3DTiles::BufferView Cesium3DTiles::Class Cesium3DTiles::ClassProperty Cesium3DTiles::ClassStatistics Cesium3DTiles::Content Cesium3DTiles::Enum Cesium3DTiles::EnumValue Cesium3DTiles::Extension3dTilesBoundingVolumeS2 Cesium3DTiles::ImplicitTiling Cesium3DTiles::MetadataEntity Cesium3DTiles::Properties Cesium3DTiles::PropertyStatistics Cesium3DTiles::PropertyTable Cesium3DTiles::PropertyTableProperty Cesium3DTiles::Schema Cesium3DTiles::Statistics Cesium3DTiles::Subtree Cesium3DTiles::Subtrees Cesium3DTiles::Tile Cesium3DTiles::Tileset CesiumGltf::AccessorSparse CesiumGltf::AccessorSparseIndices CesiumGltf::AccessorSparseValues CesiumGltf::AnimationChannel CesiumGltf::AnimationChannelTarget CesiumGltf::AnimationSampler CesiumGltf::Asset CesiumGltf::CameraOrthographic CesiumGltf::CameraPerspective CesiumGltf::Class CesiumGltf::ClassProperty CesiumGltf::Enum CesiumGltf::EnumValue CesiumGltf::ExtensionBufferExtMeshoptCompression CesiumGltf::ExtensionBufferViewExtMeshoptCompression CesiumGltf::ExtensionCesiumPrimitiveOutline CesiumGltf::ExtensionCesiumRTC CesiumGltf::ExtensionCesiumTileEdges CesiumGltf::ExtensionExtInstanceFeatures CesiumGltf::ExtensionExtInstanceFeaturesFeatureId CesiumGltf::ExtensionExtMeshFeatures CesiumGltf::ExtensionExtMeshGpuInstancing CesiumGltf::ExtensionKhrDracoMeshCompression CesiumGltf::ExtensionKhrMaterialsUnlit CesiumGltf::ExtensionKhrTextureBasisu CesiumGltf::ExtensionKhrTextureTransform CesiumGltf::ExtensionMeshPrimitiveExtStructuralMetadata CesiumGltf::ExtensionMeshPrimitiveKhrMaterialsVariants CesiumGltf::ExtensionMeshPrimitiveKhrMaterialsVariantsMappingsValue CesiumGltf::ExtensionModelExtStructuralMetadata CesiumGltf::ExtensionModelKhrMaterialsVariants CesiumGltf::ExtensionModelMaxarMeshVariants CesiumGltf::ExtensionNodeMaxarMeshVariants CesiumGltf::ExtensionNodeMaxarMeshVariantsMappingsValue CesiumGltf::ExtensionTextureWebp CesiumGltf::FeatureId CesiumGltf::MaterialPBRMetallicRoughness CesiumGltf::MeshPrimitive CesiumGltf::ModelSpec CesiumGltf::NamedObject CesiumGltf::PropertyAttribute CesiumGltf::PropertyAttributeProperty CesiumGltf::PropertyTable CesiumGltf::PropertyTableProperty CesiumGltf::PropertyTexture CesiumGltf::Schema CesiumGltf::TextureInfo CesiumUtility::SharedAsset< T >

Public Member Functions

template<typename T >
bool hasExtension () const noexcept
 Checks if an extension exists given its static type. More...
 
template<typename T >
const T * getExtension () const noexcept
 Gets an extension given its static type. More...
 
template<typename T >
T * getExtension () noexcept
 Gets an extension given its static type. More...
 
const JsonValuegetGenericExtension (const std::string &extensionName) const noexcept
 Gets a generic extension with the given name as a CesiumUtility::JsonValue. More...
 
JsonValuegetGenericExtension (const std::string &extensionName) noexcept
 Gets a generic extension with the given name as a CesiumUtility::JsonValue. More...
 
template<typename T , typename... ConstructorArgumentTypes>
T & addExtension (ConstructorArgumentTypes &&... constructorArguments)
 Adds a statically-typed extension to this object. More...
 
template<typename T >
void removeExtension ()
 Removes a statically-typed extension from this object. More...
 

Public Attributes

std::unordered_map< std::string, std::any > extensions
 The extensions attached to this object. More...
 
JsonValue::Object extras
 Application-specific data. More...
 
JsonValue::Object unknownProperties
 Unknown properties that exist on this object but do not have any representation in the statically-typed classes. More...
 

Detailed Description

The base class for objects that have extensions and extras.

Definition at line 15 of file ExtensibleObject.h.

Member Function Documentation

◆ addExtension()

template<typename T , typename... ConstructorArgumentTypes>
T& CesiumUtility::ExtensibleObject::addExtension ( ConstructorArgumentTypes &&...  constructorArguments)
inline

Adds a statically-typed extension to this object.

If the extension already exists, the existing one is returned.

Template Parameters
TThe type of the extension to add.
Returns
The added extension.

Definition at line 74 of file ExtensibleObject.h.

◆ getExtension() [1/2]

template<typename T >
const T* CesiumUtility::ExtensibleObject::getExtension ( ) const
inlinenoexcept

Gets an extension given its static type.

Template Parameters
TThe type of the extension.
Returns
A pointer to the extension, or nullptr if the extension is not attached to this object.

Definition at line 34 of file ExtensibleObject.h.

◆ getExtension() [2/2]

template<typename T >
T* CesiumUtility::ExtensibleObject::getExtension ( )
inlinenoexcept

Gets an extension given its static type.

Template Parameters
TThe type of the extension.
Returns
A pointer to the extension, or nullptr if the extension is not attached to this object.

Definition at line 44 of file ExtensibleObject.h.

◆ getGenericExtension() [1/2]

const JsonValue* CesiumUtility::ExtensibleObject::getGenericExtension ( const std::string &  extensionName) const
noexcept

Gets a generic extension with the given name as a CesiumUtility::JsonValue.

If the extension exists but has a static type, this method will return nullptr. Use getExtension to retrieve a statically-typed extension.

Parameters
extensionNameThe name of the extension.
Returns
The generic extension, or nullptr if the generic extension doesn't exist.

◆ getGenericExtension() [2/2]

JsonValue* CesiumUtility::ExtensibleObject::getGenericExtension ( const std::string &  extensionName)
noexcept

Gets a generic extension with the given name as a CesiumUtility::JsonValue.

If the extension exists but has a static type, this method will return nullptr. Use getExtension to retrieve a statically-typed extension.

Parameters
extensionNameThe name of the extension.
Returns
The generic extension, or nullptr if the generic extension doesn't exist.

◆ hasExtension()

template<typename T >
bool CesiumUtility::ExtensibleObject::hasExtension ( ) const
inlinenoexcept

Checks if an extension exists given its static type.

Template Parameters
TThe type of the extension.
Returns
A boolean indicating whether the extension exists.

Definition at line 22 of file ExtensibleObject.h.

◆ removeExtension()

template<typename T >
void CesiumUtility::ExtensibleObject::removeExtension ( )
inline

Removes a statically-typed extension from this object.

Template Parameters
TThe type of the extension to remove.

Definition at line 90 of file ExtensibleObject.h.

Member Data Documentation

◆ extensions

std::unordered_map<std::string, std::any> CesiumUtility::ExtensibleObject::extensions

The extensions attached to this object.

Use getExtension to get the extension with a particular static type. Use getGenericExtension to get unknown extensions as a generic CesiumUtility::JsonValue.

Definition at line 101 of file ExtensibleObject.h.

◆ extras

JsonValue::Object CesiumUtility::ExtensibleObject::extras

Application-specific data.

Implementation Note: Although extras may have any type, it is common for applications to store and access custom data as key/value pairs. As best practice, extras should be an Object rather than a primitive value for best portability.

Definition at line 111 of file ExtensibleObject.h.

◆ unknownProperties

JsonValue::Object CesiumUtility::ExtensibleObject::unknownProperties

Unknown properties that exist on this object but do not have any representation in the statically-typed classes.

These properties may be invalid, or they may represent deprecated, experimental, or next-version properties.

Definition at line 120 of file ExtensibleObject.h.


The documentation for this struct was generated from the following file: