File: CmdLine.html

package info (click to toggle)
torch 2-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 5,488 kB
  • ctags: 3,217
  • sloc: cpp: 14,272; makefile: 201
file content (197 lines) | stat: -rw-r--r-- 10,620 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML>
<HEAD>
   <TITLE>class  CmdLine</TITLE>
   <META NAME="GENERATOR" CONTENT="DOC++ 3.4.8">
</HEAD>
<BODY BGCOLOR="#ffffff">

<H2>class  <A HREF="#DOC.DOCU">CmdLine</A></H2></H2><BLOCKQUOTE>This class provides a useful interface for the user, to easily read some arguments/options from the command-line.</BLOCKQUOTE>
<HR>

<H2>Inheritance:</H2>
<APPLET CODE="ClassGraph.class" WIDTH=600 HEIGHT=65>
<param name=classes value="CObject,MObject.html,CCmdLine,MCmdLine.html">
<param name=before value="M,M">
<param name=after value="Md_,M">
<param name=indent value="0,1">
<param name=arrowdir value="down">
</APPLET>
<HR>

<DL>
<P><DL>
<DT><H3>Public Methods</H3><DD><DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif> <B><A HREF="#DOC.7.1">CmdLine</A></B>()
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>void <B><A HREF="#DOC.7.2">read</A></B>(int argc, char** argv)
<DD><I>Read the command-line.</I>
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>void <B><A HREF="#DOC.7.3">help</A></B>(char* <!1><A HREF="SeqExample.html#DOC.107.9">name</A>)
<DD><I>Print the help.</I>
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>void <B><A HREF="#DOC.7.5">addBCmdOption</A></B>(const char* <!1><A HREF="SeqExample.html#DOC.107.9">name</A>, bool* <!1><A HREF="Vec.html#DOC.81.3">ptr</A>, bool initvalue, const char* <!1><A HREF="CmdLine.html#DOC.7.3">help</A>="")
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>void <B><A HREF="#DOC.7.6">addRCmdOption</A></B>(const char* <!1><A HREF="SeqExample.html#DOC.107.9">name</A>, real* <!1><A HREF="Vec.html#DOC.81.3">ptr</A>, real initvalue, const char* <!1><A HREF="CmdLine.html#DOC.7.3">help</A>="")
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>void <B><A HREF="#DOC.7.7">addSCmdOption</A></B>(const char* <!1><A HREF="SeqExample.html#DOC.107.9">name</A>, char** <!1><A HREF="Vec.html#DOC.81.3">ptr</A>, const char* initvalue, const char* <!1><A HREF="CmdLine.html#DOC.7.3">help</A>="")
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>void <B><A HREF="#DOC.7.9">addBCmdArg</A></B>(const char* <!1><A HREF="SeqExample.html#DOC.107.9">name</A>, bool* <!1><A HREF="Vec.html#DOC.81.3">ptr</A>, const char* <!1><A HREF="CmdLine.html#DOC.7.3">help</A>="")
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>void <B><A HREF="#DOC.7.10">addRCmdArg</A></B>(const char* <!1><A HREF="SeqExample.html#DOC.107.9">name</A>, real* <!1><A HREF="Vec.html#DOC.81.3">ptr</A>, const char* <!1><A HREF="CmdLine.html#DOC.7.3">help</A>="")
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>void <B><A HREF="#DOC.7.11">addSCmdArg</A></B>(const char* <!1><A HREF="SeqExample.html#DOC.107.9">name</A>, char** <!1><A HREF="Vec.html#DOC.81.3">ptr</A>, const char* <!1><A HREF="CmdLine.html#DOC.7.3">help</A>="")
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>void <B><A HREF="#DOC.7.12">addText</A></B>(const char* text)
<DD><I>Add a text line in the help message</I>
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif>void <B><A HREF="#DOC.7.13">info</A></B>(const char* text)
<DD><I>Add a text at the beginnig of the help</I>
</DL></P>

<P><DL>
<DT><H3>Public Members</H3><DD><DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif> <B><A HREF="#DOC.7.4">Functions for adding options.</A></B>
<DT>
<IMG ALT="[more]" BORDER=0 SRC=icon1.gif> <B><A HREF="#DOC.7.8">Functions for adding an argument.</A></B>
</DL></P>

