11#include <util/containers/Array.h>
12#include <util/misc/Memory.h>
30 template <
typename Data>
109 template <
class Archive>
110 void serialize(Archive& ar,
const unsigned int version);
123 template <
class Data>
135 template <
class Data>
140 UTIL_THROW(
"Other DArray must be allocated.");
152 template <
class Data>
166 template <
class Data>
170 if (
this == &other)
return *
this;
174 UTIL_THROW(
"Other DArray must be allocated.");
180 UTIL_THROW(
"Cannot assign DArrays of unequal capacity");
198 template <
class Data>
202 UTIL_THROW(
"Attempt to re-allocate a DArray");
205 UTIL_THROW(
"Attempt to allocate with capacity <= 0");
216 template <
class Data>
229 template <
class Data>
246 template <
class Data>
248 {
return (
bool)
data_; }
253 template <
class Data>
254 template <
class Archive>
258 if (Archive::is_saving()) {
262 if (Archive::is_loading()) {
Array()
Default constructor.
DArray(DArray< Data > const &other)
Copy constructor.
void allocate(int capacity)
Allocate the underlying C array.
void deallocate()
Dellocate the underlying C array.
void serialize(Archive &ar, const unsigned int version)
Serialize a DArray to/from an Archive.
DArray()
Default constructor.
bool isAllocated() const
Return true if this DArray has been allocated, false otherwise.
virtual ~DArray()
Destructor.
void reallocate(int capacity)
Reallocate the underlying C array and copy to new location.
DArray< Data > & operator=(DArray< Data > const &other)
Assignment operator.
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.