21 template<
typename T,
typename INDEX_TYPE,
template<
typename >
class BUFFER_TYPE >
32 template<
typename >
class BUFFER_TYPE >
55 ArrayOfArrays( INDEX_TYPE
const numArrays=0, INDEX_TYPE
const defaultArrayCapacity=0 ):
58 resize( numArrays, defaultArrayCapacity );
110 toView()
const && =
delete;
234 using ParentClass::operator[];
235 using ParentClass::operator();
253 void resize( INDEX_TYPE
const newSize, INDEX_TYPE
const defaultArrayCapacity=0 )
287 template<
typename ITER >
305 template<
typename ITER >
306 void insertArray( INDEX_TYPE
const i, ITER
const first, ITER
const last )
311 INDEX_TYPE
const offset = this->
m_offsets[ i ];
347 template<
typename ... ARGS >
350 dynamicallyGrowArray( i, 1 );
361 template<
typename ITER >
365 dynamicallyGrowArray( i, n );
378 template<
typename ... ARGS >
379 void emplace( INDEX_TYPE
const i, INDEX_TYPE
const j, ARGS && ... args )
381 dynamicallyGrowArray( i, 1 );
393 template<
typename ITER >
394 void insertIntoArray( INDEX_TYPE
const i, INDEX_TYPE
const j, ITER
const first, ITER
const last )
397 dynamicallyGrowArray( i, n );
410 template<
class ... ARGS >
411 void resizeArray( INDEX_TYPE
const i, INDEX_TYPE
const newSize, ARGS && ... args )
422 T *
const values = (*this)[i];
465 { ParentClass::template setName< decltype( *this ) >( name ); }
474 void dynamicallyGrowArray( INDEX_TYPE
const i, INDEX_TYPE
const increase )
478 INDEX_TYPE
const newArraySize =
sizeOfArray( i ) + increase;
void emplace(BUFFER &buf, std::ptrdiff_t const size, std::ptrdiff_t const pos, ARGS &&... args)
Construct a new value at position pos.
void assimilate(ArrayOfSets< T, INDEX_TYPE, BUFFER_TYPE > &&src)
Steal the resources from an ArrayOfSets and convert it to an ArrayOfArrays.
#define LVARRAY_ASSERT(EXP)
Assert EXP is true with no message.
constexpr std::iterator_traits< ITER >::difference_type iterDistance(ITER first, ITER const last, std::input_iterator_tag)
constexpr ArrayOfArraysView< T, INDEX_TYPE const, false, BUFFER_TYPE > toView() const &
void emplace(INDEX_TYPE const i, INDEX_TYPE const j, ARGS &&... args) const
Insert a value into an array.
void emplaceBack(BUFFER &buf, std::ptrdiff_t const size, ARGS &&... args)
Construct a new value at the end of the buffer.
#define ARRAYOFARRAYS_CHECK_BOUNDS(i)
Check that i is a valid array index.
ArrayOfArrays(INDEX_TYPE const numArrays=0, INDEX_TYPE const defaultArrayCapacity=0)
Constructor.
INDEX_TYPE size_type
The integer type used for indexing, here for stl compatability.
void emplaceBack(INDEX_TYPE const i, ARGS &&... args)
Append a value to an array constructing it in place with the given arguments.
void reserve(INDEX_TYPE const newCapacity)
Reserve space for the given number of arrays.
void emplaceBack(INDEX_TYPE const i, ARGS &&... args) const
Append a value to an array.
INDEX_TYPE IndexType
The integer type used for indexing.
constexpr ArrayOfArraysView< T, INDEX_TYPE const, true, BUFFER_TYPE > toViewConstSizes() const &
void resize(INDEX_TYPE const newSize, INDEX_TYPE const defaultArrayCapacity=0)
Set the number of arrays.
BUFFER_TYPE< INDEX_TYPE > m_offsets
constexpr INDEX_TYPE_NC size() const
BUFFER_TYPE< T > m_values
void move(MemorySpace const space, bool touch=true) const
Move this ArrayOfArrays to the given memory space.
void insertIntoArray(INDEX_TYPE const i, INDEX_TYPE const j, ITER const first, ITER const last)
Insert values into an array.
constexpr INDEX_TYPE_NC capacityOfArray(INDEX_TYPE const i) const
BUFFER_TYPE< SIZE_TYPE > m_sizes
Holds the size of each array.
T value_type
An alias for the type contained in the inner arrays, here for stl compatability.
void appendArray(ITER const first, ITER const last)
Append an array.
void compress(BUFFERS &... buffers)
Compress the arrays so that the values of each array are contiguous with no extra capacity in between...
This class implements an array of arrays like object with contiguous storage.
constexpr std::enable_if< std::is_signed< INDEX_TYPE >::value, bool >::type isPositive(INDEX_TYPE const i)
ArrayOfArraysView & operator=(ArrayOfArraysView const &)=default
Default copy assignment operator.
void resize(INDEX_TYPE const newSize, INDEX_TYPE const defaultArrayCapacity=0)
Set the number of arrays.
constexpr ArrayOfArraysView< T, INDEX_TYPE const, CONST_SIZES, BUFFER_TYPE > toView() const
void setCapacityOfArray(INDEX_TYPE const i, INDEX_TYPE const newCapacity)
Set the capacity of an array.
void insertArray(INDEX_TYPE const i, ITER const first, ITER const last)
Insert an array.
ArrayOfArrays(ArrayOfArrays const &src)
Copy constructor, performs a deep copy.
This class provides a view into an array of arrays like object.
void emplaceBackAtomic(INDEX_TYPE const i, ARGS &&... args) const
Append a value to an array in a thread safe manner.
void insertIntoArray(INDEX_TYPE const i, INDEX_TYPE const j, ITER const first, ITER const last) const
Insert values into an array.
constexpr INDEX_TYPE_NC sizeOfArray(INDEX_TYPE const i) const
void appendToArray(INDEX_TYPE const i, ITER const first, ITER const last) const
Append values to an array.
#define ARRAYOFARRAYS_CHECK_INSERT_BOUNDS(i)
Check that i is a valid index to insert an array at.
void appendToArray(INDEX_TYPE const i, ITER const first, ITER const last)
Append values to an array.
CONSTEXPR_WITH_NDEBUG INDEX_TYPE_NC capacity() const
constexpr ArrayOfArraysView< T, INDEX_TYPE const, true, BUFFER_TYPE > toViewConstSizes() const
MemorySpace
An enum containing the available memory spaces.
void appendArray(INDEX_TYPE const n)
Append an array.
Contains the implementation of LvArray::ArrayOfArraysView.
ArrayOfArrays & operator=(ArrayOfArrays &&src)
Default move assignment operator, performs a shallow copy.
This class implements an array of sets like object with contiguous storage.
void eraseFromArray(INDEX_TYPE const i, INDEX_TYPE const j, INDEX_TYPE const n=1) const
Erase values from an array.
void resizeFromCapacities(INDEX_TYPE const numSubArrays, INDEX_TYPE const *const capacities, BUFFERS &... buffers)
Clears the array and creates a new array with the given number of sub-arrays.
~ArrayOfArrays()
Destructor, frees the values, sizes and offsets buffers.
void setEqualTo(INDEX_TYPE const srcNumArrays, INDEX_TYPE const srcMaxOffset, BUFFER_TYPE< INDEX_TYPE > const &srcOffsets, BUFFER_TYPE< INDEX_TYPE > const &srcSizes, BUFFER_TYPE< T > const &srcValues, PAIRS_OF_BUFFERS &&... pairs)
Set this ArrayOfArraysView equal to the provided arrays.
void resize(T *const LVARRAY_RESTRICT ptr, std::ptrdiff_t const size, std::ptrdiff_t const newSize, ARGS &&... args)
Resize the give array.
void clearArray(INDEX_TYPE const i)
Clear the given array.
INDEX_TYPE_NC m_numArrays
The number of arrays contained.
void emplace(INDEX_TYPE const i, INDEX_TYPE const j, ARGS &&... args)
Insert a value into an array constructing it in place.
void free(BUFFERS &... buffers)
Destroy all the objects held by this array and free all associated memory.
void setCapacityOfArray(INDEX_TYPE const i, INDEX_TYPE const newCapacity, BUFFERS &... buffers)
Set the capacity of the given array.
void assimilate(ArrayOfArraysView< T, INDEX_TYPE, CONST_SIZES, BUFFER_TYPE > &&src)
Steal the resources of src, clearing it in the process.
void move(MemorySpace const space, bool touch=true) const
Move this ArrayOfArrays to the given memory space.
std::string string
String type.
void setName(std::string const &name)
Set the name to be displayed whenever the underlying Buffer's user call back is called.
void eraseArray(INDEX_TYPE const i)
Erase an array.
ArrayOfArrays & operator=(ArrayOfArrays const &src)
Copy assignment operator, performs a deep copy.
void reserveValues(INDEX_TYPE const newValueCapacity, BUFFERS &... buffers)
Reserve space for the given number of values.
constexpr INDEX_TYPE_NC valueCapacity() const
void resizeArray(INDEX_TYPE const i, INDEX_TYPE const newSize, ARGS &&... args)
Set the number of values in an array.
void erase(BUFFER &buf, std::ptrdiff_t const size, std::ptrdiff_t const pos)
Erase a value from the buffer.
constexpr ArrayOfArraysView< T const, INDEX_TYPE const, true, BUFFER_TYPE > toViewConst() const
T ValueType
An alias for the type contained in the inner arrays.
constexpr ArrayOfArraysView< T const, INDEX_TYPE const, true, BUFFER_TYPE > toViewConst() const &