XCube Stream Reader SDK
 All Classes Files Functions Variables Typedefs Friends Defines
Public Types | Public Member Functions
x3c::indexer::CIndexer< IndexPolicy > Class Template Reference

#include <CIndexer.h>

List of all members.

Public Types

typedef std::map< std::string,
IndexPolicy * > 
IndexerMap
typedef std::map< std::string,
IndexPolicy * >::iterator 
IndexerIter
typedef std::map< std::string,
IndexPolicy * >
::const_iterator 
ConstIndexerIter

Public Member Functions

 CIndexer (UINT32 numFiles, UINT32 reservedMem=THIRTYTWO_MB)
 ~CIndexer ()
IndexPolicy * getIndexer (std::string const &filename)
std::string getOffsetFromTime (UINT64 ts, UINT64 *offset) const
std::string getOffsetFromTime (struct timespec ts, UINT64 *offset) const
void closeIndexFiles ()
UINT32 numFiles () const
void numFiles (UINT32 nFiles)
void timeZone (INT32 gmt_offset)
INT32 timeZone () const

Detailed Description

template<class IndexPolicy>
class x3c::indexer::CIndexer< IndexPolicy >

This class provides functionality for writing and reading index files. Index files are used for fast searches over stream data that has been written to disk.


Constructor & Destructor Documentation

template<class IndexPolicy >
x3c::indexer::CIndexer< IndexPolicy >::CIndexer ( UINT32  numFiles,
UINT32  reservedMem = THIRTYTWO_MB 
) [explicit]

Constructor

template<class IndexPolicy >
x3c::indexer::CIndexer< IndexPolicy >::~CIndexer ( )

Destructor. Closes index files and free's the indexers


Member Function Documentation

template<class IndexPolicy >
void x3c::indexer::CIndexer< IndexPolicy >::closeIndexFiles ( )

Closes the index files. Note does not free the indexers.

template<class IndexPolicy >
IndexPolicy * x3c::indexer::CIndexer< IndexPolicy >::getIndexer ( std::string const &  filename)

Gets an indexer for an index file. Ownership of the retured index is not transfered to the caller.

Parameters:
filenamethe full path to the index file to be opened for reading.
Returns:
A ponter to the IndexPolicy for the file
template<class IndexPolicy >
std::string x3c::indexer::CIndexer< IndexPolicy >::getOffsetFromTime ( UINT64  ts,
UINT64 *  offset 
) const

returns the filename and offset for the first index record that is greater than the timestamp

Parameters:
tsthe timestamp to search for
offsetthe address of the buffer to store the file offset into
Returns:
On success a string containing the file name of the file containing the index found. If the timestamp is not found then an empty string is returned and offset will contain -1
template<class IndexPolicy >
std::string x3c::indexer::CIndexer< IndexPolicy >::getOffsetFromTime ( struct timespec  ts,
UINT64 *  offset 
) const

returns the filename and offset for the first index record that is greater than the timestamp

Parameters:
tsthe struct timespec timestamp to search for
offsetthe address of the buffer to store the file offset into
Returns:
On success a string containing the file name of the file containing the index found. If the timestamp is not found then an empty string is returned and offset will contain -1
template<class IndexPolicy >
UINT32 x3c::indexer::CIndexer< IndexPolicy >::numFiles ( ) const [inline]

Returns the number of files the Indexer is managing.

template<class IndexPolicy >
void x3c::indexer::CIndexer< IndexPolicy >::numFiles ( UINT32  nFiles) [inline]

Sets the number of files the Indexer is managing.

template<class IndexPolicy >
void x3c::indexer::CIndexer< IndexPolicy >::timeZone ( INT32  gmt_offset) [inline]

Set the offset from GMT.

Parameters:
gmt_offsetThe offset in seconds (+/-) from GMT

TODO: sanity check gmt_offset?

template<class IndexPolicy >
INT32 x3c::indexer::CIndexer< IndexPolicy >::timeZone ( ) const [inline]

Return the offset from GMT for this indexer


The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Typedefs Friends Defines