</DL>
<HR><H3>Inherited from <A HREF="Object.html">Object</A>:</H3>
<DL>
<P><DL>
<DT><H3>Public Methods</H3><DD><DT>
<IMG ALT="o" SRC=icon2.gif>virtual   void <B>init</B>()
<DT>
<IMG ALT="o" SRC=icon2.gif>void <B>addOption</B>(const char* <!1><A HREF="SeqExample.html#DOC.107.9">name</A>, int size, void* <!1><A HREF="Vec.html#DOC.81.3">ptr</A>, const char* <!1><A HREF="CmdLine.html#DOC.7.3">help</A>="", bool is_allowed_after_init=false)
<DT>
<IMG ALT="o" SRC=icon2.gif>void <B>addIOption</B>(const char* <!1><A HREF="SeqExample.html#DOC.107.9">name</A>, int* <!1><A HREF="Vec.html#DOC.81.3">ptr</A>, int init_value, const char* <!1><A HREF="CmdLine.html#DOC.7.3">help</A>="", bool is_allowed_after_init=false)
<DT>
<IMG ALT="o" SRC=icon2.gif>void <B>addROption</B>(const char* <!1><A HREF="SeqExample.html#DOC.107.9">name</A>, real* <!1><A HREF="Vec.html#DOC.81.3">ptr</A>, real init_value, const char* <!1><A HREF="CmdLine.html#DOC.7.3">help</A>="", bool is_allowed_after_init=false)
<DT>
<IMG ALT="o" SRC=icon2.gif>void <B>addBOption</B>(const char* <!1><A HREF="SeqExample.html#DOC.107.9">name</A>, bool* <!1><A HREF="Vec.html#DOC.81.3">ptr</A>, bool init_value, const char* <!1><A HREF="CmdLine.html#DOC.7.3">help</A>="", bool is_allowed_after_init=false)
<DT>
<IMG ALT="o" SRC=icon2.gif>void <B>setOption</B>(const char* <!1><A HREF="SeqExample.html#DOC.107.9">name</A>, void* <!1><A HREF="Vec.html#DOC.81.3">ptr</A>)
<DT>
<IMG ALT="o" SRC=icon2.gif>void <B>setIOption</B>(const char* <!1><A HREF="SeqExample.html#DOC.107.9">name</A>, int option)
<DT>
<IMG ALT="o" SRC=icon2.gif>void <B>setROption</B>(const char* <!1><A HREF="SeqExample.html#DOC.107.9">name</A>, real option)
<DT>
<IMG ALT="o" SRC=icon2.gif>void <B>setBOption</B>(const char* <!1><A HREF="SeqExample.html#DOC.107.9">name</A>, bool option)
<DT>
<IMG ALT="o" SRC=icon2.gif>virtual   void <B>loadFILE</B>(FILE* <!1><A HREF="Measurer.html#DOC.30.2">file</A>)
<DT>
<IMG ALT="o" SRC=icon2.gif>virtual   void <B>saveFILE</B>(FILE* <!1><A HREF="Measurer.html#DOC.30.2">file</A>)
<DT>
<IMG ALT="o" SRC=icon2.gif>void <B>load</B>(const char* filename)
<DT>
<IMG ALT="o" SRC=icon2.gif>void <B>save</B>(const char* filename)
</DL></P>

</DL>

<A NAME="DOC.DOCU"></A>
<HR>
<H2>Documentation</H2>
<BLOCKQUOTE>This class provides a useful interface for the user,
to easily read some arguments/options from the command-line.

<P>Note that here, we make a difference between:
<UL>
<LI> <B>options</B> which aren't not required.
<LI> <B>arguments</B> which are required.
</UL>

<P></BLOCKQUOTE>
<DL>

<A NAME="CmdLine"></A>
<A NAME="DOC.7.1"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B> CmdLine()</B></TT>
<DL><DT><DD></DL><P>
<A NAME="read"></A>
<A NAME="DOC.7.2"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>void read(int argc, char** argv)</B></TT>
<DD>Read the command-line.
Call this function <B>after</B> adding options/arguments
that you need, with the help of the following functions.
<DL><DT><DD></DL><P>
<A NAME="help"></A>
<A NAME="DOC.7.3"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>void help(char* <!1><A HREF="SeqExample.html#DOC.107.9">name</A>)</B></TT>
<DD>Print the help.
Call this function <B>after</B> adding options/arguments
that you need, with the help of the following functions.
<DL><DT><DD></DL><P>
<A NAME="Functions for adding options."></A>
<A NAME="DOC.7.4"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B> Functions for adding options.</B></TT>
<DD>Functions for adding options.
The calling order of the following functions will
define the text order associated when you will call <TT>help()</TT>.

