Program Listing for File ImageBatchData.hpp
↰ Return to documentation for file (nvcv_types/include/nvcv/ImageBatchData.hpp
)
/*
* SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef NVCV_IMAGEBATCHDATA_HPP
#define NVCV_IMAGEBATCHDATA_HPP
#include "ImageBatchData.h"
#include "ImageData.hpp"
#include "ImageFormat.hpp"
#include "Optional.hpp"
#include "detail/CudaFwd.h"
namespace nvcv {
class ImageBatchData
{
public:
template<typename Derived>
Optional<Derived> cast() const;
static constexpr bool IsCompatibleKind(NVCVImageBatchBufferType type)
{
return type != NVCV_IMAGE_BATCH_BUFFER_NONE;
}
ImageBatchData() = default;
ImageBatchData(const NVCVImageBatchData &data)
: m_data(data)
{
}
const NVCVImageBatchData &cdata() const &;
NVCVImageBatchData cdata() &&;
int32_t numImages() const;
protected:
NVCVImageBatchData &data() &;
private:
NVCVImageBatchData m_data{};
};
class ImageBatchVarShapeData : public ImageBatchData
{
public:
using ImageBatchData::ImageBatchData;
explicit ImageBatchVarShapeData(const NVCVImageBatchData &data);
const NVCVImageFormat *formatList() const;
const NVCVImageFormat *hostFormatList() const;
Size2D maxSize() const;
ImageFormat uniqueFormat() const;
static constexpr bool IsCompatibleKind(NVCVImageBatchBufferType type)
{
return type == NVCV_IMAGE_BATCH_VARSHAPE_BUFFER_STRIDED_CUDA;
}
};
class ImageBatchVarShapeDataStrided : public ImageBatchVarShapeData
{
public:
using ImageBatchVarShapeData::ImageBatchVarShapeData;
explicit ImageBatchVarShapeDataStrided(const NVCVImageBatchData &data);
const NVCVImageBufferStrided *imageList() const;
};
class ImageBatchVarShapeDataStridedCuda : public ImageBatchVarShapeDataStrided
{
public:
using Buffer = NVCVImageBatchVarShapeBufferStrided;
using ImageBatchVarShapeDataStrided::ImageBatchVarShapeDataStrided;
explicit ImageBatchVarShapeDataStridedCuda(int32_t numImages, const Buffer &buffer);
explicit ImageBatchVarShapeDataStridedCuda(const NVCVImageBatchData &data);
};
} // namespace nvcv
#include "detail/ImageBatchDataImpl.hpp"
#endif // NVCV_IMAGEBATCHDATA_HPP