Isis Developer Reference
SerialNumberList.h
Go to the documentation of this file.
1 #ifndef SerialNumberList_h
2 #define SerialNumberList_h
3 
8 /* SPDX-License-Identifier: CC0-1.0 */
9 
10 #include <map>
11 #include <vector>
12 
13 #include <QString>
14 
15 namespace Isis {
16 
17  class Progress;
18 
65  public:
66  SerialNumberList(bool checkTarget = true);
67  SerialNumberList(const QString &list, bool checkTarget = true, Progress *progress = NULL);
68  virtual ~SerialNumberList();
69 
70  void add(const QString &filename, bool def2filename = false);
71  void add(const QString &serialNumber, const QString &filename);
72  void add(const char *serialNumber, const char *filename);
73  bool hasSerialNumber(QString sn);
74 
75  void remove(const QString &sn);
76 
77  int size() const;
78  QString fileName(const QString &sn);
79  QString fileName(int index);
80  QString serialNumber(const QString &filename);
81  QString serialNumber(int index);
82  QString observationNumber(int index);
83  QString spacecraftInstrumentId(int index);
84  QString spacecraftInstrumentId(const QString &sn);
85 
86  int serialNumberIndex(const QString &sn);
87  int fileNameIndex(const QString &filename);
88 
89  std::vector<QString> possibleSerialNumbers(const QString &on);
90 
91  protected:
96  struct Pair {
97  QString filename;
98  QString serialNumber;
100  QString spacecraftName;
101  QString instrumentId;
102  };
103 
104  std::vector<Pair> m_pairs;
105  std::map<QString, int> m_serialMap;
106  std::map<QString, int> m_fileMap;
107 
113  QString m_target;
114 
115  };
116 };
117 
118 #endif
FileName.h
Isis::SerialNumberList::observationNumber
QString observationNumber(int index)
Return a observation number given an index.
Definition: SerialNumberList.cpp:468
Isis::PvlObject::findGroup
PvlGroupIterator findGroup(const QString &name, PvlGroupIterator beg, PvlGroupIterator end)
Find a group with the specified name, within these indexes.
Definition: PvlObject.h:129
Isis::SerialNumberList::m_target
QString m_target
Target name that the files must have if m_checkTarget is true
Definition: SerialNumberList.h:113
Isis::PvlObject
Contains Pvl Groups and Pvl Objects.
Definition: PvlObject.h:61
Isis::Progress::CheckStatus
void CheckStatus()
Checks and updates the status.
Definition: Progress.cpp:105
Isis::SerialNumberList::Pair::instrumentId
QString instrumentId
Definition: SerialNumberList.h:101
Isis::SerialNumberList::Pair::spacecraftName
QString spacecraftName
Definition: SerialNumberList.h:100
Isis::SerialNumberList::size
int size() const
How many serial number / filename combos are in the list.
Definition: SerialNumberList.cpp:384
Isis::SerialNumberList::serialNumberIndex
int serialNumberIndex(const QString &sn)
Return a list index given a serial number.
Definition: SerialNumberList.cpp:490
Isis::FileName
File name manipulation and expansion.
Definition: FileName.h:100
Isis::Progress::SetMaximumSteps
void SetMaximumSteps(const int steps)
This sets the maximum number of steps in the process.
Definition: Progress.cpp:85
Isis::SerialNumberList::possibleSerialNumbers
std::vector< QString > possibleSerialNumbers(const QString &on)
Return possible serial numbers given an observation number.
Definition: SerialNumberList.cpp:613
Isis::SerialNumber::Compose
static QString Compose(Pvl &label, bool def2filename=false)
Compose a SerialNumber from a PVL.
Definition: SerialNumber.cpp:38
Isis::PvlObject::hasGroup
bool hasGroup(const QString &name) const
Returns a boolean value based on whether the object has the specified group or not.
Definition: PvlObject.h:210
Isis::PvlContainer::hasKeyword
bool hasKeyword(const QString &name) const
Check to see if a keyword exists.
Definition: PvlContainer.cpp:159
Isis::Pvl
Container for cube-like labels.
Definition: Pvl.h:119
Isis::SerialNumberList::Pair::observationNumber
QString observationNumber
Definition: SerialNumberList.h:99
Isis::toString
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
Definition: IString.cpp:211
Isis::SerialNumberList
Serial Number list generator.
Definition: SerialNumberList.h:64
Isis::SerialNumberList::serialNumber
QString serialNumber(const QString &filename)
Return a serial number given a filename.
Definition: SerialNumberList.cpp:426
Isis::SerialNumberList::remove
void remove(const QString &sn)
Remove the specified serial number from the list.
Definition: SerialNumberList.cpp:88
Isis::SerialNumberList::m_fileMap
std::map< QString, int > m_fileMap
Maps filenames to their positions in the list.
Definition: SerialNumberList.h:106
ObservationNumber.h
FileList.h
Isis::FileName::expanded
QString expanded() const
Returns a QString of the full file name including the file path, excluding the attributes.
Definition: FileName.cpp:196
Isis::PvlGroup
Contains multiple PvlContainers.
Definition: PvlGroup.h:41
Pvl.h
_FILEINFO_
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:24
Isis::SerialNumberList::fileNameIndex
int fileNameIndex(const QString &filename)
Return a list index given a filename.
Definition: SerialNumberList.cpp:517
Isis::Progress::SetText
void SetText(const QString &text)
Changes the value of the text string reported just before 0% processed.
Definition: Progress.cpp:61
SerialNumberList.h
Isis::SerialNumberList::add
void add(const QString &filename, bool def2filename=false)
Adds a new filename / serial number pair to the SerialNumberList.
Definition: SerialNumberList.cpp:121
Isis::PvlObject::findObject
PvlObjectIterator findObject(const QString &name, PvlObjectIterator beg, PvlObjectIterator end)
Find the index of object with a specified name, between two indexes.
Definition: PvlObject.h:274
Isis::ObservationNumber::Compose
static QString Compose(Pvl &label, bool def2filename=false)
Compose a ObservationNumber from a PVL.
Definition: ObservationNumber.cpp:31
Isis::IException
Isis exception class.
Definition: IException.h:91
Isis::Progress
Program progress reporter.
Definition: Progress.h:42
Isis::SerialNumberList::m_pairs
std::vector< Pair > m_pairs
List of serial number Pair entities.
Definition: SerialNumberList.h:104
Isis::SerialNumberList::m_serialMap
std::map< QString, int > m_serialMap
Maps serial numbers to their positions in the list.
Definition: SerialNumberList.h:105
IException.h
Isis::IException::Programmer
@ Programmer
This error is for when a programmer made an API call that was illegal.
Definition: IException.h:146
Isis::SerialNumberList::m_checkTarget
bool m_checkTarget
Specifies whether or not to check to make sure the target names match between files added to the seri...
Definition: SerialNumberList.h:112
Isis::SerialNumberList::Pair::filename
QString filename
Definition: SerialNumberList.h:97
Isis::SerialNumberList::fileName
QString fileName(const QString &sn)
Return a filename given a serial number.
Definition: SerialNumberList.cpp:399
Isis::SerialNumberList::Pair
A serial number list entity that contains the filename serial number pair.
Definition: SerialNumberList.h:96
Isis::SerialNumberList::~SerialNumberList
virtual ~SerialNumberList()
Destructor.
Definition: SerialNumberList.cpp:77
Isis::FileList
Internalizes a list of files.
Definition: FileList.h:54
SerialNumber.h
Isis::SerialNumberList::hasSerialNumber
bool hasSerialNumber(QString sn)
Determines whether or not the requested serial number exists in the list.
Definition: SerialNumberList.cpp:373
Progress.h
Isis::SerialNumberList::spacecraftInstrumentId
QString spacecraftInstrumentId(int index)
Return the spacecraftname/instrumentid at the given index.
Definition: SerialNumberList.cpp:559
Isis
This is free and unencumbered software released into the public domain.
Definition: Apollo.h:16
Isis::IException::User
@ User
A type of error that could only have occurred due to a mistake on the user's part (e....
Definition: IException.h:126
Isis::SerialNumberList::Pair::serialNumber
QString serialNumber
Definition: SerialNumberList.h:98
Isis::SerialNumberList::SerialNumberList
SerialNumberList(bool checkTarget=true)
Creates an empty SerialNumberList.
Definition: SerialNumberList.cpp:26