summaryrefslogtreecommitdiff
path: root/src/context
diff options
context:
space:
mode:
authorMorgan Deters <mdeters@gmail.com>2010-07-07 05:39:04 +0000
committerMorgan Deters <mdeters@gmail.com>2010-07-07 05:39:04 +0000
commit327b4bf823a8077930bdc9bf4ae7903087ee06ba (patch)
tree5c3571fc5ef12730cb6d3b818330dc5de5b6b33d /src/context
parenta9448e3e4d8e371bd74b55b9a98b61beab8e00f7 (diff)
minor changes to cdmap/cdset interface for detection of duplicate inserts
Diffstat (limited to 'src/context')
-rw-r--r--src/context/cdmap.h4
-rw-r--r--src/context/cdset.h9
2 files changed, 10 insertions, 3 deletions
diff --git a/src/context/cdmap.h b/src/context/cdmap.h
index 45ff68a23..5e5a07f2f 100644
--- a/src/context/cdmap.h
+++ b/src/context/cdmap.h
@@ -363,7 +363,7 @@ public:
return *obj;
}
- void insert(const Key& k, const Data& d) {
+ bool insert(const Key& k, const Data& d) {
emptyTrash();
typename table_type::iterator i = d_map.find(k);
@@ -371,8 +371,10 @@ public:
if(i == d_map.end()) {// create new object
Element* obj = new(true) Element(d_context, this, k, d);
d_map[k] = obj;
+ return true;
} else {
(*i).second->set(d);
+ return false;
}
}
diff --git a/src/context/cdset.h b/src/context/cdset.h
index 40d504cad..7032f76ba 100644
--- a/src/context/cdset.h
+++ b/src/context/cdset.h
@@ -22,6 +22,7 @@
#define __CVC4__CONTEXT__CDSET_H
#include "context/context.h"
+#include "context/cdmap.h"
#include "util/Assert.h"
namespace CVC4 {
@@ -45,8 +46,12 @@ public:
return super::count(v);
}
- void insert(const V& v) {
- super::insert(v, v);
+ bool insert(const V& v) {
+ return super::insert(v, v);
+ }
+
+ bool contains(const V& v) {
+ return find(v) != end();
}
// FIXME: no erase(), too much hassle to implement efficiently...
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback