11 #include <util/containers/Array.h> 12 #include <util/misc/Memory.h> 30 template <
typename Data>
96 template <
class Archive>
97 void serialize(Archive& ar,
const unsigned int version);
110 template <
class Data>
122 template <
class Data>
127 UTIL_THROW(
"Other DArray must be allocated.");
139 template <
class Data>
158 template <
class Data>
162 if (
this == &other)
return *
this;
166 UTIL_THROW(
"Other DArray must be allocated.");
172 UTIL_THROW(
"Cannot assign DArrays of unequal capacity");
190 template <
class Data>
194 UTIL_THROW(
"Attempt to re-allocate a DArray");
197 UTIL_THROW(
"Attempt to allocate with capacity <= 0");
208 template <
class Data>
221 template <
class Data>
223 {
return (
bool)
data_; }
228 template <
class Data>
229 template <
class Archive>
233 if (Archive::is_saving()) {
237 if (Archive::is_loading()) {
Data * data_
Pointer to an array of Data elements.
void serialize(Archive &ar, const unsigned int version)
Serialize a DArray to/from an Archive.
int capacity_
Allocated size of the data_ array.
Array container class template.
File containing preprocessor macros for error handling.
static void allocate(Data *&ptr, size_t size)
Allocate a C array.
#define UTIL_THROW(msg)
Macro for throwing an Exception, reporting function, file and line number.
DArray< Data > & operator=(const DArray< Data > &other)
Assignment operator.
Utility classes for scientific computation.
DArray()
Default constructor.
bool isAllocated() const
Return true if the DArray has been allocated, false otherwise.
Dynamically allocatable contiguous array template.
virtual ~DArray()
Destructor.
void deallocate()
Dellocate the underlying C array.
int capacity() const
Return allocated size.
void allocate(int capacity)
Allocate the underlying C array.