File failed to load: https://isis.astrogeology.usgs.gov/9.0.0/Object/assets/jax/output/NativeMML/config.js
Isis 3 Programmer Reference
SampleManager.cpp
1
6
7/* SPDX-License-Identifier: CC0-1.0 */
8#include "SampleManager.h"
9
10#include "IException.h"
11#include "IString.h"
12
13using namespace std;
14namespace Isis {
15
27
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
43
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
int MaxSamples() const
Returns the number of samples in the cube.
bool setpos(BigInt map)
Sets the position of the shape 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
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...
SampleManager(const Isis::Cube &cube, const bool reverse=false)
Constructs a SampleManager object.
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16
Namespace for the standard library.