20 ObservationNumberList::ObservationNumberList(
const QString &listfile,
bool checkTarget) :
47 if (snlist->
size() == 0) {
48 QString msg =
"Serial number list is empty";
52 map<QString, int> observationMap;
58 for (
int isn = 0; isn < snlist->
size(); isn++) {
63 observationIndex = currentIndex++;
91 if (snlist->
size() == 0) {
92 QString msg =
"Cannot remove, serial number list is empty";
99 map<QString, int> observationMap;
101 int currentIndex = 0;
102 int observationIndex;
105 for (
int isn = 0; isn < this->
size(); isn++) {
114 observationIndex = currentIndex++;
149 QString observationNumber) {
152 nextset.serialNumberIndex = isn;
153 nextset.observationNumberIndex = observationIndex;
156 m_sets.push_back(nextset);
157 m_indexMap.insert(pair<int, int>(isn, observationIndex));
180 for (
unsigned index = 0; index <
m_pairs.size(); index++) {
222 QString msg =
"Requested filename [" +
FileName(filename).
expanded() +
"] ";
223 msg +=
"does not exist in the list";
227 return m_pairs[index].observationNumber;
241 if (index >= 0 && index < (
int)
m_pairs.size()) {
242 return m_pairs[index].observationNumber;
245 QString msg =
"Index [" +
toString(index) +
"] is invalid";
262 vector<QString> filenames;
263 for (
unsigned index = 0; index <
m_pairs.size(); index++) {
265 filenames.push_back(
m_pairs[index].filename);
268 if (filenames.size() > 0) {
272 QString msg =
"Requested observation number [" + on +
"] ";
273 msg +=
"does not exist in the list";
void init(SerialNumberList *snlist)
Initiates the ObservationNumberList.
int observationSize() const
How many unique observations are in the list?
int serialNumberIndex(const QString &sn)
Return a list index given a serial number.
QString observationNumber(const QString &filename)
Return an observation number given a filename.
bool hasSerialNumber(QString sn)
Determines whether or not the requested serial number exists in the list.
File name manipulation and expansion.
An observation consiting of a serial number index to the ObservationNumberList, an observation number...
Namespace for the standard library.
std::map< QString, int > m_fileMap
Maps filenames to their positions in the list.
int fileNameIndex(const QString &filename)
Return a list index given a filename.
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
~ObservationNumberList()
Destructor.
This error is for when a programmer made an API call that was illegal.
std::multimap< int, int > m_indexMap
Maps serial number index to observation number index.
std::vector< Pair > m_pairs
List of serial number Pair entities.
int m_numberObservations
Count of observations in the observation number list.
#define _FILEINFO_
Macro for the filename and line number.
A type of error that could only have occurred due to a mistake on the user's part (e...
ObservationNumberList(const QString &list, bool checkTarget=true)
Creates an ObservationNumberList from a filename.
QString expanded() const
Returns a QString of the full file name including the file path, excluding the attributes.
int observationNumberMapIndex(const int serialNumberIndex)
Return a observation index given a serial number index.
int size() const
How many serial number / filename combos are in the list.
QString observationNumber(int index)
Return a observation number given an index.
std::vector< ObservationSet > m_sets
List of observation sets.
Namespace for ISIS/Bullet specific routines.
std::vector< QString > possibleFileNames(const QString &on)
Return possible filenames given an observation number.
Serial Number list generator.
bool hasObservationNumber(const QString &on)
Determines whether or not the requested observation number exists in the list.
void add(int isn, const int observationIndex, QString observationNumber)
Adds a new serial number index / observation number index / observation number to the SerialNumberLis...
void remove(SerialNumberList *snlist)
Removes all of the listed serial numbers from the observation.