41 Buffer::Buffer() : p_sample(0), p_nsamps(0), p_line(0), p_nlines(0),
42 p_band(0), p_nbands(0), p_npixels(0), p_buf(0),
43 p_pixelType(None), p_rawbuf(0) { }
59 p_nsamps(nsamps), p_nlines(nlines),
60 p_nbands(nbands), p_pixelType(type) {
65 string message =
"Invalid value for sample dimensions (nsamps)";
69 string message =
"Invalid value for line dimensions (nlines)";
73 string message =
"Invalid value for band dimensions (nbands)";
123 const int start_line,
124 const int start_band) {
196 i_line =
Line(index);
197 i_band =
Band(index);
232 (i_line -
p_line) * (p_nsamps) +
271 string message =
"Input and output buffers are not the same size";
276 string message =
"Input and output buffers are not the same pixel type";
280 size_t n =
sizeof(double);
314 isSubareaOfIn &= (endSample <= otherEndSample);
315 isSubareaOfIn &= (endLine <= otherEndLine);
316 isSubareaOfIn &= (endBand <= otherEndBand);
319 for (
int i = 0; i <
size(); i++) {
324 return isSubareaOfIn;
335 p_nsamps(rhs.p_nsamps), p_nlines(rhs.p_nlines),
336 p_nbands(rhs.p_nbands), p_pixelType(rhs.p_pixelType) {
void Allocate()
Size or resize the memory buffer.
Buffer for reading and writing cube data.
int Line(const int index=0) const
Returns the line position associated with a shape buffer index.
void SetBaseBand(const int start_band)
This method is used to set the base band position of the shape buffer.
const Isis::PixelType p_pixelType
The pixel type of the raw buffer.
void * p_rawbuf
The raw dm read from the disk.
int SizeOf(Isis::PixelType pixelType)
Returns the number of bytes of the specified PixelType.
void SetBasePosition(const int start_sample, const int start_line, const int start_band)
This method is used to set the base position of the shape buffer.
void Copy(const Buffer &in, bool includeRawBuf=true)
Allows copying of the buffer contents to another Buffer.
int p_line
Starting line to read/write.
int Sample(const int index=0) const
Returns the sample position associated with a shape buffer index.
This error is for when a programmer made an API call that was illegal.
QString MemoryAllocationFailed()
This error should be used when an error accrues during a memory allocation such as "new"...
PixelType
Enumerations for Isis Pixel Types.
~Buffer()
Destroys the Buffer object and frees shape buffer.
int p_sample
Starting sample to read/write.
int p_npixels
Number of pixels (nsamps * nlines * nbands)
int Band(const int index=0) const
Returns the band position associated with a shape buffer index.
double * p_buf
Shape buffer allocated to the size of npixels for handling reads/writes.
#define _FILEINFO_
Macro for the filename and line number.
A type of error that cannot be classified as any of the other error types.
Isis::PixelType PixelType() const
Returns the raw buffer pixel type.
int p_nbands
Number of bands to read/write.
void SetBaseSample(const int start_samp)
This method is used to set the base sample position of the shape buffer.
int p_band
Starting band to read/write.
int p_nlines
Number of lines to read/write.
void SetBaseLine(const int start_line)
This method is used to set the base line position of the shape buffer.
QString ArraySubscriptNotInRange(int index)
This error should be used when an Isis object or application is checking array bounds and the legal r...
int Index(const int i_samp, const int i_line, const int i_band) const
Given a sample, line, and band position, this returns the appropriate index in the shape buffer...
int size() const
Returns the total number of pixels in the shape buffer.
Buffer()
Default constructor for proper initialization purposes.
void Position(const int index, int &i_samp, int &i_line, int &i_band) const
Returns the sample, line, and band position associated with a shape buffer index. ...
int p_nsamps
Number of samples to read/write.
bool CopyOverlapFrom(const Buffer &in)
Allows copying of the buffer contents of a larger buffer to another same size or smaller Buffer...
Buffer & operator=(const double &d)
Assign the entire buffer to a constant double value.
double at(const int index) const
Returns the value in the shape buffer at the given index.