00001
00035 #ifndef ABA_FSVARSTAT_H
00036 #define ABA_FSVARSTAT_H
00037 #include <iostream>
00038 using namespace std;
00039
00040
00041 #include "abacus/abacusroot.h"
00042
00043 class ABA_GLOBAL;
00044
00045 #ifdef ABACUS_PARALLEL
00046 class ABA_MESSAGE;
00047 #endif
00048
00049 class ABA_FSVARSTAT : public ABA_ABACUSROOT {
00050 public:
00051
00065 enum STATUS {Free, SetToLowerBound, Set, SetToUpperBound,
00066 FixedToLowerBound, Fixed, FixedToUpperBound};
00067
00074 ABA_FSVARSTAT(ABA_GLOBAL *glob);
00075
00084 ABA_FSVARSTAT(ABA_GLOBAL *glob, STATUS status);
00085
00093 ABA_FSVARSTAT(ABA_GLOBAL *glob, STATUS status, double value);
00094
00099 ABA_FSVARSTAT(ABA_FSVARSTAT *fsVarStat);
00100 #ifdef ABACUS_PARALLEL
00101
00107 ABA_FSVARSTAT(const ABA_GLOBAL *glob, ABA_MESSAGE &msg);
00108
00113 void pack(ABA_MESSAGE &msg) const;
00114 #endif
00115
00124 friend ostream &operator<<(ostream& out, const ABA_FSVARSTAT &rhs);
00125
00128 STATUS status() const;
00129
00138 void status(STATUS stat);
00139
00146 void status(STATUS stat, double val);
00147
00153 void status(const ABA_FSVARSTAT *stat);
00154
00157 double value() const;
00158
00164 void value(double val);
00165
00170 bool fixed() const;
00171
00176 bool set() const;
00177
00181 bool fixedOrSet() const;
00182
00195 bool contradiction(ABA_FSVARSTAT *fsVarStat) const;
00196
00207 bool contradiction(STATUS status, double value = 0) const;
00208
00209 private:
00210
00213 ABA_GLOBAL *glob_;
00214
00217 STATUS status_;
00218
00223 double value_;
00224 };
00225
00226
00227 inline ABA_FSVARSTAT::ABA_FSVARSTAT(ABA_GLOBAL *glob)
00228 :
00229 glob_(glob),
00230 status_(Free)
00231 { }
00232
00233 inline ABA_FSVARSTAT::STATUS ABA_FSVARSTAT::status() const
00234 {
00235 return status_;
00236 }
00237
00238 inline void ABA_FSVARSTAT::status(STATUS stat)
00239 {
00240 status_ = stat;
00241 }
00242
00243 inline void ABA_FSVARSTAT::status(STATUS stat, double val)
00244 {
00245 status_ = stat;
00246 value_ = val;
00247 }
00248
00249 inline void ABA_FSVARSTAT::status(const ABA_FSVARSTAT *stat)
00250 {
00251 status_ = stat->status_;
00252 value_ = stat->value_;
00253 }
00254
00255 inline double ABA_FSVARSTAT::value() const
00256 {
00257 return value_;
00258 }
00259
00260 inline void ABA_FSVARSTAT::value(double val)
00261 {
00262 value_ = val;
00263 }
00264
00265 inline bool ABA_FSVARSTAT::fixedOrSet() const
00266 {
00267 if (status_ == Free) return false;
00268 else return true;
00269 }
00270
00271
00272 #endif // ABA_FSVARSTAT_H
00273
00274