CAcIFFileSystem Class

# CAcIFFileSystem Class Reference

[CADIHash.h Index] [CADIHash.h Hierarchy]

An accessor to an inverted file More...

`#include <../libInvertedFile/include/CAcIFFileSystem.h>`

Inherits: CAcInvertedFile

## Public Members

- bool operator() ()
- CAcIFFileSystem (const CXMLElement& inCollectionElement)
- bool init (bool)
- ~CAcIFFileSystem ()
- string IDToURL (TID inID)
- CDocumentFrequencyList* FeatureToList (TFeatureID)
- CDocumentFrequencyList* URLToFeatureList (string inURL)
- CDocumentFrequencyList* DIDToFeatureList (TID inDID)
- double FeatureToCollectionFrequency (TFeatureID)
- unsigned int getFeatureDescription (TID inFeatureID)
- double DIDToMaxDocumentFrequency (TID)
- double DIDToDFSquareSum (TID)
- double DIDToSquareDFLogICFSum (TID)
- bool generateInvertedFile ()
- bool newGenerateInvertedFile ()
- bool checkConsistency ()
- bool findWithinStream (TID inFeatureID, TID inDocumentID, double inDocumentFrequency)
- virtual pair<bool,TID> URLToID (const string& inURL)
- void getAllIDs (list<TID>&)
- /** List of triplets (ID,imageURL,thumbnailURL)
- void getRandomIDs (list<TID>&, list<TID>::size_type)
- void getRandomAccessorElements (list<CAccessorElement>& outResult, list<CAccessorElement>::size_type inSize)
- int size ()
- TID getMaximumFeatureID ()
- list<TID>* getAllFeatureIDs ()
- virtual pair<bool,CAccessorElement> IDToAccessorElement (TID inID)
- operator bool ()

## Protected Members

- TID mMaximumFeatureID
- mutable ifstream mOffsetFile
- ifstream mFeatureDescriptionFile
- string mInvertedFileName
- string mOffsetFileName
- string mFeatureDescriptionFileName
- CIDToOffset mIDToOffset
- CADIHash mDocumentInformation
- void writeOffsetFileElement (TID inFeatureID, int inPosition, ostream& inOpenOffsetFile)
- CDocumentFrequencyList* getFeatureFile (string inFileName)

## Detailed Description

An accessor to an inverted file. This access is done "by hand" at present this not really efficient, however we plan to move to memory mapped files.

## bool operator()()

for testing if the inverted file is correctly constructed

## CAcIFFileSystem(const CXMLElement& inCollectionElement)

This opens an exsisting inverted file, and then inits this structure. After that it is fully usable

As a paramter it takes an XMLElement which contains a "collection" element and its content.

If the attribute vi-generate-inverted-file is true, then a new inverted file will be generated using the parameters given in inCollectionElement. you will NOT be able to use *this afterwards.

The REAL constructor.

## bool init(bool)

called by constructors

## ~CAcIFFileSystem()

Destructor

## string IDToURL(TID inID)

Translate a DocumentID to a URL (for output)

## CDocumentFrequencyList* FeatureToList(TFeatureID)

List of documents containing the feature

## CDocumentFrequencyList* URLToFeatureList(string inURL)

List of features contained by a document

## CDocumentFrequencyList* DIDToFeatureList(TID inDID)

List of features contained by a document with ID inDID

## double FeatureToCollectionFrequency(TFeatureID)

Collection frequency for a given feature

## unsigned int getFeatureDescription(TID inFeatureID)

What kind of feature is the feature with ID inFeatureID?

## double DIDToMaxDocumentFrequency(TID)

returns the maximum document frequency for one document ID

## double DIDToDFSquareSum(TID)

Returns the document-frequency square sum for a given document ID

## double DIDToSquareDFLogICFSum(TID)

Returns this function for a given document ID

## bool generateInvertedFile()

Generating an inverted File, if there is none.Fast but stupid in-memory method. This method is very fast, if all the inverted file (and a bit more) can be kept in memory at runtime. If this is not the case, extensive swapping is the result, virtually halting the inverted file creation.

## bool newGenerateInvertedFile()

Generating an inverted File, if there is none. Employing the two-way-merge method described in "managing gigabytes", chapter 5.2. Sort-based inversion. (Page 181)

## bool checkConsistency()

Check the consistency of the inverted file system accessed

## bool findWithinStream(TID inFeatureID, TID inDocumentID, double inDocumentFrequency)

Is the Document with inDocumentID contained in the document frequency list of the feature inFeatureID and

## virtual pair<bool,TID> URLToID(const string& inURL)

Translate an URL to its document ID

## void getAllIDs(list<TID>&)

List of the IDs of all documents present in the inverted file

## void getRandomIDs(list<TID>&, list<TID>::size_type)

get a given number of random AccessorElement's

Parameters:

  inSize | the desired size of the inoutResultList
  inoutResultList | the list which will contain the result

## void getRandomAccessorElements(list<CAccessorElement.html">CAccessorElement>& outResult, list<CAccessorElement.html">CAccessorElement>::size_type inSize)

For drawing random sets. Why is this part of an CAccessorImplementation?The way the accessor is organised might influence the way random sets can be drawn. At present everything happens in RAM, but we do not want to be fixed on that.

Parameters:

  inSize | the desired size of the inoutResultList
  inoutResultList | the list which will contain the result

## int size()

The number of images in this accessor

## TID getMaximumFeatureID()

This is interesting for browsing

## list<TID>* getAllFeatureIDs()

Getting a list of all features contained in this.This function is necessary, because in the present system only about 50 percent of the features are really used.

A feature is considered used if it arises in mIDToOffset.

## virtual pair<bool,CAccessorElement> IDToAccessorElement(TID inID)

Translate a DocumentID to an accessor Element

## operator bool()

is this well constructed?

## TID mMaximumFeatureID

the maximum feature ID arising in this file

## mutable ifstream mOffsetFile

Feature -> Offset in inverted file

## ifstream mFeatureDescriptionFile

File of feature descriptions

## string mInvertedFileName

Name of the inverted file

## string mOffsetFileName

Name of the Offset file

## string mFeatureDescriptionFileName

Name for the file with the feature description

## CIDToOffset mIDToOffset

map from feature id to the offset for this feature

## CADIHash mDocumentInformation

additional information about the document like, e.g.the euclidean length of the feature list.

## void writeOffsetFileElement(TID inFeatureID, int inPosition, ostream& inOpenOffsetFile)

add a pair of FeatureID,Offset to the open offset file (helper function for inverted file construction)

## CDocumentFrequencyList* getFeatureFile(string inFileName)

loads a *.fts file. and returns the feature list

| Kdoc