diff options
author | Morgan Deters <mdeters@gmail.com> | 2011-03-30 03:59:05 +0000 |
---|---|---|
committer | Morgan Deters <mdeters@gmail.com> | 2011-03-30 03:59:05 +0000 |
commit | 10cabf82a20258da80be53eb6d23b1a536e82eb5 (patch) | |
tree | d8262298ed5fba5a3c51681cc5739551747f7a90 /src/expr | |
parent | d35d086268fa2a3d9b3c387157e4c54f1b967e0e (diff) |
Add Valuation::getSatValue() so that theories can access the current
(propositional) assignment for theory atoms.
Fixed Debug/Trace as discussed in bug ticket #252 and on the mailing list.
This implementation leads to some compiler warnings in production builds,
but these will be corrected in coming days. There appears to be a small
speedup in the parser as a result of this fix:
http://goedel.cims.nyu.edu/regress-results/compare_jobs.php?job_id=1902&reference_id=1886&p=5
Cleaned up a few CD Boolean attribute things.
Various small fixes to coding guidelines / test coverage.
This commit:
* Resolves bug 252 (tracing not disabled in production builds)
* Resolves bug 254 (implement CDAttrHash<>::BitIterator::find())
Diffstat (limited to 'src/expr')
-rw-r--r-- | src/expr/attribute_internals.h | 73 |
1 files changed, 9 insertions, 64 deletions
diff --git a/src/expr/attribute_internals.h b/src/expr/attribute_internals.h index bd3e6eeba..1df8da63e 100644 --- a/src/expr/attribute_internals.h +++ b/src/expr/attribute_internals.h @@ -5,7 +5,7 @@ ** Major contributors: none ** Minor contributors (to current version): taking, dejan, cconway ** This file is part of the CVC4 prototype. - ** Copyright (c) 2009, 2010 The Analysis of Computer Systems Group (ACSys) + ** Copyright (c) 2009, 2010, 2011 The Analysis of Computer Systems Group (ACSys) ** Courant Institute of Mathematical Sciences ** New York University ** See the file COPYING in the top-level source directory for licensing @@ -445,44 +445,6 @@ class CDAttrHash<bool> : };/* class CDAttrHash<bool>::BitAccessor */ /** - * A (somewhat degenerate) iterator over boolean-valued attributes. - * This iterator doesn't support anything except comparison and - * dereference. It's intended just for the result of find() on the - * table. - */ - class BitIterator { - - super* d_map; - - std::pair<NodeValue* const, uint64_t>* d_entry; - - unsigned d_bit; - - public: - - BitIterator() : - d_map(NULL), - d_entry(NULL), - d_bit(0) { - } - - BitIterator(super& map, std::pair<NodeValue* const, uint64_t>& entry, unsigned bit) : - d_map(&map), - d_entry(&entry), - d_bit(bit) { - } - - std::pair<NodeValue* const, BitAccessor> operator*() { - return std::make_pair(d_entry->first, - BitAccessor(*d_map, d_entry->first, d_entry->second, d_bit)); - } - - bool operator==(const BitIterator& b) { - return d_entry == b.d_entry && d_bit == b.d_bit; - } - };/* class CDAttrHash<bool>::BitIterator */ - - /** * A (somewhat degenerate) const_iterator over boolean-valued * attributes. This const_iterator doesn't support anything except * comparison and dereference. It's intended just for the result of @@ -530,7 +492,7 @@ public: typedef std::pair<const key_type, data_type> value_type; /** an iterator type; see above for limitations */ - typedef BitIterator iterator; + typedef ConstBitIterator iterator; /** a const_iterator type; see above for limitations */ typedef ConstBitIterator const_iterator; @@ -538,28 +500,6 @@ public: * Find the boolean value in the hash table. Returns something == * end() if not found. */ - /*BitIterator find(const std::pair<uint64_t, NodeValue*>& k) { - super::iterator i = super::find(k.second); - if(i == super::end()) { - return BitIterator(); - } - Debug.printf("cdboolattr", - "underlying word at 0x%p looks like 0x%016llx, bit is %u\n", - &(*i).second, - (unsigned long long)((*i).second), - unsigned(k.first)); - return BitIterator(*i, k.first); - }*/ - - /** The "off the end" iterator */ - BitIterator end() { - return BitIterator(); - } - - /** - * Find the boolean value in the hash table. Returns something == - * end() if not found. - */ ConstBitIterator find(const std::pair<uint64_t, NodeValue*>& k) const { super::const_iterator i = super::find(k.second); if(i == super::end()) { @@ -588,14 +528,19 @@ public: } /** - * Delete all flags from the given node. + * Delete all flags from the given node. Simply calls superclass's + * obliterate(). Note this removes all attributes at all context + * levels for this NodeValue! This is important when the NodeValue + * is no longer referenced and is being collected, but otherwise + * it probably isn't useful to do this. */ void erase(NodeValue* nv) { super::obliterate(nv); } /** - * Clear the hash table. + * Clear the hash table. This simply exposes the protected superclass + * version of clear() to clients. */ void clear() { super::clear(); |