Isis 3 Programmer Reference
SampleManager.cpp
1
7
/* SPDX-License-Identifier: CC0-1.0 */
8
#include "SampleManager.h"
9
10
#include "IException.h"
11
#include "IString.h"
12
13
using namespace
std
;
14
namespace
Isis
{
15
28
SampleManager::SampleManager(
const
Isis::Cube
&cube,
const
bool
reverse) :
29
Isis
::
BufferManager
(cube.sampleCount(), cube.lineCount(),
30
cube.bandCount(), 1, cube.lineCount(), 1,
31
cube.pixelType(), reverse) {
32
}
33
44
bool
SampleManager::SetSample
(
const
int
sample,
const
int
band) {
45
if
(sample < 1) {
46
string
message =
"Invalid value for argument [sample]"
;
47
throw
IException
(
IException::Programmer
, message, _FILEINFO_);
48
}
49
50
if
(band < 1) {
51
string
message =
"Invalid value for argument [band]"
;
52
throw
IException
(
IException::Programmer
, message, _FILEINFO_);
53
}
54
55
int
map = (band - 1) *
MaxSamples
() + sample - 1;
56
return
setpos
(map);
57
}
58
59
}
// end namespace isis
Isis::BufferManager::setpos
bool setpos(BigInt map)
Sets the position of the shape in the cube.
Definition:
BufferManager.cpp:219
Isis::BufferManager
Manages a Buffer over a cube.
Definition:
BufferManager.h:52
Isis::SampleManager::SetSample
bool SetSample(const int sample, const int band=1)
Positions the buffer at the requested line and returns a status indicator if the set was succesful or...
Definition:
SampleManager.cpp:44
Isis::Cube
IO Handler for Isis Cubes.
Definition:
Cube.h:167
Isis::IException
Isis exception class.
Definition:
IException.h:91
Isis::BufferManager::MaxSamples
int MaxSamples() const
Returns the number of samples in the cube.
Definition:
BufferManager.h:134
Isis::IException::Programmer
@ Programmer
This error is for when a programmer made an API call that was illegal.
Definition:
IException.h:146
std
Namespace for the standard library.
Isis
This is free and unencumbered software released into the public domain.
Definition:
Apollo.h:16
src
base
objs
SampleManager
SampleManager.cpp