Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
utils
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FSL
utils
Commits
1ed5a626
"git@git.fmrib.ox.ac.uk:ndcn0236/mribuilder.jl.git" did not exist on "8e78bd593f047d7fce38916e3d58028f1a25e332"
Commit
1ed5a626
authored
24 years ago
by
David Flitney
Browse files
Options
Downloads
Patches
Plain Diff
*** empty log message ***
parent
875ff313
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
options.h
+7
-5
7 additions, 5 deletions
options.h
opttst.cc
+14
-5
14 additions, 5 deletions
opttst.cc
with
21 additions
and
10 deletions
options.h
+
7
−
5
View file @
1ed5a626
...
@@ -8,7 +8,12 @@
...
@@ -8,7 +8,12 @@
#define POSIX_SOURCE 1
#define POSIX_SOURCE 1
namespace
Options
{
namespace
Utilities
{
void
string_to_T
(
bool
&
b
,
const
string
&
s
);
void
string_to_T
(
string
&
d
,
const
string
&
s
);
void
string_to_T
(
int
&
i
,
const
string
&
s
);
void
string_to_T
(
float
&
v
,
const
string
&
s
);
typedef
enum
{
typedef
enum
{
no_argument
=
0
,
requires_argument
,
optional_argument
no_argument
=
0
,
requires_argument
,
optional_argument
...
@@ -92,10 +97,7 @@ namespace Options {
...
@@ -92,10 +97,7 @@ namespace Options {
bool
unset_
,
compulsory_
;
bool
unset_
,
compulsory_
;
};
};
void
string_to_T
(
bool
&
b
,
const
string
&
s
);
ostream
&
operator
<<
(
ostream
&
os
,
const
BaseOption
&
o
);
void
string_to_T
(
string
&
d
,
const
string
&
s
);
void
string_to_T
(
int
&
i
,
const
string
&
s
);
void
string_to_T
(
float
&
v
,
const
string
&
s
);
/**
/**
Template class adding type specific behaviour to BaseOption. Define
Template class adding type specific behaviour to BaseOption. Define
...
...
This diff is collapsed.
Click to expand it.
opttst.cc
+
14
−
5
View file @
1ed5a626
#include
"options.h"
// $Id$
using
namespace
Utilities
;
using
namespace
Options
;
Option
<
bool
>
verbose
(
string
(
"-V,--verbose"
),
false
,
Option
<
bool
>
verbose
(
string
(
"-V,--verbose"
),
false
,
string
(
"switch on diagnostic messages"
),
string
(
"switch on diagnostic messages"
),
...
@@ -19,10 +20,18 @@ Option<string> resid(string("-r,--res"), string("res4d"),
...
@@ -19,10 +20,18 @@ Option<string> resid(string("-r,--res"), string("res4d"),
string
(
"4d `residual-of-fit' image"
),
string
(
"4d `residual-of-fit' image"
),
true
,
requires_argument
);
true
,
requires_argument
);
string
title
=
"opttst (Version 1.0)
\n
\
\t\t\t\t
Copyright(c) 2000, University of Oxford
\n
\
\t\t\t\t
Dave Flitney"
;
string
examples
=
"opttst -d <number> --mask <filename> --res <filename>
\n
\
opttst --verbose
\n
"
;
int
main
(
unsigned
int
argc
,
char
**
argv
)
{
int
main
(
unsigned
int
argc
,
char
**
argv
)
{
OptionParser
options
(
"options"
,
OptionParser
options
(
title
,
examples
);
"-d <number> --mask <filename> --res <filename>"
);
try
{
try
{
...
@@ -35,7 +44,7 @@ int main(unsigned int argc, char **argv) {
...
@@ -35,7 +44,7 @@ int main(unsigned int argc, char **argv) {
for
(
unsigned
int
a
=
options
.
parse_command_line
(
argc
,
argv
);
a
<
argc
;
a
++
)
for
(
unsigned
int
a
=
options
.
parse_command_line
(
argc
,
argv
);
a
<
argc
;
a
++
)
cout
<<
argv
[
a
]
<<
endl
;
cout
<<
argv
[
a
]
<<
endl
;
if
(
help
.
value
())
if
(
help
.
value
()
||
!
options
.
check_compulsory_arguments
()
)
options
.
usage
();
options
.
usage
();
if
(
verbose
.
value
())
{
if
(
verbose
.
value
())
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment