Debian Codegraph @

podofo/3rdparty/tclap/Constraint.h

raw symbols SCIP
1 // -*- Mode: c++; c-basic-offset: 4; tab-width: 4; -*-
2
3 /******************************************************************************
4 *
5 * file: Constraint.h
6 *
7 * Copyright (c) 2005, Michael E. Smoot
8 * Copyright (c) 2017, Google LLC
9 * All rights reserved.
10 *
11 * See the file COPYING in the top directory of this distribution for
12 * more information.
13 *
14 * THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
21 *
22 *****************************************************************************/
23
24 #ifndef TCLAP_CONSTRAINT_H
25 #define TCLAP_CONSTRAINT_H
26
27 #include <algorithm>
28 #include <iomanip>
29 #include <iostream>
30 #include <list>
31 #include <stdexcept>
32 #include <string>
33 #include <vector>
34
35 namespace TCLAP {
36
37 /**
38 * The interface that defines the interaction between the Arg and Constraint.
39 */
40 template <class T>
41 class Constraint {
42 public:
43 /**
44 * Returns a description of the Constraint.
45 */
46 virtual std::string description() const = 0;
47
48 /**
49 * Returns the short ID for the Constraint.
50 */
51 virtual std::string shortID() const = 0;
52
53 /**
54 * The method used to verify that the value parsed from the command
55 * line meets the constraint.
56 * \param value - The value that will be checked.
57 */
58 virtual bool check(const T &value) const = 0;
59
60 /**
61 * Destructor.
62 * Silences warnings about Constraint being a base class with virtual
63 * functions but without a virtual destructor.
64 */
65 virtual ~Constraint() { ; }
66
67 static std::string shortID(Constraint<T> *constraint) {
68 if (!constraint)
69 throw std::logic_error(
70 "Cannot create a ValueArg with a NULL constraint");
71 return constraint->shortID();
72 }
73 };
74
75 } // namespace TCLAP
76
77 #endif // TCLAP_CONSTRAINT_H