Bridge++  Version 1.5.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
main.cpp
Go to the documentation of this file.
1 
14 #include "bridge_setup.h"
15 #ifdef DEBUG
16 #include "bridge_init_factory.h"
17 #endif
19 #include "Parameters/parameters.h"
21 #include "Tools/timer.h"
22 
23 #ifdef USE_TESTMANAGER
24 #include "run_testmanager.h"
25 #endif
26 
27 #include "IO/bridgeIO.h"
28 using Bridge::vout;
29 
30 
31 const std::string filename_main_input = "main.yaml";
32 // const std::string filename_main_input = "stdin";
33 
34 //- prototype declarations
35 int run_test();
36 
37 
38 //====================================================================
39 int main(int argc, char *argv[])
40 {
41  // ### initial setup ###
43 
44  //- initialization step one
45  bridge_initialize(&argc, &argv);
46 
47  std::string filename_input = filename_main_input;
48  if (filename_input == "stdin") {
49  vout.general(vl, "input filename : ");
50  std::cin >> filename_input;
51  vout.general(vl, "%s\n", filename_input.c_str());
52  } else {
53  vout.general(vl, "input filename : %s\n", filename_input.c_str());
54  }
55  vout.general(vl, "\n");
56 
57  //- load input parameters
58  Parameters params_all = ParameterManager::read(filename_input);
59  Parameters params_main = params_all.lookup("Main");
60 
61  //- initialization step two: setup using parameter values,
62  bridge_setup(params_main);
63 
64 #ifdef USE_FACTORY
65 #ifdef DEBUG
66 // bridge_report_factory();
67 #endif
68 #endif
69 
70  //- start timer
71  unique_ptr<Timer> timer(new Timer("Main"));
72  timer->start();
73 
74 #ifdef USE_TESTMANAGER
75  run_testmanager(argc, argv);
76 #else
77  run_test();
78 #endif
79 
80  //- find total elapsed time
81  timer->report();
82 
83  //- finalization step
85 
86  return EXIT_SUCCESS;
87 }
88 
89 
90 //====================================================================
91 //============================================================END=====
BridgeIO vout
Definition: bridgeIO.cpp:503
const std::string filename_main_input
Definition: main.cpp:31
void general(const char *format,...)
Definition: bridgeIO.cpp:197
Class for parameters.
Definition: parameters.h:46
void bridge_setup(const Parameters &params)
int bridge_finalize()
int run_test()
Parameters lookup(const string &key) const
Definition: parameters.h:79
int run_testmanager(int argc, char **argv)
void start()
Definition: timer.cpp:44
static void read(const std::string &params_file, Parameters &params)
Bridge::VerboseLevel vl
VerboseLevel
Definition: bridgeIO.h:42
Definition: timer.h:31
int main(int argc, char *argv[])
Definition: main.cpp:39
void report(const Bridge::VerboseLevel vl=Bridge::GENERAL)
Definition: timer.cpp:128
int bridge_initialize(int *pargc, char ***pargv)