<P>Add an option (Int, Bool, Real, String).
<UL>
<LI> <TT>name</TT> the name of the option (must be unique).
<LI> <TT>ptr</TT> is the pointer on the optional variable.
<LI> <TT>initvalue</TT> is the initialization value.
<LI> <TT>help</TT> is the help text for this option.
</UL>

<P>The option will be setted to <TT>value</TT> in the command-line
by printing "<TT>name</TT> <TT>value</TT>"
<DL><DT><DD></DL><P>
<A NAME="addBCmdOption"></A>
<A NAME="DOC.7.5"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>void addBCmdOption(const char* <!1><A HREF="SeqExample.html#DOC.107.9">name</A>, bool* <!1><A HREF="Vec.html#DOC.81.3">ptr</A>, bool initvalue, const char* <!1><A HREF="CmdLine.html#DOC.7.3">help</A>="")</B></TT>
<DL><DT><DD></DL><P>
<A NAME="addRCmdOption"></A>
<A NAME="DOC.7.6"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>void addRCmdOption(const char* <!1><A HREF="SeqExample.html#DOC.107.9">name</A>, real* <!1><A HREF="Vec.html#DOC.81.3">ptr</A>, real initvalue, const char* <!1><A HREF="CmdLine.html#DOC.7.3">help</A>="")</B></TT>
<DL><DT><DD></DL><P>
<A NAME="addSCmdOption"></A>
<A NAME="DOC.7.7"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>void addSCmdOption(const char* <!1><A HREF="SeqExample.html#DOC.107.9">name</A>, char** <!1><A HREF="Vec.html#DOC.81.3">ptr</A>, const char* initvalue, const char* <!1><A HREF="CmdLine.html#DOC.7.3">help</A>="")</B></TT>
<DL><DT><DD></DL><P>
<A NAME="Functions for adding an argument."></A>
<A NAME="DOC.7.8"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B> Functions for adding an argument.</B></TT>
<DD>Functions for adding an argument.
The argument will be setted to <TT>value</TT> in the command-line
by writting "<TT>value</TT>" <B>after</B> all the options.
If there are N arguments, you have to write
"<TT>value1</TT> <TT>value2</TT> <TT>value3</TT> ... <TT>valueN</TT>" to set them in the
command-line.
<DL><DT><DD></DL><P>
<A NAME="addBCmdArg"></A>
<A NAME="DOC.7.9"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>void addBCmdArg(const char* <!1><A HREF="SeqExample.html#DOC.107.9">name</A>, bool* <!1><A HREF="Vec.html#DOC.81.3">ptr</A>, const char* <!1><A HREF="CmdLine.html#DOC.7.3">help</A>="")</B></TT>
<DL><DT><DD></DL><P>
<A NAME="addRCmdArg"></A>
<A NAME="DOC.7.10"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>void addRCmdArg(const char* <!1><A HREF="SeqExample.html#DOC.107.9">name</A>, real* <!1><A HREF="Vec.html#DOC.81.3">ptr</A>, const char* <!1><A HREF="CmdLine.html#DOC.7.3">help</A>="")</B></TT>
<DL><DT><DD></DL><P>
<A NAME="addSCmdArg"></A>
<A NAME="DOC.7.11"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>void addSCmdArg(const char* <!1><A HREF="SeqExample.html#DOC.107.9">name</A>, char** <!1><A HREF="Vec.html#DOC.81.3">ptr</A>, const char* <!1><A HREF="CmdLine.html#DOC.7.3">help</A>="")</B></TT>
<DL><DT><DD></DL><P>
<A NAME="addText"></A>
<A NAME="DOC.7.12"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>void addText(const char* text)</B></TT>
<DD>Add a text line in the help message
<DL><DT><DD></DL><P>
<A NAME="info"></A>
<A NAME="DOC.7.13"></A>
<DT><IMG ALT="o" BORDER=0 SRC=icon2.gif><TT><B>void info(const char* text)</B></TT>
<DD>Add a text at the beginnig of the help
<DL><DT><DD></DL><P></DL>

<HR><DL><DT><B>This class has no child classes.</B></DL>

<DL><DT><DT><B>Author:</B><DD>Ronan Collobert (collober@iro.umontreal.ca)
<DD></DL><P><P><I><A HREF="index.html">Alphabetic index</A></I> <I><A HREF="HIER.html">HTML hierarchy of classes</A> or <A HREF="HIERjava.html">Java</A></I></P><HR>
<BR>
This page was generated with the help of <A HREF="http://docpp.sourceforge.net">DOC++</A>.
</BODY>
</HTML>