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