|
#ifndef ARRAY1_H |
|
#define ARRAY1_H |
|
|
|
#include <stdexcept> |
|
#include <string> |
|
|
|
class Array1 |
|
{ |
|
public: |
|
|
|
|
|
Array1(int length = 0, long* data = 0); |
|
|
|
|
|
Array1(const Array1 & source); |
|
|
|
|
|
~Array1(); |
|
|
|
|
|
Array1 & operator=(const Array1 & source); |
|
|
|
|
|
bool operator==(const Array1 & other) const; |
|
|
|
|
|
int length() const; |
|
|
|
|
|
void resize(int length, long* data = 0); |
|
|
|
|
|
long & operator[](int i); |
|
|
|
|
|
const long & operator[](int i) const; |
|
|
|
|
|
std::string asString() const; |
|
|
|
|
|
void view(long** data, int* length) const; |
|
|
|
private: |
|
|
|
bool _ownData; |
|
int _length; |
|
long * _buffer; |
|
|
|
|
|
void allocateMemory(); |
|
void deallocateMemory(); |
|
}; |
|
|
|
#endif |
|
|