1
/*******************************************************************************
2
* Copyright (c) 2005, 2009 IBM Corporation and others.
3
* All rights reserved. This program and the accompanying materials
4
* are made available under the terms of the Eclipse Public License v1.0
5
* which accompanies this distribution, and is available at
6
* http://www.eclipse.org/legal/epl-v10.html
9
* IBM Corporation - initial API and implementation
10
*******************************************************************************/
11
package org.eclipse.cdt.core.parser;
13
import java.io.IOException;
15
import org.eclipse.cdt.core.index.IIndexFileLocation;
16
import org.eclipse.core.runtime.CoreException;
19
* This is the interface to a cache for CodeReaders.
21
* For thread safety the implementations of this interface must ensure that their methods are thread safe.
23
* @noextend This interface is not intended to be extended by clients.
24
* @noimplement This interface is not intended to be implemented by clients.
26
public interface ICodeReaderCache {
29
* Retrieves the CodeReader corresponding to the key specified that represents the
30
* path for that CodeReader. If no CodeReader is found in the cache then a new CodeReader
31
* is created for the path and then returned.
33
* @param key the path corresponding to the CodeReader, generally:
34
* fileToParse.getLocation().toOSString()
35
* @return the CodeReader corresponding to the path specified by the key
37
public CodeReader get(String key);
40
* Retrieves the CodeReader corresponding to the key specified that represents the
41
* path for that CodeReader. If no CodeReader is found in the cache then a new CodeReader
42
* is created for the ifl and then returned.
44
* @param key the path corresponding to the CodeReader, generally:
45
* fileToParse.getLocation().toOSString()
46
* @return the CodeReader corresponding to the path specified by the key
48
* @throws CoreException
51
public CodeReader get(String key, IIndexFileLocation ifl) throws CoreException, IOException;
54
* Used to remove the CodeReader corresponding to the path specified by key from the cache.
56
* @param key the path of the CodeReader to be removed
57
* @return the removed CodeReader or null if not found
59
public CodeReader remove(String key);
62
* Returns the amount of space that the cache is using.
63
* The units are relative to the implementation of the cache. It could be
64
* the total number of objects in the cache, or the total space the cache is
67
public int getCurrentSpace();