Refactor ProgramInfo use
commitb35fd68500a86f8c3891c2798a7d7471406f9a94
authorTeemu Murtola <teemu.murtola@gmail.com>
Sun, 29 Dec 2013 11:46:11 +0000 (29 13:46 +0200)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Thu, 30 Jan 2014 08:48:55 +0000 (30 09:48 +0100)
tree51aac6dec5718e1a6b277ee9357cdb1d626aaa37
parent5983d48e3046bbf40b75e5f3a12fb410550a3d88
Refactor ProgramInfo use

Instead of having ProgramInfo in src/gromacs/utility/, declare only
a program context interface there, and provide simple setters and
accessors for it.  Move all the logic related to actually providing the
values (in particular, the location of the binary) into
src/gromacs/commandline/, which provides an implementation for the new
interface.

This provides two main benefits:
 - The responsibilities of the different modules are clearer, and there
   is no complex logic related to command line programs in the
   bottom layer.
 - The API provided for external code for initializing the library is a
   lot cleaner.  They can either choose to use all the command line
   logic by using gmx::initForCommandLine(), or provide their own
   implementation for the program context, and set it directly with
   gmx::setProgramContext().

Thread safety guarantees have changed somewhat; the implementation is
much simpler this way, and I don't think we need to be 100% thread safe
in methods such as setProgramContext() (gmx::init() isn't, either).

Change-Id: I2b89aeb3833e7e40e5dd2322745efbc44581e15b
40 files changed:
src/gromacs/commandline/.gitignore [new file with mode: 0644]
src/gromacs/commandline/CMakeLists.txt
src/gromacs/commandline/cmdlinehelpmodule.cpp
src/gromacs/commandline/cmdlinehelpmodule.h
src/gromacs/commandline/cmdlineinit.cpp [copied from src/gromacs/utility/init.cpp with 63% similarity]
src/gromacs/commandline/cmdlineinit.h [copied from src/gromacs/utility/init.h with 53% similarity]
src/gromacs/commandline/cmdlinemodulemanager.cpp
src/gromacs/commandline/cmdlinemodulemanager.h
src/gromacs/commandline/cmdlineprogramcontext.cpp [moved from src/gromacs/utility/programinfo.cpp with 83% similarity]
src/gromacs/commandline/cmdlineprogramcontext.h [moved from src/gromacs/utility/programinfo.h with 79% similarity]
src/gromacs/commandline/tests/CMakeLists.txt
src/gromacs/commandline/tests/cmdlinemodulemanager.cpp
src/gromacs/commandline/tests/cmdlineprogramcontext.cpp [moved from src/gromacs/utility/tests/programinfo.cpp with 97% similarity]
src/gromacs/fileio/futil.cpp
src/gromacs/fileio/matio.cpp
src/gromacs/fileio/tngio.cpp
src/gromacs/gmxana/gmx_densorder.cpp
src/gromacs/gmxana/gmx_dipoles.cpp
src/gromacs/gmxlib/copyrite.cpp
src/gromacs/gmxlib/main.cpp
src/gromacs/gmxlib/oenv.cpp
src/gromacs/gmxlib/xvgr.cpp
src/gromacs/gmxpreprocess/pdb2top.cpp
src/gromacs/legacyheaders/copyrite.h
src/gromacs/onlinehelp/helpwritercontext.cpp
src/gromacs/trajectoryanalysis.h
src/gromacs/trajectoryanalysis/cmdlinerunner.cpp
src/gromacs/trajectoryanalysis/tests/test_selection.cpp
src/gromacs/utility.h
src/gromacs/utility/.gitignore
src/gromacs/utility/CMakeLists.txt
src/gromacs/utility/errorformat.cpp
src/gromacs/utility/init.cpp
src/gromacs/utility/init.h
src/gromacs/utility/programcontext.cpp [copied from src/programs/gmx/gmx.cpp with 53% similarity]
src/gromacs/utility/programcontext.h [new file with mode: 0644]
src/gromacs/utility/tests/CMakeLists.txt
src/programs/gmx/gmx.cpp
src/testutils/cmdlinetest.cpp
src/testutils/testoptions.cpp