00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 #ifndef _cvcl__theory_bitvector__bitvector_expr_value_h_
00031 #define _cvcl__theory_bitvector__bitvector_expr_value_h_
00032 
00033 #include "theory_bitvector.h"
00034 
00035 namespace CVCL {
00036 
00037 
00038 
00039 
00040 
00041 class BVConstExpr : public ExprValue {
00042 private:
00043   std::vector<bool> d_bvconst; 
00044   size_t d_MMIndex; 
00045  public:
00046 
00047   BVConstExpr(ExprManager* em, std::string bvconst,
00048               size_t mmIndex, ExprIndex idx = 0);
00049   
00050 
00051   BVConstExpr(ExprManager* em, std::vector<bool> bvconst,
00052               size_t mmIndex, ExprIndex idx = 0);
00053   
00054   ExprValue* copy(ExprManager* em, ExprIndex idx = 0) const {
00055     return new(em->getMM(getMMIndex()))
00056       BVConstExpr(em, d_bvconst, d_MMIndex, idx);
00057   }
00058 
00059   size_t computeHash() const;
00060   size_t getMMIndex() const { return d_MMIndex; }
00061 
00062   const ExprValue* getExprValue() const { return this; }
00063   
00064 
00065   bool operator==(const ExprValue& ev2) const {
00066     if(ev2.getMMIndex() != d_MMIndex) return false;
00067     return (d_bvconst == ((const BVConstExpr&)ev2).d_bvconst);
00068   }
00069   
00070   void* operator new(size_t size, MemoryManager* mm) {
00071     return mm->newData(size);
00072   }
00073 
00074   void operator delete(void*) { }
00075 
00076   unsigned size() const { return d_bvconst.size(); }
00077   bool getValue(int i) const
00078     { DebugAssert(0 <= i && (unsigned)i < size(), "out of bounds");
00079       return d_bvconst[i]; }
00080 
00081 }; 
00082 
00083 } 
00084 #endif