IMP  2.1.0
The Integrative Modeling Platform
flags.cpp
1 /** \example base/flags.cpp
2  Show simple usage of the command line flags support in IMP.base in a
3  C++ executable. Run with "--help" to see all available flags.
4 */
5 #include <IMP/base/flags.h>
6 
7 int main(int argc, char *argv[]) {
8  std::string hello = "Hello world";
9  IMP::base::AddStringFlag("hello", "How to say hello", &hello);
10 
11  IMP::base::setup_from_argv(argc, argv, "Example on C++ use of flags.");
12 
13  if (hello.empty()) {
14  // bad argument
16  return 1;
17  }
18 
19  std::cout << hello << std::endl;
20 
21  return 0;
22 }
Various general useful macros for IMP.
void write_help(std::ostream &out=std::cerr)
void setup_from_argv(int argc, char **argv, std::string description)