public static void updateCache(IPDOMCPPClassType ct, PDOMNode member) throws CoreException { if (member instanceof PDOMBinding) { final Long key = ct.getRecord() + PDOMCPPLinkage.CACHE_MEMBERS; final PDOM pdom = ct.getPDOM(); @SuppressWarnings("unchecked") Reference<CharArrayObjectMap<List<PDOMBinding>>> cached = (Reference<CharArrayObjectMap<List<PDOMBinding>>>) pdom.getCachedResult(key); CharArrayObjectMap<List<PDOMBinding>> map = cached == null ? null : cached.get(); if (map != null) { new PopulateMap(map).visit(member); } } }
public static CharArrayObjectMap<List<PDOMBinding>> getBindingMap(IPDOMCPPClassType ct) throws CoreException { final Long key = ct.getRecord() + PDOMCPPLinkage.CACHE_MEMBERS; final PDOM pdom = ct.getPDOM(); @SuppressWarnings("unchecked") Reference<CharArrayObjectMap<List<PDOMBinding>>> cached = (Reference<CharArrayObjectMap<List<PDOMBinding>>>) pdom.getCachedResult(key); CharArrayObjectMap<List<PDOMBinding>> map = cached == null ? null : cached.get(); if (map == null) { // There is no cache, build it: map = new CharArrayObjectMap<>(8); IPDOMVisitor visitor = new PopulateMap(map); visitor.visit(ct); ct.acceptUncached(visitor); pdom.putCachedResult(key, new SoftReference<>(map)); } return map; }