1 | /* |
---|
2 | Copyright (C) 2007, Lou Hafer, International Business Machines Corporation |
---|
3 | and others. All Rights Reserved. |
---|
4 | |
---|
5 | This code is licensed under the terms of the Eclipse Public License (EPL). |
---|
6 | |
---|
7 | $Id: CbcGenCbcParam.cpp 1899 2013-04-09 18:12:08Z stefan $ |
---|
8 | */ |
---|
9 | /* |
---|
10 | This file is part of cbc-generic. |
---|
11 | */ |
---|
12 | |
---|
13 | #if defined(_MSC_VER) |
---|
14 | // Turn off compiler warning about long names |
---|
15 | # pragma warning(disable:4786) |
---|
16 | #endif |
---|
17 | |
---|
18 | #include <string> |
---|
19 | #include <cassert> |
---|
20 | |
---|
21 | #include "CoinParam.hpp" |
---|
22 | |
---|
23 | #include "CbcModel.hpp" |
---|
24 | |
---|
25 | #include "CbcGenCtlBlk.hpp" |
---|
26 | #include "CbcGenParam.hpp" |
---|
27 | #include "CbcGenCbcParam.hpp" |
---|
28 | |
---|
29 | namespace { |
---|
30 | |
---|
31 | char svnid[] = "$Id: CbcGenCbcParam.cpp 1899 2013-04-09 18:12:08Z stefan $" ; |
---|
32 | |
---|
33 | } |
---|
34 | |
---|
35 | /* |
---|
36 | Constructors and destructors |
---|
37 | |
---|
38 | There's a generic constructor and one for integer, double, keyword, string, |
---|
39 | and action parameters. |
---|
40 | */ |
---|
41 | |
---|
42 | /* |
---|
43 | Default constructor. |
---|
44 | */ |
---|
45 | CbcCbcParam::CbcCbcParam () |
---|
46 | : CoinParam(), |
---|
47 | paramCode_(CbcCbcParamCode(0)), |
---|
48 | obj_(0) |
---|
49 | { |
---|
50 | /* Nothing to be done here */ |
---|
51 | } |
---|
52 | |
---|
53 | |
---|
54 | /* |
---|
55 | Constructor for double parameter |
---|
56 | */ |
---|
57 | CbcCbcParam::CbcCbcParam (CbcCbcParamCode code, |
---|
58 | std::string name, std::string help, |
---|
59 | double lower, double upper, double dflt, |
---|
60 | bool display) |
---|
61 | : CoinParam(name, help, lower, upper, dflt, display), |
---|
62 | paramCode_(code), |
---|
63 | obj_(0) |
---|
64 | { |
---|
65 | /* Nothing to be done here */ |
---|
66 | } |
---|
67 | |
---|
68 | /* |
---|
69 | Constructor for integer parameter |
---|
70 | */ |
---|
71 | CbcCbcParam::CbcCbcParam (CbcCbcParamCode code, |
---|
72 | std::string name, std::string help, |
---|
73 | int lower, int upper, int dflt, |
---|
74 | bool display) |
---|
75 | : CoinParam(name, help, lower, upper, dflt, display), |
---|
76 | paramCode_(code), |
---|
77 | obj_(0) |
---|
78 | { |
---|
79 | /* Nothing to be done here */ |
---|
80 | } |
---|
81 | |
---|
82 | /* |
---|
83 | Constructor for keyword parameter. |
---|
84 | */ |
---|
85 | CbcCbcParam::CbcCbcParam (CbcCbcParamCode code, |
---|
86 | std::string name, std::string help, |
---|
87 | std::string firstValue, int dflt, |
---|
88 | bool display) |
---|
89 | : CoinParam(name, help, firstValue, dflt, display), |
---|
90 | paramCode_(code), |
---|
91 | obj_(0) |
---|
92 | { |
---|
93 | /* Nothing to be done here */ |
---|
94 | } |
---|
95 | |
---|
96 | /* |
---|
97 | Constructor for string parameter. |
---|
98 | */ |
---|
99 | CbcCbcParam::CbcCbcParam (CbcCbcParamCode code, |
---|
100 | std::string name, std::string help, |
---|
101 | std::string dflt, |
---|
102 | bool display) |
---|
103 | : CoinParam(name, help, dflt, display), |
---|
104 | paramCode_(code), |
---|
105 | obj_(0) |
---|
106 | { |
---|
107 | /* Nothing to be done here */ |
---|
108 | } |
---|
109 | |
---|
110 | /* |
---|
111 | Constructor for action parameter. |
---|
112 | */ |
---|
113 | CbcCbcParam::CbcCbcParam (CbcCbcParamCode code, |
---|
114 | std::string name, std::string help, |
---|
115 | bool display) |
---|
116 | : CoinParam(name, help, display), |
---|
117 | paramCode_(code), |
---|
118 | obj_(0) |
---|
119 | { |
---|
120 | /* Nothing to be done here */ |
---|
121 | } |
---|
122 | |
---|
123 | |
---|
124 | /* |
---|
125 | Copy constructor. |
---|
126 | */ |
---|
127 | CbcCbcParam::CbcCbcParam (const CbcCbcParam &orig) |
---|
128 | : CoinParam(orig), |
---|
129 | paramCode_(orig.paramCode_), |
---|
130 | obj_(orig.obj_) |
---|
131 | { |
---|
132 | /* Nothing to be done here */ |
---|
133 | } |
---|
134 | |
---|
135 | /* |
---|
136 | Clone |
---|
137 | */ |
---|
138 | |
---|
139 | CbcCbcParam *CbcCbcParam::clone () |
---|
140 | { |
---|
141 | return (new CbcCbcParam(*this)) ; |
---|
142 | } |
---|
143 | |
---|
144 | CbcCbcParam &CbcCbcParam::operator= (const CbcCbcParam & rhs) |
---|
145 | { |
---|
146 | if (this != &rhs) { |
---|
147 | CoinParam::operator=(rhs) ; |
---|
148 | |
---|
149 | paramCode_ = rhs.paramCode_ ; |
---|
150 | obj_ = rhs.obj_ ; |
---|
151 | } |
---|
152 | |
---|
153 | return *this ; |
---|
154 | } |
---|
155 | |
---|
156 | /* |
---|
157 | Destructor |
---|
158 | */ |
---|
159 | CbcCbcParam::~CbcCbcParam () |
---|
160 | { /* Nothing more to do */ } |
---|
161 | |
---|
162 | |
---|