|
NVIDIA DeepStream SDK API Reference
|
6.4 Release
|
Go to the documentation of this file.
11 #ifndef CVCORE_ARRAY_H
12 #define CVCORE_ARRAY_H
33 ArrayBase(std::size_t capacity, std::size_t elemSize,
void *dataPtr,
bool isCPU);
122 std::size_t m_capacity;
123 std::size_t m_elemSize;
151 Array(std::size_t size, std::size_t capacity,
void *dataPtr,
bool isCPU =
true)
194 *
this = std::move(t);
202 static_cast<ArrayBase &
>(*this) = std::move(t);
212 const std::size_t oldSize =
getSize();
217 for (std::size_t i = size; i < oldSize; ++i)
222 for (std::size_t i = oldSize; i < size; ++i)
236 assert(idx >= 0 && idx <
getSize());
237 return *
reinterpret_cast<T *
>(
getElement(idx));
247 assert(idx >= 0 && idx <
getSize());
248 return *
reinterpret_cast<T *
>(
getElement(idx));
257 template<
typename T, std::
size_t N>
319 *
this = std::move(t);
327 static_cast<ArrayBase &
>(*this) = std::move(t);
337 const std::size_t oldSize =
getSize();
342 for (std::size_t i = size; i < oldSize; ++i)
347 for (std::size_t i = oldSize; i < size; ++i)
361 assert(idx >= 0 && idx <
getSize());
362 return *
reinterpret_cast<T *
>(
getElement(idx));
372 assert(idx >= 0 && idx <
getSize());
373 return *
reinterpret_cast<T *
>(
getElement(idx));
379 #endif // CVCORE_ARRAY_H
std::size_t getElementSize() const
Get the size of each element.
Array & operator=(const Array &)=delete
Array is non-copyable.
Base implementation of Array.
bool isCPU() const
Get the flag whether the array is CPU or GPU array.
ArrayN(bool isCPU)
Constructor of a memory-owning ArrayN.
~Array()
Destructor of the Array.
~ArrayN()
Destructor of the ArrayN.
bool isOwning() const
Get the flag whether the array is owning memory space.
void * getElement(int idx) const
Get the pointer to specified index.
ArrayN(std::size_t size, void *dataPtr, bool isCPU=true)
Constructor of a non-owning ArrayN.
T & operator[](int idx)
ArrayN index operator.
ArrayN()
Default constructor of ArrayN (create an owning Tensor with capacity N).
T & operator[](int idx)
Array index operator.
ArrayBase & operator=(const ArrayBase &)=delete
ArrayBase is non-copyable.
const T & operator[](int idx) const
Const ArrayN index operator.
Array(std::size_t size, std::size_t capacity, void *dataPtr, bool isCPU=true)
Constructor of a non-owning array.
void setSize(std::size_t size)
Set the size of the array.
Implementation of Array class.
Array & operator=(Array &&t)
Move assignment operator of Array.
std::size_t getSize() const
Get the size of the array.
void * getData() const
Get the raw pointer to the array data.
Array()
Default constructor of an array.
ArrayN(ArrayN &&t)
Move constructor of ArrayN.
~ArrayBase()
Destructor of ArrayBase.
ArrayN & operator=(ArrayN &&t)
Move assignment operator of ArrayN.
Array(Array &&t)
Move constructor of Array.
void setSize(std::size_t size)
Set size of the ArrayN.
Implementation of ArrayN class.
void setSize(std::size_t size)
Set size of the Array.
ArrayN & operator=(const ArrayN &)=delete
ArrayN is non-copyable.
Array(std::size_t capacity, bool isCPU=true)
Constructor of a memory-owning array.
const T & operator[](int idx) const
Const array index operator.
std::size_t getCapacity() const
Get the capacity of the array.