11#include <util/containers/Array.h>
12#include <util/misc/Memory.h>
30 template <
typename Data>
135 template <
class Archive>
136 void serialize(Archive& ar,
const unsigned int version);
150 template <
typename Data>
inline
152 {
return (
bool)
data_; }
159 template <
typename Data>
167 template <
typename Data>
179 template <
typename Data>
184 UTIL_THROW(
"Other DArray must be allocated.");
196 template <
typename Data>
210 template <
typename Data>
214 if (
this == &other)
return *
this;
218 UTIL_THROW(
"Other DArray must be allocated.");
228 UTIL_THROW(
"Cannot assign DArrays of unequal capacity");
242 template <
typename Data>
246 if (
dynamic_cast< Array<Data>*
>(
this) == &other)
return *
this;
268 template <
typename Data>
272 UTIL_THROW(
"Attempt to allocate with capacity <= 0");
275 UTIL_THROW(
"Attempt to re-allocate a DArray");
284 template <
typename Data>
297 template <
typename Data>
314 template <
typename Data>
315 template <
class Archive>
319 if (Archive::is_saving()) {
323 if (Archive::is_loading()) {
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.
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(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.