Skip to content
Snippets Groups Projects
Unverified Commit 1ecd688a authored by Kelvin Rodriguez's avatar Kelvin Rodriguez Committed by GitHub
Browse files

Explicitly as to make globals static (#124)


* Explicitly as to make globals staticv

* Update docs/how-to-guides/isis-developer-guides/writing-isis-tests-with-ctest-and-gtest.md

Co-authored-by: default avatarJacob Cain <115182890+jrcain-usgs@users.noreply.github.com>

---------

Co-authored-by: default avatarJacob Cain <115182890+jrcain-usgs@users.noreply.github.com>
parent 24ff092d
No related branches found
No related tags found
No related merge requests found
......@@ -40,7 +40,7 @@ For the rest of this document, we will use `appname` as the name of the applicat
1. In `appname.h` and `appname.cpp` create a new function in the `Isis` namespace with the following signature `void appname(UserInterface &ui)`. If the application has a `from` cube, add a second function with the input cube as the first argument `void appname(Cube incube, UserInterface &ui)`.
1. Copy the contents of the existing `IsisMain` function currently located in `main.cpp` into the new `void appname(Cube incube, UserInterface &ui)` function. (if the app doesn't take any file parameters (i.e., network, text, cube list...) copy the contents into` void appname(UserInterface &ui)`). If there is no input cube, but there are other input files, add them as input parameters similar to how the input cube was done, see spiceinit and cnetcheck tests for examples.
1. Modify `void appname(UserInterface &ui)` to open the input cube, usually "from", and/or other files and call the second function `void appname(Cube incube, UserInterface &ui)`
1. Copy any helper functions or global variables from `main.cpp` into `appname.cpp`. This is to not pollute the `Isis` namespace and avoid redefining symbols
1. Copy any helper functions or global variables from `main.cpp` into `appname.cpp`. Anything that was a global variable should be declared as static, this scopes them to the `.cpp` file. This is to avoid polluting the `Isis` namespace and avoid redefining symbols.
1. Prototype any helper functions at the top of `appname.cpp` and define them at the bottom of `appname.cpp`. Do not define them in `appname.h`.
1. Put all the required includes in `appname.cpp` and `appname.h`.
1. Remove the call to get the UserInterface from `appname.cpp`; it usually looks like `UserInterface &ui = Application::GetUserInterface();`.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment