public class PDOM extends PlatformObject implements IPDOM
Modifier and Type | Class and Description |
---|---|
static class |
PDOM.ChangeEvent |
static interface |
PDOM.IListener |
Modifier and Type | Field and Description |
---|---|
protected Database |
db |
static int |
END |
protected PDOM.ChangeEvent |
fEvent |
static int |
FILE_INDEX |
static java.lang.String |
FRAGMENT_PROPERTY_VALUE_FORMAT_ID
Identifier for PDOM format
|
static int |
INDEX_OF_DEFECTIVE_FILES |
static int |
INDEX_OF_FILES_WITH_UNRESOLVED_INCLUDES |
static int |
LINKAGES |
static int |
PROPERTIES |
static int |
TAG_INDEX |
FIND_ALL_OCCURRENCES, FIND_DECLARATIONS, FIND_DECLARATIONS_DEFINITIONS, FIND_DEFINITIONS, FIND_NON_LOCAL_ONLY, FIND_REFERENCES, PROPERTY_FRAGMENT_FORMAT_ID, PROPERTY_FRAGMENT_FORMAT_VERSION, PROPERTY_FRAGMENT_ID, PROPERTY_RESUME_INDEXER, SEARCH_ACROSS_LANGUAGE_BOUNDARIES
Constructor and Description |
---|
PDOM(java.io.File dbPath,
IIndexLocationConverter locationConverter,
ChunkCache cache,
java.util.Map<java.lang.String,IPDOMLinkageFactory> linkageFactoryMappings) |
PDOM(java.io.File dbPath,
IIndexLocationConverter locationConverter,
java.util.Map<java.lang.String,IPDOMLinkageFactory> linkageFactoryMappings) |
Modifier and Type | Method and Description |
---|---|
void |
accept(IPDOMVisitor visitor) |
void |
acquireReadLock()
Acquires a read lock.
|
void |
acquireWriteLock(int giveupReadLocks,
IProgressMonitor monitor)
Acquire a write lock on this PDOM, giving up the specified number of read locks first.
|
void |
acquireWriteLock(IProgressMonitor monitor)
Acquire a write lock on this PDOM.
|
IIndexFragmentBinding |
adaptBinding(IBinding binding)
Looks for a binding matching the given one.
|
protected PDOMLinkage |
adaptLinkage(ILinkage linkage) |
protected IIndexFragmentFile |
addFile(int linkageID,
IIndexFileLocation location,
ISignificantMacros sigMacros) |
void |
addListener(PDOM.IListener listener) |
void |
adjustThreadForReadLock(java.util.Map<java.lang.Thread,org.eclipse.cdt.internal.core.pdom.PDOM.DebugLockInfo> lockDebugging) |
protected void |
clear() |
protected void |
clearFileIndex() |
void |
clearResultCache()
Clears the result cache.
|
void |
close() |
IIndexFragmentFileSet |
createFileSet()
Creates an empty file set for this fragment
|
java.lang.String |
createKeyForCache(long record,
char[] name) |
protected PDOMLinkage |
createLinkage(int linkageID) |
IIndexFragmentBinding |
findBinding(IASTName name)
Looks for a binding of the given name from the AST.
|
IIndexFragmentBinding |
findBinding(IIndexFragmentName indexName) |
IIndexFragmentBinding[] |
findBindings(char[][] names,
boolean caseSensitive,
IndexFilter filter,
IProgressMonitor monitor) |
IIndexFragmentBinding[] |
findBindings(char[][] names,
IndexFilter filter,
IProgressMonitor monitor)
Searches for all bindings with qualified names that seen as an array of simple names equals
the given array of names.
|
IIndexFragmentBinding[] |
findBindings(char[] name,
boolean filescope,
boolean isCaseSensitive,
IndexFilter filter,
IProgressMonitor monitor) |
IIndexFragmentBinding[] |
findBindings(char[] name,
boolean filescope,
IndexFilter filter,
IProgressMonitor monitor)
Returns all bindings with the given name, accepted by the given filter
|
IIndexFragmentBinding[] |
findBindings(java.util.regex.Pattern[] patterns,
boolean isFullyQualified,
IndexFilter filter,
IProgressMonitor monitor)
Searches for all bindings with qualified names that seen as an array of simple names match
the given array of patterns.
|
IIndexBinding[] |
findBindings(java.util.regex.Pattern pattern,
boolean isFullyQualified,
IndexFilter filter,
IProgressMonitor monitor) |
IIndexFragmentBinding[] |
findBindingsForContentAssist(char[] prefix,
boolean filescope,
IndexFilter filter,
IProgressMonitor monitor)
Returns all bindings that would be a valid completion for the given text.
|
IIndexFragmentBinding[] |
findBindingsForPrefix(char[] prefix,
boolean filescope,
boolean caseSensitive,
IndexFilter filter,
IProgressMonitor monitor) |
IIndexFragmentBinding[] |
findBindingsForPrefix(char[] prefix,
boolean filescope,
IndexFilter filter,
IProgressMonitor monitor)
Returns all bindings with the given prefix, accepted by the given filter
|
IIndexFragmentInclude[] |
findIncludedBy(IIndexFragmentFile file)
Returns all include directives that point to the given file.
|
IIndexFragmentBinding[] |
findMacroContainers(char[] prefix,
boolean isPrefix,
boolean isCaseSensitive,
IndexFilter filter,
IProgressMonitor monitor) |
IIndexFragmentBinding[] |
findMacroContainers(java.util.regex.Pattern pattern,
IndexFilter filter,
IProgressMonitor monitor)
Searches for all macro containers (one for macros with the same name) with names that
match the given pattern.
|
IIndexMacro[] |
findMacros(char[] prefix,
boolean isPrefix,
boolean isCaseSensitive,
IndexFilter filter,
IProgressMonitor monitor)
Returns all macros with the given prefix or name, accepted by the given filter
|
IIndexFragmentName[] |
findNames(IBinding binding,
int options)
Searches for all names that resolve to the given binding.
|
protected void |
flush() |
IIndexFragmentFile[] |
getAllFiles() |
java.lang.Object |
getCachedResult(java.lang.Object key)
Returns a previously cached object, the cache is cleared at latest when the fragment no
longer holds a locks.
|
long |
getCacheHits()
Returns cache hits since last reset of counters.
|
long |
getCacheMisses()
Returns cache misses since last reset of counters.
|
Database |
getDB() |
IRecordIterator |
getDeclarationsDefintitionsRecordIterator(IIndexBinding binding) |
static int |
getDefaultVersion()
Returns the version that shall be used when creating new databases.
|
IIndexFragmentFile[] |
getDefectiveFiles() |
PDOMFile |
getFile(int linkageID,
IIndexFileLocation location)
Deprecated.
|
PDOMFile |
getFile(int linkageID,
IIndexFileLocation location,
ISignificantMacros macroDictionary)
Returns the file for the given location, linkage, and a set of macro definitions.
|
PDOMFile |
getFile(PDOMLinkage linkage,
IIndexFileLocation location,
ISignificantMacros macroDictionary) |
BTree |
getFileIndex() |
IIndexFragmentFile[] |
getFiles(IIndexFileLocation location)
Returns the files in all linkages for the given location.
|
IIndexFragmentFile[] |
getFiles(int linkageID,
IIndexFileLocation location)
Returns the files for the given location and linkage.
|
IIndexFragmentFile[] |
getFilesWithUnresolvedIncludes() |
BTree |
getIndexOfDefectiveFiles()
Returns the index of files that were read with I/O errors.
|
BTree |
getIndexOfFilesWithUnresolvedIncludes()
Returns the index of files containing unresolved includes.
|
IIndexScope[] |
getInlineNamespaces()
Returns the global inline namespaces.
|
long |
getLastReadAccess() |
long |
getLastWriteAccess()
Returns the timestamp of the last modification to the index.
|
PDOMLinkage |
getLinkage(int linkageID) |
PDOMLinkage[] |
getLinkageImpls() |
IIndexLinkage[] |
getLinkages()
Returns the linkages that are contained in this fragment
|
IIndexLocationConverter |
getLocationConverter() |
static int |
getMaxSupportedVersion() |
static int |
getMinSupportedVersion() |
java.io.File |
getPath() |
java.lang.String |
getProperty(java.lang.String propertyName)
Read the named property in this fragment.
|
PDOMTagIndex |
getTagIndex() |
boolean |
hasLastingDefinition(PDOMBinding binding) |
boolean |
hasWaitingReaders() |
void |
insertLinkage(PDOMLinkage linkage) |
protected boolean |
isCommitted(PDOMMacro name) |
protected boolean |
isCommitted(PDOMMacroReferenceName name) |
protected boolean |
isCommitted(PDOMName name) |
boolean |
isEmpty() |
boolean |
isFullyInitialized()
Returns
true if the index fragment is fully initialized. |
protected boolean |
isPermanentlyReadOnly()
Returns whether this PDOM can never be written to.
|
boolean |
isSupportedVersion() |
static boolean |
isSupportedVersion(int vers) |
void |
putCachedResult(java.lang.Object key,
java.lang.Object result) |
java.lang.Object |
putCachedResult(java.lang.Object key,
java.lang.Object result,
boolean replace)
Caches an object with the key, the cache must be cleared at latest when the fragment no
longer holds a locks.
|
void |
releaseReadLock()
Releases a read lock.
|
void |
releaseWriteLock() |
void |
releaseWriteLock(int establishReadLocks,
boolean flush) |
void |
removeCachedResult(java.lang.Object key) |
void |
removeListener(PDOM.IListener listener) |
void |
resetCacheCounters()
Resets the counters for cache-hits and cache-misses.
|
static java.lang.String |
versionString(int version) |
public static final java.lang.String FRAGMENT_PROPERTY_VALUE_FORMAT_ID
public static final int LINKAGES
public static final int FILE_INDEX
public static final int INDEX_OF_DEFECTIVE_FILES
public static final int INDEX_OF_FILES_WITH_UNRESOLVED_INCLUDES
public static final int PROPERTIES
public static final int TAG_INDEX
public static final int END
protected Database db
protected PDOM.ChangeEvent fEvent
public PDOM(java.io.File dbPath, IIndexLocationConverter locationConverter, java.util.Map<java.lang.String,IPDOMLinkageFactory> linkageFactoryMappings) throws CoreException
CoreException
public PDOM(java.io.File dbPath, IIndexLocationConverter locationConverter, ChunkCache cache, java.util.Map<java.lang.String,IPDOMLinkageFactory> linkageFactoryMappings) throws CoreException
CoreException
public static int getDefaultVersion()
public static boolean isSupportedVersion(int vers)
public static int getMinSupportedVersion()
public static int getMaxSupportedVersion()
public static java.lang.String versionString(int version)
protected boolean isPermanentlyReadOnly()
public IIndexLocationConverter getLocationConverter()
public boolean isSupportedVersion() throws CoreException
CoreException
protected PDOMLinkage createLinkage(int linkageID) throws CoreException
CoreException
public PDOMLinkage getLinkage(int linkageID) throws CoreException
CoreException
public void accept(IPDOMVisitor visitor) throws CoreException
CoreException
public void addListener(PDOM.IListener listener)
addListener
in interface IPDOM
public void removeListener(PDOM.IListener listener)
removeListener
in interface IPDOM
public Database getDB()
public BTree getFileIndex() throws CoreException
CoreException
public PDOMTagIndex getTagIndex() throws CoreException
CoreException
public BTree getIndexOfDefectiveFiles() throws CoreException
CoreException
public BTree getIndexOfFilesWithUnresolvedIncludes() throws CoreException
CoreException
@Deprecated public PDOMFile getFile(int linkageID, IIndexFileLocation location) throws CoreException
getFile
in interface IIndexFragment
CoreException
public PDOMFile getFile(int linkageID, IIndexFileLocation location, ISignificantMacros macroDictionary) throws CoreException
IIndexFragment
null
, if no such file exists.
This method may only return files that are actually managed by this fragment.
This method returns files without content, also.getFile
in interface IIndexFragment
linkageID
- the id of the linkage in which the file has been parsed.location
- the IIndexFileLocation representing the location of the filenull
if the file is not present in
the indexCoreException
public PDOMFile getFile(PDOMLinkage linkage, IIndexFileLocation location, ISignificantMacros macroDictionary) throws CoreException
CoreException
public IIndexFragmentFile[] getFiles(int linkageID, IIndexFileLocation location) throws CoreException
IIndexFragment
getFiles
in interface IIndexFragment
linkageID
- the id of the linkage in which the file has been parsed.location
- the IIndexFileLocation representing the location of the fileCoreException
public IIndexFragmentFile[] getFiles(IIndexFileLocation location) throws CoreException
IIndexFragment
getFiles
in interface IIndexFragment
location
- the IIndexFileLocation representing the location of the filenull
if the file is not present in
the indexCoreException
public IIndexFragmentFile[] getAllFiles() throws CoreException
getAllFiles
in interface IIndexFragment
CoreException
public IIndexFragmentFile[] getDefectiveFiles() throws CoreException
getDefectiveFiles
in interface IIndexFragment
CoreException
public IIndexFragmentFile[] getFilesWithUnresolvedIncludes() throws CoreException
getFilesWithUnresolvedIncludes
in interface IIndexFragment
CoreException
protected IIndexFragmentFile addFile(int linkageID, IIndexFileLocation location, ISignificantMacros sigMacros) throws CoreException
CoreException
protected void clearFileIndex() throws CoreException
CoreException
protected void clear() throws CoreException
CoreException
public boolean isEmpty() throws CoreException
CoreException
public IIndexFragmentBinding findBinding(IASTName name) throws CoreException
IIndexFragment
null
, if no
such binding exists.findBinding
in interface IIndexFragment
name
- the name for looking up the bindingnull
CoreException
public IIndexBinding[] findBindings(java.util.regex.Pattern pattern, boolean isFullyQualified, IndexFilter filter, IProgressMonitor monitor) throws CoreException
CoreException
public IIndexFragmentBinding[] findBindings(java.util.regex.Pattern[] patterns, boolean isFullyQualified, IndexFilter filter, IProgressMonitor monitor) throws CoreException
IIndexFragment
findBindings
in interface IIndexFragment
patterns
- an array of patterns the names of the qualified name of the bindings have
to match.isFullyQualified
- if true
, the array of pattern specifies the fully
qualified namefilter
- a filter that allows for skipping parts of the indexmonitor
- a monitor to report progress, may be null
CoreException
public IIndexFragmentBinding[] findMacroContainers(java.util.regex.Pattern pattern, IndexFilter filter, IProgressMonitor monitor) throws CoreException
IIndexFragment
findMacroContainers
in interface IIndexFragment
pattern
- a pattern the name of the bindings have to match.filter
- a filter that allows for skipping parts of the indexmonitor
- a monitor to report progress, may be null
CoreException
public IIndexFragmentBinding[] findBindings(char[][] names, IndexFilter filter, IProgressMonitor monitor) throws CoreException
IIndexFragment
findBindings
in interface IIndexFragment
names
- an array of names the qualified name of the bindings have to match.filter
- a filter that allows for skipping parts of the indexmonitor
- a monitor to report progress, may be null
CoreException
public IIndexFragmentBinding[] findBindings(char[][] names, boolean caseSensitive, IndexFilter filter, IProgressMonitor monitor) throws CoreException
CoreException
public IIndexLinkage[] getLinkages()
IIndexFragment
getLinkages
in interface IIndexFragment
public PDOMLinkage[] getLinkageImpls()
getLinkageImpls
in interface IPDOM
public void insertLinkage(PDOMLinkage linkage) throws CoreException
CoreException
public void acquireReadLock() throws java.lang.InterruptedException
IIndexFragment
acquireReadLock
in interface IIndexFragment
java.lang.InterruptedException
public void releaseReadLock()
IIndexFragment
releaseReadLock
in interface IIndexFragment
public void acquireWriteLock(IProgressMonitor monitor) throws java.lang.InterruptedException
java.lang.InterruptedException
java.lang.IllegalStateException
- if this PDOM is not writablepublic void acquireWriteLock(int giveupReadLocks, IProgressMonitor monitor) throws java.lang.InterruptedException
java.lang.InterruptedException
java.lang.IllegalStateException
- if this PDOM is not writablepublic final void releaseWriteLock()
public void releaseWriteLock(int establishReadLocks, boolean flush)
public boolean hasWaitingReaders()
hasWaitingReaders
in interface IIndexFragment
true
if there are threads waiting for read locks.public long getLastWriteAccess()
IIndexFragment
getLastWriteAccess
in interface IIndexFragment
public long getLastReadAccess()
protected PDOMLinkage adaptLinkage(ILinkage linkage) throws CoreException
CoreException
public IIndexFragmentBinding adaptBinding(IBinding binding) throws CoreException
IIndexFragment
null
, if no
such binding exists. The binding may belong to an AST or another index fragment.adaptBinding
in interface IIndexFragment
binding
- the binding to look for.null
CoreException
public IIndexFragmentBinding findBinding(IIndexFragmentName indexName) throws CoreException
CoreException
public IIndexFragmentName[] findNames(IBinding binding, int options) throws CoreException
IIndexFragment
findNames
in interface IIndexFragment
binding
- a binding for which names are searched foroptions
- a combination of IIndexFragment.FIND_DECLARATIONS
, IIndexFragment.FIND_DEFINITIONS
,
IIndexFragment.FIND_REFERENCES
and IIndexFragment.FIND_NON_LOCAL_ONLY
CoreException
public IRecordIterator getDeclarationsDefintitionsRecordIterator(IIndexBinding binding) throws CoreException
CoreException
protected boolean isCommitted(PDOMName name) throws CoreException
CoreException
protected boolean isCommitted(PDOMMacro name) throws CoreException
CoreException
protected boolean isCommitted(PDOMMacroReferenceName name) throws CoreException
CoreException
public IIndexFragmentInclude[] findIncludedBy(IIndexFragmentFile file) throws CoreException
IIndexFragment
findIncludedBy
in interface IIndexFragment
file
- a file to search for includes pointing to itCoreException
public java.io.File getPath()
public IIndexFragmentBinding[] findBindingsForPrefix(char[] prefix, boolean filescope, IndexFilter filter, IProgressMonitor monitor) throws CoreException
IIndexFragment
findBindingsForPrefix
in interface IIndexFragment
monitor
- to report progress, may be null
CoreException
public IIndexFragmentBinding[] findBindingsForPrefix(char[] prefix, boolean filescope, boolean caseSensitive, IndexFilter filter, IProgressMonitor monitor) throws CoreException
CoreException
public IIndexFragmentBinding[] findBindingsForContentAssist(char[] prefix, boolean filescope, IndexFilter filter, IProgressMonitor monitor) throws CoreException
IIndexFragment
findBindingsForContentAssist
in interface IIndexFragment
monitor
- to report progress, may be null
CoreException
public IIndexFragmentBinding[] findBindings(char[] name, boolean filescope, IndexFilter filter, IProgressMonitor monitor) throws CoreException
IIndexFragment
findBindings
in interface IIndexFragment
monitor
- to report progress, may be null
CoreException
public IIndexFragmentBinding[] findBindings(char[] name, boolean filescope, boolean isCaseSensitive, IndexFilter filter, IProgressMonitor monitor) throws CoreException
CoreException
public IIndexFragmentBinding[] findMacroContainers(char[] prefix, boolean isPrefix, boolean isCaseSensitive, IndexFilter filter, IProgressMonitor monitor) throws CoreException
CoreException
public IIndexMacro[] findMacros(char[] prefix, boolean isPrefix, boolean isCaseSensitive, IndexFilter filter, IProgressMonitor monitor) throws CoreException
IIndexFragment
findMacros
in interface IIndexFragment
monitor
- to report progress, may be null
CoreException
public java.lang.String getProperty(java.lang.String propertyName) throws CoreException
IIndexFragment
getProperty
in interface IIndexFragment
propertyName
- a case-sensitive identifier for a property, or nullCoreException
IIndexFragment.PROPERTY_FRAGMENT_ID
,
IIndexFragment.PROPERTY_FRAGMENT_FORMAT_ID
,
IIndexFragment.PROPERTY_FRAGMENT_FORMAT_VERSION
public void close() throws CoreException
CoreException
public void clearResultCache()
IIndexFragment
clearResultCache
in interface IIndexFragment
public long getCacheHits()
IIndexFragment
getCacheHits
in interface IIndexFragment
public long getCacheMisses()
IIndexFragment
getCacheMisses
in interface IIndexFragment
public void resetCacheCounters()
IIndexFragment
resetCacheCounters
in interface IIndexFragment
protected void flush() throws CoreException
CoreException
public java.lang.Object getCachedResult(java.lang.Object key)
IIndexFragment
getCachedResult
in interface IIndexFragment
public void putCachedResult(java.lang.Object key, java.lang.Object result)
public java.lang.Object putCachedResult(java.lang.Object key, java.lang.Object result, boolean replace)
IIndexFragment
putCachedResult
in interface IIndexFragment
replace
- if false
an existing entry will not be replaced.public void removeCachedResult(java.lang.Object key)
public java.lang.String createKeyForCache(long record, char[] name)
public boolean hasLastingDefinition(PDOMBinding binding) throws CoreException
CoreException
public IIndexFragmentFileSet createFileSet()
IIndexFragment
createFileSet
in interface IIndexFragment
public void adjustThreadForReadLock(java.util.Map<java.lang.Thread,org.eclipse.cdt.internal.core.pdom.PDOM.DebugLockInfo> lockDebugging)
public IIndexScope[] getInlineNamespaces() throws CoreException
IIndexFragment
getInlineNamespaces
in interface IIndexFragment
CoreException
public boolean isFullyInitialized()
IIndexFragment
true
if the index fragment is fully initialized. An fragment may not be fully
initialized during Eclipse startup, or soon after adding a new project to the workspace.isFullyInitialized
in interface IIndexFragment