FEDEM Solver  R8.0
Source code of the dynamics solver
FFCmdLineArgInterface.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 
18 #ifndef FF_CMD_LINE_ARG_INTERFACE_H
19 #define FF_CMD_LINE_ARG_INTERFACE_H
20 
21 #ifdef FT_USE_DLL
22 #include <string>
23 #include <vector>
24 
25 typedef std::vector<double> DoubleVec;
26 
27 extern "C" {
28  void AddIntCmdLineOption (const char*, int , const char*, bool);
29  void AddFloatCmdLineOption (const char*, float , const char*, bool);
30  void AddDoubleCmdLineOption(const char*, double , const char*, bool);
31  void AddCmdLineOption (const char*, const char*, const char*, bool);
32  void AddBoolCmdLineOption (const char*, bool , const char*, bool);
33  void AddDblVecCmdLineOption(const char*, const DoubleVec&, const char*, bool);
34 }
35 
36 
38 void ADDOPTION (const char* ident, int defaultVal,
39  const char* descr, bool showToAll = true)
40 {
41  AddIntCmdLineOption(ident,defaultVal,descr,showToAll);
42 }
43 
45 void ADDOPTION (const char* ident, float defaultVal,
46  const char* descr, bool showToAll = true)
47 {
48  AddFloatCmdLineOption(ident,defaultVal,descr,showToAll);
49 }
50 
52 void ADDOPTION (const char* ident, double defaultVal,
53  const char* descr, bool showToAll = true)
54 {
55  AddDoubleCmdLineOption(ident,defaultVal,descr,showToAll);
56 }
57 
59 void ADDOPTION (const char* ident, const char* defaultVal,
60  const char* descr, bool showToAll = true)
61 {
62  AddCmdLineOption(ident,defaultVal,descr,showToAll);
63 }
64 
66 void ADDOPTION (const char* ident, bool defaultVal,
67  const char* descr, bool showToAll = true)
68 {
69  AddBoolCmdLineOption(ident,defaultVal,descr,showToAll);
70 }
71 
73 void ADDOPTION (const char* ident, const DoubleVec& defaultVal,
74  const char* descr, bool showToAll = true)
75 {
76  AddDblVecCmdLineOption(ident,defaultVal,descr,showToAll);
77 }
78 
79 
80 #else
82 
86 #define ADDOPTION FFaCmdLineArg::instance()->addOption
87 
88 #endif
89 
91 #define ADD_PRIVATE_OPTION(a,b,c) ADDOPTION(a,b,c,false)
92 
93 #endif
DLLexport void AddBoolCmdLineOption(const char *ident, bool defaultVal, const char *descr, bool showToAll)
Adds a bool-valued command-line option.
Definition: FFCmdLineArgInterface.C:60
DLLexport void AddCmdLineOption(const char *ident, const char *defaultVal, const char *descr, bool showToAll)
Adds a string-valued command-line option.
Definition: FFCmdLineArgInterface.C:51
DLLexport void AddDoubleCmdLineOption(const char *ident, double defaultVal, const char *descr, bool showToAll)
Adds a double-valued command-line option.
Definition: FFCmdLineArgInterface.C:43
DLLexport void AddIntCmdLineOption(const char *ident, int defaultVal, const char *descr, bool showToAll)
Adds an int-valued command-line option.
Definition: FFCmdLineArgInterface.C:27
DLLexport void AddDblVecCmdLineOption(const char *ident, const DoubleVec &defaultVal, const char *descr, bool showToAll)
Adds a vector-of-doubles-valued command-line option.
Definition: FFCmdLineArgInterface.C:68
DLLexport void AddFloatCmdLineOption(const char *ident, float defaultVal, const char *descr, bool showToAll)
Adds a float-valued command-line option.
Definition: FFCmdLineArgInterface.C:35
#define ADDOPTION
Convenience macro for adding command-line options.
Definition: FFCmdLineArgInterface.H:86
General command-line option handler.
std::vector< double > DoubleVec
Convenience type definition.
Definition: FFaCmdLineArg.H:241