|
#ifndef FARRAY_H |
|
#define FARRAY_H |
|
|
|
#include <stdexcept> |
|
#include <string> |
|
|
|
class Farray |
|
{ |
|
public: |
|
|
|
|
|
Farray(int nrows, int ncols); |
|
|
|
|
|
Farray(const Farray & source); |
|
|
|
|
|
~Farray(); |
|
|
|
|
|
Farray & operator=(const Farray & source); |
|
|
|
|
|
bool operator==(const Farray & other) const; |
|
|
|
|
|
int nrows() const; |
|
int ncols() const; |
|
|
|
|
|
long & operator()(int i, int j); |
|
|
|
|
|
const long & operator()(int i, int j) const; |
|
|
|
|
|
std::string asString() const; |
|
|
|
|
|
void view(int* nrows, int* ncols, long** data) const; |
|
|
|
private: |
|
|
|
int _nrows; |
|
int _ncols; |
|
long * _buffer; |
|
|
|
|
|
Farray(); |
|
|
|
|
|
void allocateMemory(); |
|
int offset(int i, int j) const; |
|
}; |
|
|
|
#endif |
|
|