Unverified Commit 899ec83a authored by acpaquette's avatar acpaquette Committed by GitHub
Browse files

Pipeline Object FileList Fix (#4372)



* Update SetInputListFile to use the FileList object rather than the TextFile object.
Also updated SetInputListFile isisparameter function to chain into the 
SetInputListFile FileName function.

* Modified filelist to handle list files with no trailing new line character

* Added a test to check that filelist retains expected new functionality

* Fixed issues with pipeline and hardcoded values in hijitter

* Removed specific mention of trailing new line necessity in cubeit.xml

* Updated changelog

Co-authored-by: default avatarJesse Mapel <jmapel@usgs.gov>
parent 2df71934
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -46,10 +46,13 @@ release.

- Fixed relative paths not being properly converted to absolute paths in isisVarInit.py [4274](https://github.com/USGS-Astrogeology/ISIS3/issues/4274)
- Fixed issue where serial numbers for Kaguya TC and MI image could not be generated. [4235](https://github.com/USGS-Astrogeology/ISIS3/issues/4235)
- Fixed hardcoded file naming in the hijitter app dealing with output from pipeline. [#4372](https://github.com/USGS-Astrogeology/ISIS3/pull/4372)
- Fixed "About Qview" to point to website documentation. [4333](https://github.com/USGS-Astrogeology/ISIS3/issues/4333)

### Changed

- Updated the FileList object to handle files that do not contain a trailing new line character. [#4372](https://github.com/USGS-Astrogeology/ISIS3/pull/4372)

- Refactored Blob class to be used by classes that serialize to a Cube instead of inherited from. Impacted classes are GisBlob, History, ImagePolygon, OriginalLabel, OriginalXmlLabel, StrethBlob, StringBlob, and Table. [#4082](https://github.com/USGS-Astrogeology/ISIS3/issues/4082)

- Fixed hi2isis MRO:ADC_TIMING_SETTINGS label conversion issue [4290](https://github.com/USGS-Astrogeology/ISIS3/issues/4290)
+1 −2
Original line number Diff line number Diff line
@@ -94,8 +94,7 @@
        </brief>
        <description>
          Each file in this list, one per line, will be added to
          the output cube in the order they appear. The last file
	  in the list must followed by a blank line.
          the output cube in the order they appear.
        </description>
        <filter>
          *.lis
+5 −6
Original line number Diff line number Diff line
@@ -89,9 +89,10 @@ namespace Isis {
    Isis::IString s;
    bool bHasQuotes = false;

    in.getline(buf, 65536);
    bool isComment = false;
    while (!in.eof()) {
    do {
      in.getline(buf, 65536);

      s = buf;
      string::size_type loc = s.find("\"", 0);

@@ -108,7 +109,6 @@ namespace Isis {

      isComment = false;
      if(strlen(buf) == 0) {
        in.getline(buf, 65536);
        continue;
      }
      for (int index = 0; index < (int)strlen(buf); index++) {
@@ -125,7 +125,6 @@ namespace Isis {
        }
      }
      if (isComment) {
        in.getline(buf, 65536);
        continue;
      }
      else {
@@ -138,9 +137,9 @@ namespace Isis {
        }

        this->push_back(s.ToQt());
        in.getline(buf, 65536);
      }
      }

    } while(!in.eof());
    if (this->size() == 0) {
      string msg = "Input Stream Empty";
      throw IException(IException::User, msg, _FILEINFO_);
+16 −26
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@ find files of those names at the top level of this repository. **/
#include "Application.h"
#include "Preference.h"
#include "Progress.h"
#include "TextFile.h"
#include "FileList.h"
#include "FileName.h"

using namespace Isis;
@@ -236,13 +236,13 @@ namespace Isis {

            QStringList listData = cmd.split(" ");
            QString listFileName = listData.takeFirst();
            TextFile listFile(listFileName, "overwrite");
            FileList listFile;

            while (!listData.isEmpty()) {
              listFile.PutLine(listData.takeFirst());
              listFile.push_back(listData.takeFirst());
            }

            listFile.Close();
            listFile.write(listFileName);
          }
          else {
            // Nothing special is happening, just execute the program
@@ -353,21 +353,9 @@ namespace Isis {
   */
  void Pipeline::SetInputListFile(const QString &inputParam) {
    UserInterface &ui = Application::GetUserInterface();
    FileName inputFileName = FileName(ui.GetFileName(inputParam));

    TextFile filelist(FileName(ui.GetFileName(inputParam)).expanded());
    QString filename;
    int branch = 1;

    while (filelist.GetLineNoFilter(filename)) {
      p_originalInput.push_back(filename);
      p_inputBranches.push_back(inputParam + toString(branch));
      p_virtualBands.push_back("");
      p_finalOutput.push_back(FileName(filename).name());

      branch ++;
    }

    p_outputListNeedsModifiers = true;
    SetInputListFile(inputFileName);
  }


@@ -380,15 +368,16 @@ namespace Isis {
   *                                       to p_inputBranches
   */
  void Pipeline::SetInputListFile(const FileName &inputFileName) {
    TextFile filelist(inputFileName.expanded());
    QString filename;
    FileList filelist(inputFileName.expanded());
    FileName filename;
    int branch = 1;

    while (filelist.GetLineNoFilter(filename)) {
      p_originalInput.push_back(filename);
      p_inputBranches.push_back(FileName(inputFileName).expanded() + " " + QString(branch));
      p_finalOutput.push_back(FileName(filename).name());
    while (!filelist.isEmpty()) {
      filename = filelist.takeFirst();
      p_originalInput.push_back(filename.expanded());
      p_inputBranches.push_back(inputFileName.name() + toString(branch));
      p_virtualBands.push_back("");
      p_finalOutput.push_back(filename.name());

      branch ++;
    }
@@ -536,10 +525,11 @@ namespace Isis {
  void Pipeline::SetOutputListFile(const FileName &outputFileNameList) {
    p_finalOutput.clear();

    TextFile filelist(outputFileNameList.expanded());
    FileList filelist(outputFileNameList.expanded());
    QString filename;

    while (filelist.GetLineNoFilter(filename)) {
    while (!filelist.isEmpty()) {
      filename = filelist.takeFirst().expanded();
      p_finalOutput.push_back(filename);
    }

+5 −0
Original line number Diff line number Diff line
@@ -142,6 +142,11 @@ namespace Isis {
   *                           control statements. References # 795.
   *   @history 2016-08-28 Kelvin Rodriguez - Removed useless if statement comparing
   *                           a reference variable to Null. Part of porting to OS X 10.11.
   *   @history 2021-17-03 Adam Paquette - Update SetInputListFile to use the
   *                           FileList object rather than the TextFile object.
   *                           Also updated SetInputListFile isisparameter
   *                           function to chain into the SetInputListFile FileName
   *                           function.
   */
  class Pipeline {
    public:
Loading