FLOPC++
|
00001 // ******************** FlopCpp ********************************************** 00002 // File: MP_boolean.hpp 00003 // $Id$ 00004 // Author: Tim Helge Hultberg (thh@mat.ua.pt) 00005 // Copyright (C) 2003 Tim Helge Hultberg 00006 // All Rights Reserved. 00007 // **************************************************************************** 00008 00009 #ifndef _MP_boolean_hpp_ 00010 #define _MP_boolean_hpp_ 00011 00012 #include <vector> 00013 using std::vector; 00014 00015 #include "MP_index.hpp" 00016 00017 namespace flopc { 00018 class SUBSETREF; 00019 00021 class Boolean_base { 00022 friend class Handle<Boolean_base*>; 00023 friend class MP_boolean; 00024 public: 00025 virtual bool evaluate() const = 0; 00026 protected: 00027 Boolean_base() : count(0) {} 00028 virtual ~Boolean_base() {} 00029 int count; 00030 }; 00031 00040 class MP_boolean : public Handle<Boolean_base*> { 00041 public: 00042 MP_boolean() : Handle<Boolean_base*>(0) {} 00043 MP_boolean(bool b); 00044 MP_boolean(const Constant& c); 00045 MP_boolean(SUBSETREF& c); 00046 MP_boolean(Boolean_base* r) : Handle<Boolean_base*>(r) {} 00047 }; 00048 00050 00058 MP_boolean operator!(const MP_boolean& b); 00059 00068 MP_boolean operator&&(const MP_boolean& e1, const MP_boolean& e2); 00069 00078 MP_boolean operator||(const MP_boolean& e1, const MP_boolean& e2); 00079 00080 // /** @brief boolean which returns true if all in domain evaluate to true. 00081 // @ingroup PublicInterface 00082 // This is used in the normal formation of an expression. 00083 // @param d MP_domain to evaluate with 00084 // @param b boolean expression to evaluate. 00085 // @returns A boolean which evaluates to true all domain evaluations of the boolean 00086 // evaluate to true. 00087 // */ 00088 // MP_boolean alltrue(const MP_domain& d, const MP_boolean& b); 00089 00107 MP_boolean operator<=(const MP_index_exp& e1, const MP_index_exp& e2); 00108 00116 MP_boolean operator<=(const Constant& e1, const Constant& e2); 00117 00127 MP_boolean operator<(const MP_index_exp& e1, const MP_index_exp& e2); 00128 00136 MP_boolean operator<(const Constant& e1, const Constant& e2); 00137 00147 MP_boolean operator>=(const MP_index_exp& e1, const MP_index_exp& e2); 00148 00156 MP_boolean operator>=(const Constant& e1, const Constant& e2); 00157 00167 MP_boolean operator>(const MP_index_exp& e1, const MP_index_exp& e2); 00168 00176 MP_boolean operator>(const Constant& e1, const Constant& e2); 00177 00187 MP_boolean operator==(const MP_index_exp& e1, const MP_index_exp& e2); 00188 00196 MP_boolean operator==(const Constant& e1, const Constant& e2); 00197 00207 MP_boolean operator!=(const MP_index_exp& e1, const MP_index_exp& e2); 00208 00216 MP_boolean operator!=(const Constant& e1, const Constant& e2); 00217 00218 } // End of namespace flopc 00219 #endif