58 int main(
int argc,
char **argv) {
62 egsFatal(
"\nUsage: %s -a application -p pegs_file [-i input_file] [-o output_file] "
63 "[-b] [-P number_of_parallel_jobs] [-j job_index]\n\n",argv[0]);
69 lib_dir += CONFIG_NAME;
72 EGS_Library egs_lib(app_name.c_str(),lib_dir.c_str());
73 if (!egs_lib.load())
egsFatal(
"\n%s: Failed to load the %s application library from %s\n\n",
74 argv[0],app_name.c_str(),lib_dir.c_str());
77 createAppFunction createApp = (createAppFunction) egs_lib.resolve(
"createApplication");
78 if (!createApp)
egsFatal(
"\n%s: Failed to resolve the address of the 'createApplication' function"
79 " in the application library %s\n\n",argv[0],egs_lib.libraryFile());
83 egsFatal(
"\n%s: Failed to construct the application %s\n\n",argv[0],app_name.c_str());
86 int err = app->initSimulation();
90 err = app->runSimulation();
94 err = app->finishSimulation();
A class for dynamically loading shared libraries.
int main(int argc, char **argv)
A main program for egspp applications.
static bool getArgument(int &argc, char **argv, const char *name1, const char *name2, string &arg)
Finds a command line argument.
Global egspp functions header file.
EGS_InfoFunction EGS_EXPORT egsFatal
Always use this function for reporting fatal errors.
EGS_Library class header file.
EGS_Application class header file.
Base class for advanced EGSnrc C++ applications.
static void checkEnvironmentVar(int &argc, char **argv, const char *env, const char *n1, const char *n2, string &var)
Finds a command line argument.