Skip to content

Commit

Permalink
Explicitly as to make globals static (#124)
Browse files Browse the repository at this point in the history
* 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: Jacob Cain <[email protected]>

---------

Co-authored-by: Jacob Cain <[email protected]>
  • Loading branch information
Kelvinrr and jrcain-usgs authored Nov 18, 2024
1 parent 24ff092 commit 1ecd688
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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();`.
Expand Down

0 comments on commit 1ecd688

Please sign in to comment.