Unverified Commit 0bc4f2e1 authored by AustinSanders's avatar AustinSanders Committed by GitHub
Browse files

Initial application + testing refactor for cnetpvl2bin (#3695)

* Initial cnetpvl2bin refactor and gtest

* Renamed cnetbin2pvlTests.cpp to FunctionalTestsCnetbin2pvl.cpp

* Added docstring.

* Replaced temporary directory logic with temp dir from fixtures.

* Added docstring
parent 802f50a6
Loading
Loading
Loading
Loading
+43 −0
Original line number Diff line number Diff line
#include "cnetpvl2bin.h"

using namespace std;
using namespace Isis;

namespace Isis{
  /**
    * Default method for cnetpvl2bin that takes a UI object from the
    * application, parses the necessary UI elements, and writes the control
    * network to a binary file.
    *
    * @param ui UserInterface file generated using the cnetpvl2bin file.
    *
    * @param progress A Progress object through which the UI can access progress
    *                 reports.
    */
  void cnetpvl2bin(UserInterface &ui, Progress *progress) {
    ControlNet cnet;
    cnet.ReadControl(ui.GetFileName("FROM"), progress);
    cnetpvl2bin(cnet, ui, progress);
  }


  /**
    * Give a control network and criteria passed in through the UI, write the
    * control network to a binary file.
    *
    * @param cnet A control network object.
    *
    * @param ui UserInterface file generated using the cnetpvl2bin file.
    *
    * @param progress A Progress object through which the UI can access progress
    *                 reports.
    */
  void cnetpvl2bin(ControlNet &cnet, UserInterface &ui, Progress *progress) {

    progress->SetText("Writing Control Network...");
    progress->SetMaximumSteps(1);
    progress->CheckStatus();
    cnet.Write(ui.GetFileName("TO"));
    progress->CheckStatus();
  }
}
+13 −0
Original line number Diff line number Diff line
#ifndef cnetpvl2bin_h
#define cnetpvl2bin_h

#include "UserInterface.h"
#include "ControlNet.h"
#include "Progress.h"

namespace Isis {
  extern void cnetpvl2bin(UserInterface &ui, Progress *progress=0);
  extern void cnetpvl2bin(ControlNet &net, UserInterface &ui, Progress *progress=0);
}

#endif
+4 −7
Original line number Diff line number Diff line
#include "Isis.h"

#include "ControlNet.h"
#include "cnetpvl2bin.h"
#include "Application.h"
#include "Progress.h"

using namespace Isis;
@@ -8,9 +8,6 @@ using namespace Isis;
void IsisMain() {
  // Get user entered file name & mode
  UserInterface &ui = Application::GetUserInterface();
  Progress p;

  ControlNet cnet;
  cnet.ReadControl(ui.GetFileName("FROM"), &p);
  cnet.Write(ui.GetFileName("TO"));
  Progress progress;
  cnetpvl2bin(ui, &progress);
}
+0 −4
Original line number Diff line number Diff line
BLANKS = "%-6s"    
LENGTH = "%-40s"

include $(ISISROOT)/make/isismake.tststree
+0 −7
Original line number Diff line number Diff line
APPNAME = cnetpvl2bin

include $(ISISROOT)/make/isismake.tsts

commands:
	$(APPNAME) from=$(INPUT)/simplenet.pvl to=$(OUTPUT)/simplenet.net \
	   > /dev/null;
Loading