Skip to content
Snippets Groups Projects

Logical parentheses in command line parsing

Closed Wouter Deconinck requested to merge logical-parentheses into master
2 files
+ 14
13
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -77,14 +77,15 @@ settings cmdline_settings(int argc, char* argv[]) {
@@ -77,14 +77,15 @@ settings cmdline_settings(int argc, char* argv[]) {
"draw mode:" %
"draw mode:" %
(command("draw"), // values("component").set(s.field_comps),
(command("draw"), // values("component").set(s.field_comps),
option("--Nsteps") & number("Nsteps", s.step_size) % "number of steps to evaluate",
option("--Nsteps") & number("Nsteps", s.step_size) % "number of steps to evaluate",
option("--step") & number("step", s.step_size) % "step size",
option("--step") & number("step", s.step_size) % "step size",
option("--start") & (number("x", s.x0).if_missing([] { std::cout << "x missing!\n"; }),
option("--start") & (number("x", s.x0).if_missing([] { std::cout << "x missing!\n"; }),
number("y", s.y0).if_missing([] { std::cout << "y missing!\n"; }),
number("y", s.y0).if_missing([] { std::cout << "y missing!\n"; }),
number("z", s.z0).if_missing([] { std::cout << "z missing!\n"; })),
number("z", s.z0).if_missing([] { std::cout << "z missing!\n"; })),
(option("--end").set(s.with_end_point, true) & (number("x1", s.x1).if_missing([] { std::cout << "x1 missing!\n"; }),
(option("--end").set(s.with_end_point, true) &
 
(number("x1", s.x1).if_missing([] { std::cout << "x1 missing!\n"; }),
number("y1", s.y1).if_missing([] { std::cout << "y1 missing!\n"; }),
number("y1", s.y1).if_missing([] { std::cout << "y1 missing!\n"; }),
number("z1", s.z1).if_missing([] { std::cout << "z1 missing!\n"; })) |
number("z1", s.z1).if_missing([] { std::cout << "z1 missing!\n"; }))) |
option("--direction") &
(option("--direction") &
(number("x2", s.x2).if_missing([] { std::cout << "x2 missing!\n"; }),
(number("x2", s.x2).if_missing([] { std::cout << "x2 missing!\n"; }),
number("y2", s.y2).if_missing([] { std::cout << "y2 missing!\n"; }),
number("y2", s.y2).if_missing([] { std::cout << "y2 missing!\n"; }),
number("z2", s.z2).if_missing([] { std::cout << "z2 missing!\n"; })))
number("z2", s.z2).if_missing([] { std::cout << "z2 missing!\n"; })))
@@ -194,10 +195,8 @@ TGraph* build_1D_field_graph(dd4hep::Detector& detector, const settings& s,
@@ -194,10 +195,8 @@ TGraph* build_1D_field_graph(dd4hep::Detector& detector, const settings& s,
/** Cell size example.
/** Cell size example.
*
*
*/
*/
void mag_field(dd4hep::Detector& detector){
void mag_field(dd4hep::Detector& detector)
{
double z0 = 0.0;
double x_min = -100.0;
double x_min = -100.0;
double x_max = 100.0;
double x_max = 100.0;
double y_min = -100.0;
double y_min = -100.0;
@@ -272,7 +271,8 @@ int main (int argc, char *argv[]) {
@@ -272,7 +271,8 @@ int main (int argc, char *argv[]) {
int root_argc = 0;
int root_argc = 0;
char *root_argv[1];
char *root_argv[1];
argv[0] = "npdet_fields";
std::string argv0("npdet_fields");
 
strncpy(root_argv[0], argv0.c_str(), argv0.size());
TApplication theApp("tapp", &root_argc, root_argv);
TApplication theApp("tapp", &root_argc, root_argv);
Loading