Isis 3 Programmer Reference
BandManager.cpp
1
6/* SPDX-License-Identifier: CC0-1.0 */
7#include "BandManager.h"
8#include "IException.h"
9
10using namespace std;
11namespace Isis {
12
24 BandManager::BandManager(const Isis::Cube &cube, const bool reverse) :
25 Isis::BufferManager(cube.sampleCount(), cube.lineCount(),
26 cube.bandCount(), 1, 1, cube.bandCount(),
27 cube.pixelType(), reverse) {
28 }
29
40 bool BandManager::SetBand(const int sample, const int line) {
41 if(sample < 1) {
42 string message = "Invalid value for argument [sample]";
43 throw IException(IException::Programmer, message, _FILEINFO_);
44 }
45
46 if(line < 1) {
47 string message = "Invalid value for argument [line]";
48 throw IException(IException::Programmer, message, _FILEINFO_);
49 }
50
51 int map = (line - 1) * MaxBands() + sample - 1;
52 return setpos(map);
53 }
54
55} // end namespace isis
bool SetBand(const int sample, const int line=1)
Positions the buffer at the requested line and returns a status indicator if the set was succesful or...
BandManager(const Isis::Cube &cube, const bool reverse=false)
Constructs a BandManager object.
Manages a Buffer over a cube.
bool setpos(BigInt map)
Sets the position of the shape in the cube.
int MaxBands() const
Returns the number of bands in the cube.
IO Handler for Isis Cubes.
Definition Cube.h:168
Isis exception class.
Definition IException.h:91
@ Programmer
This error is for when a programmer made an API call that was illegal.
Definition IException.h:146
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16
Namespace for the standard library.