diff options
author | Tim King <taking@cs.nyu.edu> | 2013-11-14 11:56:34 -0500 |
---|---|---|
committer | Tim King <taking@cs.nyu.edu> | 2013-11-21 10:43:44 -0500 |
commit | 91424455840a7365a328cbcc3d02ec453fe9d0ea (patch) | |
tree | e8072eb0c7dda81feafb1c5f9a4ca2f0fcbc0399 /src/expr/attribute.cpp | |
parent | bd8e9319aab69db90692f72bc52288329879eefc (diff) |
Adding the changes needed to delete rewriter attributes. This includes being able to list attributes. Additionally, added debugging hooks to node manager and attribute manager.
Diffstat (limited to 'src/expr/attribute.cpp')
-rw-r--r-- | src/expr/attribute.cpp | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/src/expr/attribute.cpp b/src/expr/attribute.cpp index 20d52e3cc..92a21546c 100644 --- a/src/expr/attribute.cpp +++ b/src/expr/attribute.cpp @@ -26,6 +26,15 @@ namespace CVC4 { namespace expr { namespace attr { + +void AttributeManager::debugHook(int debugFlag) { + /* DO NOT CHECK IN ANY CODE INTO THE DEBUG HOOKS! + * debugHook() is an empty function for the purpose of debugging + * the AttributeManager without recompiling all of CVC4. + * Formally this is a nop. + */ +} + void AttributeManager::deleteAllAttributes(NodeValue* nv) { d_bools.erase(nv); deleteFromTable(d_ints, nv); @@ -60,6 +69,60 @@ void AttributeManager::deleteAllAttributes() { d_cdptrs.clear(); } +void AttributeManager::deleteAttributes(const AttrIdVec& atids){ + typedef std::map<uint64_t, std::vector< uint64_t> > AttrToVecMap; + AttrToVecMap perTableIds; + + for(AttrIdVec::const_iterator it = atids.begin(), it_end = atids.end(); it != it_end; ++it){ + const AttributeUniqueId& pair = *(*it); + std::vector< uint64_t>& inTable = perTableIds[pair.getTableId()]; + inTable.push_back(pair.getWithinTypeId()); + } + AttrToVecMap::iterator it = perTableIds.begin(), it_end = perTableIds.end(); + for(; it != it_end; ++it){ + Assert(((*it).first) <= LastAttrTable); + AttrTableId tableId = (AttrTableId) ((*it).first); + std::vector< uint64_t>& ids = (*it).second; + std::sort(ids.begin(), ids.end()); + + switch(tableId){ + case AttrTableBool: + Unimplemented("delete attributes is unimplemented for bools"); + break; + case AttrTableUInt64: + deleteAttributesFromTable(d_ints, ids); + break; + case AttrTableTNode: + deleteAttributesFromTable(d_tnodes, ids); + break; + case AttrTableNode: + deleteAttributesFromTable(d_nodes, ids); + break; + case AttrTableTypeNode: + deleteAttributesFromTable(d_types, ids); + break; + case AttrTableString: + deleteAttributesFromTable(d_strings, ids); + break; + case AttrTablePointer: + deleteAttributesFromTable(d_ptrs, ids); + break; + + case AttrTableCDBool: + case AttrTableCDUInt64: + case AttrTableCDTNode: + case AttrTableCDNode: + case AttrTableCDString: + case AttrTableCDPointer: + Unimplemented("CDAttributes cannot be deleted. Contact Tim/Morgan if this behaviour is desired."); + break; + case LastAttrTable: + default: + Unreachable(); + } + } +} + }/* CVC4::expr::attr namespace */ }/* CVC4::expr namespace */ }/* CVC4 namespace */ |