Tanl Linguistic Pipeline

IXE::IndexTable< Entry > Class Template Reference

An instance of this class is used to access either the word, stop-word, file, or meta-name index portions of an index file. More...

#include <IndexTable.h>

List of all members.

Classes

class  const_iterator

Public Types

typedef Size size_type
typedef ptrdiff_t difference_type
typedef Entry value_type
typedef Entry * pointer
typedef Entry const * const_pointer
typedef Entry & reference
typedef Entry const & const_reference

Public Member Functions

 IndexTable (mappedFile const &file, index_id id)
 Prepare for accessing an index table beyond the column tables.
void access (mappedFile const &file, off32_t &offset)
 Prepare for accessing the mapped memory by setting variables to the proper positions within the index file.
size_type size () const
const_pointer operator[] (size_type i) const
 Get the entry at position.
const_iterator begin () const
const_iterator end () const
const_iterator position_at (size_type i) const

Protected Attributes

mappedFile::const_iterator begin_
size_type entries
Entry const * table

Friends

class IndexTable::const_iterator

Detailed Description

template<class Entry>
class IXE::IndexTable< Entry >

An instance of this class is used to access either the word, stop-word, file, or meta-name index portions of an index file.

The file layout is as follows:

Count num_entries; off32_t entry_offset[num_entries]; off32_t entries_size; (entries)

By implementing fully-blown random access iterators for it, the STL algorithms work, in particular binary_search() and equal_range() that are used to do look ups.


Constructor & Destructor Documentation

template<class Entry >
IXE::IndexTable< Entry >::IndexTable ( mappedFile const &  file,
index_id  id 
) [inline]

Prepare for accessing an index table beyond the column tables.

See also:
writeIndex() -- format of index file

References IXE::IndexTable< Entry >::access().


Member Function Documentation

template<class Entry>
void IXE::IndexTable< Entry >::access ( mappedFile const &  file,
off32_t &  offset 
) [inline]

Prepare for accessing the mapped memory by setting variables to the proper positions within the index file.

Advance the offset to past the index table, skipping the data: the size of data is stored just after the table.

Referenced by IXE::IndexTable< Entry >::IndexTable().

template<class Entry>
const_pointer IXE::IndexTable< Entry >::operator[] ( size_type  i  )  const [inline]

Get the entry at position.

Parameters:
i the position

Reimplemented in IXE::BigramTable, and IXE::StringTable.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
 
Copyright © 2005-2011 G. Attardi. Generated on 4 Mar 2011 by doxygen 1.6.1.