/****************************************************************************** * Name: gdalmultidim_priv.h * Project: GDAL Core * Purpose: GDAL private header for multidimensional support * Author: Even Rouault * ****************************************************************************** * Copyright (c) 2023, Even Rouault * * SPDX-License-Identifier: MIT ****************************************************************************/ #ifndef GDALMULTIDIM_PRIV_INCLUDED #define GDALMULTIDIM_PRIV_INCLUDED #include "gdal_priv.h" //! @cond Doxygen_Suppress // For C API struct GDALExtendedDataTypeHS { std::unique_ptr m_poImpl; explicit GDALExtendedDataTypeHS(GDALExtendedDataType *dt) : m_poImpl(dt) { } }; struct GDALEDTComponentHS { std::unique_ptr m_poImpl; explicit GDALEDTComponentHS(const GDALEDTComponent &component) : m_poImpl(new GDALEDTComponent(component)) { } }; struct GDALGroupHS { std::shared_ptr m_poImpl; explicit GDALGroupHS(const std::shared_ptr &poGroup) : m_poImpl(poGroup) { } }; struct GDALMDArrayHS { std::shared_ptr m_poImpl; explicit GDALMDArrayHS(const std::shared_ptr &poArray) : m_poImpl(poArray) { } }; struct GDALAttributeHS { std::shared_ptr m_poImpl; explicit GDALAttributeHS(const std::shared_ptr &poAttr) : m_poImpl(poAttr) { } }; struct GDALDimensionHS { std::shared_ptr m_poImpl; explicit GDALDimensionHS(const std::shared_ptr &poDim) : m_poImpl(poDim) { } }; class GDALMDIAsAttribute final : public GDALAttribute { std::vector> m_dims{}; const GDALExtendedDataType m_dt = GDALExtendedDataType::CreateString(); std::string m_osValue; public: GDALMDIAsAttribute(const std::string &name, const std::string &value) : GDALAbstractMDArray(std::string(), name), GDALAttribute(std::string(), name), m_osValue(value) { } const std::vector> & GetDimensions() const override; const GDALExtendedDataType &GetDataType() const override { return m_dt; } bool IRead(const GUInt64 *, const size_t *, const GInt64 *, const GPtrDiff_t *, const GDALExtendedDataType &bufferDataType, void *pDstBuffer) const override { const char *pszStr = m_osValue.c_str(); GDALExtendedDataType::CopyValue(&pszStr, m_dt, pDstBuffer, bufferDataType); return true; } }; //! @endcond #endif // GDALMULTIDIM_PRIV_INCLUDED