11#include <util/containers/Array.h>
12#include <util/misc/Memory.h>
30 template <
typename Data>
130 template <
class Archive>
131 void serialize(Archive& ar,
const unsigned int version);
147 template <
typename Data>
155 template <
typename Data>
167 template <
typename Data>
172 UTIL_THROW(
"Other DArray must be allocated.");
184 template <
typename Data>
192 std::cout <<
"Exception in DArray destructor";
203 template <
typename Data>
207 if (
this == &other)
return *
this;
232 template <
typename Data>
236 if (
dynamic_cast< Array<Data>*
>(
this) == &other)
return *
this;
261 template <
typename Data>
265 UTIL_THROW(
"Attempt to allocate with capacity <= 0");
268 UTIL_THROW(
"Attempt to re-allocate a DArray");
277 template <
typename Data>
290 template <
typename Data>
307 template <
typename Data>
308 template <
class Archive>
312 if (Archive::is_saving()) {
316 if (Archive::is_loading()) {
Data * data_
Pointer to an array of Data elements.
int capacity() const
Return allocated size.
bool isAllocated() const
Does this array have associated data?
int capacity_
Allocated size of the data_ array.
DArray(DArray< Data > const &other)
Copy constructor.
void allocate(int capacity)
Allocate the underlying C array.
void deallocate()
Deallocate the underlying C array.
void serialize(Archive &ar, const unsigned int version)
Serialize a DArray to/from an Archive.
DArray()
Default constructor.
virtual ~DArray()
Destructor.
void reallocate(int capacity)
Reallocate the underlying C array and copy to new location.
DArray(int capacity)
Allocating constructor.
DArray< Data > & operator=(DArray< Data > const &other)
Assignment from a DArray<Data> container.
static void deallocate(Data *&ptr, size_t size)
Deallocate a C++ array.
static void reallocate(Data *&ptr, size_t oldSize, size_t newSize)
Reallocate a C++ array.
static void allocate(Data *&ptr, size_t size)
Allocate a C++ array.
File containing preprocessor macros for error handling.
#define UTIL_CHECK(condition)
Assertion macro suitable for serial or parallel production code.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
Utility classes for scientific computation.