Program Listing for File Array.h
↰ Return to documentation for file (nvcv_types/include/nvcv/Array.h
)
/*
* 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_ARRAY_H
#define NVCV_ARRAY_H
#include "ArrayData.h"
#include "Export.h"
#include "Fwd.h"
#include "Status.h"
#include "alloc/Allocator.h"
#include "alloc/Requirements.h"
#include "detail/CudaFwd.h"
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct NVCVArray *NVCVArrayHandle;
typedef void (*NVCVArrayDataCleanupFunc)(void *ctx, const NVCVArrayData *data);
typedef struct NVCVArrayRequirementsRec
{
/*< Type of each element */
NVCVDataType dtype;
/*< Capacity of the array */
int64_t capacity;
/*< Distance in bytes between each data unit. */
int64_t stride;
/*< Alignment/block size in bytes */
int32_t alignBytes;
/*< Array resource requirements. */
NVCVRequirements mem;
} NVCVArrayRequirements;
NVCV_PUBLIC NVCVStatus nvcvArrayCalcRequirements(int64_t capacity, NVCVDataType dtype, int32_t alignment,
NVCVArrayRequirements *reqs);
NVCV_PUBLIC NVCVStatus nvcvArrayCalcRequirementsWithTarget(int64_t capacity, NVCVDataType dtype, int32_t alignment,
NVCVResourceType target, NVCVArrayRequirements *reqs);
NVCV_PUBLIC NVCVStatus nvcvArrayConstruct(const NVCVArrayRequirements *reqs, NVCVAllocatorHandle alloc,
NVCVArrayHandle *handle);
NVCV_PUBLIC NVCVStatus nvcvArrayConstructWithTarget(const NVCVArrayRequirements *reqs, NVCVAllocatorHandle alloc,
NVCVResourceType target, NVCVArrayHandle *handle);
NVCV_PUBLIC NVCVStatus nvcvArrayWrapDataConstruct(const NVCVArrayData *data, NVCVArrayDataCleanupFunc cleanup,
void *ctxCleanup, NVCVArrayHandle *handle);
NVCV_PUBLIC NVCVStatus nvcvArrayDecRef(NVCVArrayHandle handle, int *newRefCount);
NVCV_PUBLIC NVCVStatus nvcvArrayIncRef(NVCVArrayHandle handle, int *newRefCount);
NVCV_PUBLIC NVCVStatus nvcvArrayRefCount(NVCVArrayHandle handle, int *newRefCount);
NVCV_PUBLIC NVCVStatus nvcvArraySetUserPointer(NVCVArrayHandle handle, void *userPtr);
NVCV_PUBLIC NVCVStatus nvcvArrayGetUserPointer(NVCVArrayHandle handle, void **outUserPtr);
NVCV_PUBLIC NVCVStatus nvcvArrayGetDataType(NVCVArrayHandle handle, NVCVDataType *type);
NVCV_PUBLIC NVCVStatus nvcvArrayGetAllocator(NVCVArrayHandle handle, NVCVAllocatorHandle *alloc);
NVCV_PUBLIC NVCVStatus nvcvArrayExportData(NVCVArrayHandle handle, NVCVArrayData *data);
NVCV_PUBLIC NVCVStatus nvcvArrayGetLength(NVCVArrayHandle handle, int64_t *length);
NVCV_PUBLIC NVCVStatus nvcvArrayGetCapacity(NVCVArrayHandle handle, int64_t *capacity);
NVCV_PUBLIC NVCVStatus nvcvArrayResize(NVCVArrayHandle handle, int64_t length);
NVCV_PUBLIC NVCVStatus nvcvArrayGetTarget(NVCVArrayHandle handle, NVCVResourceType *target);
#ifdef __cplusplus
}
#endif
#endif // NVCV_ARRAY_H