FEDEM Solver  R8.0
Source code of the dynamics solver
FFaAppInfo.H
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2023 SAP SE
2 //
3 // SPDX-License-Identifier: Apache-2.0
4 //
5 // This file is part of FEDEM - https://openfedem.org
7 
8 #ifndef FFA_APPLICATION_INFO_H
9 #define FFA_APPLICATION_INFO_H
10 
11 #include <string>
12 
13 
20 {
21 public:
23  FFaAppInfo();
24 
25  std::string version;
26  std::string user;
27  std::string date;
28 
30  static void openConsole(bool withGUI = false);
32  static void closeConsole(bool acknowledge = true);
33 
35  static bool isConsole() { return consoleFlag == 1; }
37  static bool haveConsole() { return consoleFlag >= 1; }
38 
40  static void init(const char* program);
42  static const std::string& getProgramPath() { return programPath; }
44  static bool isInCwd() { return iAmInCwd; }
46  static std::string getCWD();
48  static std::string getProgramPath(const std::string& program,
49  bool fnutts = true);
51  static std::string checkProgramPath(const std::string& program);
52 
53 private:
54  static char consoleFlag;
55  static int runInConsole;
56  static bool iAmInCwd;
57  static std::string programPath;
58 };
59 
60 #endif
Class to store information about the application.
Definition: FFaAppInfo.H:20
static bool haveConsole()
Returns true if this application has a console windows.
Definition: FFaAppInfo.H:37
static std::string checkProgramPath(const std::string &program)
Returns path of a program, or blank if not existing.
Definition: FFaAppInfo.C:206
static int runInConsole
If positive, the executable is run from console.
Definition: FFaAppInfo.H:55
static bool isInCwd()
Returns whether this program is in current working dir or not.
Definition: FFaAppInfo.H:44
static std::string programPath
Absolute path of this executable.
Definition: FFaAppInfo.H:57
static void closeConsole(bool acknowledge=true)
Closes the current console window.
Definition: FFaAppInfo.C:80
std::string user
User name of running process.
Definition: FFaAppInfo.H:26
static void openConsole(bool withGUI=false)
Sets this to be a console application, optionally with GUI too.
Definition: FFaAppInfo.C:52
std::string version
Current program version.
Definition: FFaAppInfo.H:25
std::string date
Current date and time.
Definition: FFaAppInfo.H:27
static const std::string & getProgramPath()
Returns the program path.
Definition: FFaAppInfo.H:42
static std::string getCWD()
Returns the current working directory of the program.
Definition: FFaAppInfo.C:174
static char consoleFlag
0: no console, 1: only console, 2: console+GUI
Definition: FFaAppInfo.H:54
static bool isConsole()
Returns true if this is a console-only application.
Definition: FFaAppInfo.H:35
static bool iAmInCwd
If true, the executable is in current work dir.
Definition: FFaAppInfo.H:56
FFaAppInfo()
The constructor gets meta information of this application.
Definition: FFaAppInfo.C:101
static void init(const char *program)
Initializes the program path.
Definition: FFaAppInfo.C:123