52 m_data(arraySize > 0 ?
Aws::
MakeUniqueArray<T>(arraySize, ARRAY_ALLOCATION_TAG) : nullptr)
59 Array(
const T* arrayToCopy,
size_t arraySize) :
63 if (arrayToCopy !=
nullptr && m_size > 0)
65 m_data.reset(Aws::NewArray<T>(m_size, ARRAY_ALLOCATION_TAG));
68 std::copy(arrayToCopy, arrayToCopy + arraySize, stdext::checked_array_iterator< T * >(m_data.get(), m_size));
70 std::copy(arrayToCopy, arrayToCopy + arraySize, m_data.get());
81 for(
auto& array : toMerge)
83 totalSize += array->m_size;
87 m_data.reset(Aws::NewArray<T>(m_size, ARRAY_ALLOCATION_TAG));
90 for(
auto& arr : toMerge)
92 if(arr->m_size > 0 && arr->m_data)
94 size_t arraySize = arr->m_size;
96 std::copy(arr->m_data.get(), arr->m_data.get() + arraySize, stdext::checked_array_iterator< T * >(m_data.get() + location, m_size));
98 std::copy(arr->m_data.get(), arr->m_data.get() + arraySize, m_data.get() + location);
100 location += arraySize;
107 m_size = other.m_size;
112 m_data.reset(Aws::NewArray<T>(m_size, ARRAY_ALLOCATION_TAG));
115 std::copy(other.m_data.get(), other.m_data.get() + other.m_size, stdext::checked_array_iterator< T * >(m_data.get(), m_size));
117 std::copy(other.m_data.get(), other.m_data.get() + other.m_size, m_data.get());
124 m_size(other.m_size),
125 m_data(
std::move(other.m_data))
128 other.m_data =
nullptr;
131 virtual ~Array() =
default;
140 m_size = other.m_size;
145 m_data.reset(Aws::NewArray<T>(m_size, ARRAY_ALLOCATION_TAG));
148 std::copy(other.m_data.get(), other.m_data.get() + other.m_size, stdext::checked_array_iterator< T * >(m_data.get(), m_size));
150 std::copy(other.m_data.get(), other.m_data.get() + other.m_size, m_data.get());
159 m_size = other.m_size;
160 m_data = std::move(other.m_data);
170 if (m_size == 0 && other.m_size == 0)
175 if (m_size == other.m_size && m_data && other.m_data)
177 for (
unsigned i = 0; i < m_size; ++i)
179 if (m_data.get()[i] != other.m_data.get()[i])
191 return !(*
this == other);
196 assert(index < m_size);
197 return m_data.get()[index];
202 assert(index < m_size);
203 return m_data.get()[index];
242 CryptoBuffer(
const unsigned char* arrayToCopy,
size_t arraySize) : ByteBuffer(arrayToCopy, arraySize) {}
Array(const T *arrayToCopy, size_t arraySize)
T const & operator[](size_t index) const
T * GetUnderlyingData() const
CryptoBuffer(CryptoBuffer &&other)
UniqueArrayPtr< T > MakeUniqueArray(std::size_t amount, const char *allocationTag, ArgTypes &&...args)
std::vector< T, Aws::Allocator< T > > Vector
bool operator!=(const CryptoBuffer &other) const
bool operator!=(const Array &other) const
static const char * ARRAY_ALLOCATION_TAG
Array(size_t arraySize=0)
CryptoBuffer(Aws::Vector< ByteBuffer * > &&toMerge)
T & GetItem(size_t index)
Array< unsigned char > ByteBuffer
CryptoBuffer & operator=(CryptoBuffer &&other)
std::unique_ptr< T, ArrayDeleter< T > > UniqueArrayPtr
CryptoBuffer(const CryptoBuffer &other)
CryptoBuffer(const ByteBuffer &other)
Array & operator=(Array &&other)
Array(Aws::Vector< Array * > &&toMerge)
bool operator==(const CryptoBuffer &other) const
T const & GetItem(size_t index) const
CryptoBuffer(size_t arraySize=0)
Array & operator=(const Array &other)
Array(const Array &other)
CryptoBuffer(const unsigned char *arrayToCopy, size_t arraySize)
bool operator==(const Array &other) const
T & operator[](size_t index)
JSON (JavaScript Object Notation).