Main MRPT website > C++ reference for MRPT 1.4.0
OptionalUnlabeledTracker.h
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2016, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +---------------------------------------------------------------------------+ */
9 
10 
11 /******************************************************************************
12  *
13  * file: OptionalUnlabeledTracker.h
14  *
15  * Copyright (c) 2005, Michael E. Smoot .
16  * All rights reverved.
17  *
18  * See the file COPYING in the top directory of this distribution for
19  * more information.
20  *
21  * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
22  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27  * DEALINGS IN THE SOFTWARE.
28  *
29  *****************************************************************************/
30 
31 
32 #ifndef TCLAP_OPTIONAL_UNLABELED_TRACKER_H
33 #define TCLAP_OPTIONAL_UNLABELED_TRACKER_H
34 
35 #include <string>
36 
37 namespace TCLAP {
38 
39 template <class DUMMY = int>
41 {
42 
43  public:
44 
45  static void check( bool req, const std::string& argName );
46 
47  static void gotOptional() { alreadyOptionalRef() = true; }
48 
49  static bool& alreadyOptional() { return alreadyOptionalRef(); }
50 
51  private:
52 
53  static bool& alreadyOptionalRef() { static bool ct = false; return ct; }
54 };
55 
56 
57 template <class DUMMY>
58 void OptionalUnlabeledTracker<DUMMY>::check( bool req, const std::string& argName )
59 {
62  "You can't specify ANY Unlabeled Arg following an optional Unlabeled Arg",
63  argName ) );
64 
65  if ( !req )
67 }
68 
69 
70 } // namespace TCLAP
71 
72 #endif
Definition: Arg.h:44
Thrown from Arg and CmdLine when an Arg is improperly specified, e.g.
Definition: ArgException.h:175
static void check(bool req, const std::string &argName)



Page generated by Doxygen 1.8.11 for MRPT 1.4.0 SVN:Unversioned directory at Sun Jul 10 11:38:36 UTC 2016