Commit f91eaddc authored by Ian Humphrey's avatar Ian Humphrey
Browse files

refactor Image::serialNumber() to be optimized for subsequent calls

parent efdbc330
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -329,7 +329,10 @@ namespace Isis {
   * @return @b QString  A string representation of the serial number of the cube.
   */
  QString Image::serialNumber() {
    return SerialNumber::Compose(*(cube()));
    if (m_serialNumber.isEmpty()) {
      m_serialNumber = SerialNumber::Compose(*(cube()));
    } 
    return m_serialNumber;
  }


+10 −0
Original line number Diff line number Diff line
@@ -94,6 +94,11 @@ namespace Isis {
   *   @history 2018-06-30 Ian Humphrey - Added observationNumber() method so anything that grabs
   *                           an Image ProjectItem can easily get both the serial number and
   *                           observation number now. References #497.
   *   @history 2018-07-02 Ian Humphrey - Changed serialNumber() implementation to follow how
   *                           observationNumber() is implemented. This ensures that any calls
   *                           after the first call to these methods are O(1) and are not
   *                           bottlenecekd by any file I/O that occurs in the Compose()
   *                           methods. References #497.
   */

  class Image : public QObject {
@@ -215,6 +220,11 @@ namespace Isis {
       */
      QString m_observationNumber; 

      /**
       * The serial number for this image.
       */
      QString m_serialNumber;

      /**
       * Spacecraft name associated with this Image.
       */