' Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
'
' SPDX-FileCopyrightText: NVIDIA CORPORATION & AFFILIATES
' SPDX-License-Identifier: Apache-2.0
'
' NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
' property and proprietary rights in and to this material, related
' documentation and any modifications thereto. Any use, reproduction,
' disclosure or distribution of this material and related documentation
' without an express license agreement from NVIDIA CORPORATION or
' its affiliates is strictly prohibited.

@startuml

class ImageData
{
    + format() const: ImageFormat

    + cdata() const &: const NVCVImageData &
    + cdata() &&: NVCVImageData

    + cast<Derived> const: Optional<Derived>
}

class ImageDataCudaArray extends ImageData
{
    + numPlanes() const: int32_t
    + plane(int p) const: cudaArray_t

    + {static} IsCompatibleKind(NVCVImageBufferType kind) : bool
}

struct Size2D
{
    + w: int32_t
    + h: int32_t
}

struct ImagePlaneStrided
{
    + width: int32_t
    + height: int32_t
    + rowStride: int32_t
    + mem: void *
}

class ImageDataStrided extends ImageData
{
    + size() const: Size2D

    + numPlanes() const: int32_t
    + plane(int p) const: const ImagePlaneStrided &

    + {static} IsCompatibleKind(NVCVImageBufferType kind) : bool
}

struct ImageBufferCudaArray
{
    + numPlanes: int32_t
    + planes: cudaArray_t[MAX_PLANES]
}

class ImageDataCudaArray extends ImageDadta
{
    + ImageDataCudaArray(ImageFormat fmt,
                         const ImageBufferCudaArray &buffer)

    + {static} IsCompatibleKind(NVCVImageBufferType kind) : bool
}

struct ImageBufferStrided
{
    + numPlanes: int32_t
    + planes: ImagePlaneStrided[MAX_PLANES]
}

class ImageDataStridedCuda extends ImageDataStrided
{
    + ImageDataStridedCuda(ImageFormat fmt,
                           const ImageBufferStrided &buffer)

    + {static} IsCompatibleKind(NVCVImageBufferType kind) : bool
}

class ImageDataStridedHost extends ImageDataStrided
{
    + ImageDataStridedHost(ImageFormat fmt,
                           const ImageBufferStrided &buffer)

    + {static} IsCompatibleKind(NVCVImageBufferType kind) : bool
}

ImageBufferStrided -up-o ImageDataStridedHost
ImageBufferStrided -up-o ImageDataStridedCuda
ImagePlaneStrided -right-o ImageBufferStrided: contains <

ImageBufferCudaArray -up-o ImageDataCudaArray

@enduml
