Shadowrun: Awakened 29 September 2011 - Build 871
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Attributes | Friends
cat::bombay::TableIndex Class Reference

#include <BombayTableIndex.hpp>

Inheritance diagram for cat::bombay::TableIndex:

List of all members.

Public Member Functions

CAT_INLINE u64 Complete (const void *data)
CAT_INLINE u64 Field (const void *data)
CAT_INLINE const char * GetFilePath ()
bool Initialize ()
void Insert (u64 hash, u64 offset)
CAT_INLINE void InsertComplete (const void *data, u64 offset)
CAT_INLINE void InsertField (const void *data, u64 offset)
CAT_INLINE void InsertVarField (const void *data, u32 bytes, u64 offset)
u64 Lookup (u64 hash)
CAT_INLINE u64 LookupComplete (const void *data)
CAT_INLINE u64 LookupField (const void *data)
CAT_INLINE u64 LookupVarField (const void *data, u32 bytes)
void Remove (u64 hash)
CAT_INLINE void RemoveComplete (const void *data)
CAT_INLINE void RemoveField (const void *data)
CAT_INLINE void RemoveVarField (const void *data, u32 bytes)
 TableIndex (Table *parent, const char *index_file_path, IHash *hash_function, ShutdownObserver *shutdown_observer)
CAT_INLINE u64 VarField (const void *data, u32 bytes)
 ~TableIndex ()

Protected Member Functions

bool AllocateTable ()
bool DoubleTable ()
void FreeTable ()
virtual bool OnRead (ThreadPoolLocalStorage *tls, int error, AsyncBuffer *buffer, u32 bytes)
void Save ()

Protected Attributes

char _file_path [MAX_PATH+1]
RWLock _lock
u64_table
u32 _table_elements
u32 _table_raw_bytes
u32 _used_elements

Static Protected Attributes

static const u64 COLLIDE_MASK = ~OFFSET_MASK
static const u32 COLLISION_INCREMENTER = 1017234223
static const u32 COLLISION_MULTIPLIER = 71*7487 * 4 + 1
static const u32 MIN_ELEMENTS = 1024
static const u64 OFFSET_MASK = (~(u64)0) >> 1
static const u64 TABLE_CHECK_HASH_SALT = 0x74B1301234DEADBE
static const u32 TABLE_FOOTER_BYTES = 16

Private Attributes

IHash_index_hash
TableIndex_next
TableIndex_next_loading
TableIndex_next_unique
Table_parent
ShutdownObserver_shutdown_observer

Friends

class Table

Detailed Description

Definition at line 111 of file BombayTableIndex.hpp.


Constructor & Destructor Documentation

cat::bombay::TableIndex::TableIndex ( Table parent,
const char *  index_file_path,
IHash hash_function,
ShutdownObserver shutdown_observer 
)
cat::bombay::TableIndex::~TableIndex ( )

Member Function Documentation

bool cat::bombay::TableIndex::AllocateTable ( ) [protected]
CAT_INLINE u64 cat::bombay::TableIndex::Complete ( const void *  data) [inline]

Definition at line 172 of file BombayTableIndex.hpp.

References _index_hash, and cat::bombay::IHash::HashComplete().

    {
        return _index_hash->HashComplete(data);
    }
bool cat::bombay::TableIndex::DoubleTable ( ) [protected]
CAT_INLINE u64 cat::bombay::TableIndex::Field ( const void *  data) [inline]

Definition at line 168 of file BombayTableIndex.hpp.

References _index_hash, and cat::bombay::IHash::HashField().

    {
        return _index_hash->HashField(data);
    }
void cat::bombay::TableIndex::FreeTable ( ) [protected]
CAT_INLINE const char* cat::bombay::TableIndex::GetFilePath ( ) [inline]

Reimplemented from cat::AsyncFile.

Definition at line 161 of file BombayTableIndex.hpp.

References _file_path.

{ return _file_path; }
bool cat::bombay::TableIndex::Initialize ( )
void cat::bombay::TableIndex::Insert ( u64  hash,
u64  offset 
)
CAT_INLINE void cat::bombay::TableIndex::InsertComplete ( const void *  data,
u64  offset 
) [inline]

Definition at line 206 of file BombayTableIndex.hpp.

References _index_hash, cat::bombay::IHash::HashComplete(), and Insert().

    {
        Insert(_index_hash->HashComplete(data), offset);
    }
CAT_INLINE void cat::bombay::TableIndex::InsertField ( const void *  data,
u64  offset 
) [inline]

Definition at line 202 of file BombayTableIndex.hpp.

References _index_hash, cat::bombay::IHash::HashField(), and Insert().

    {
        Insert(_index_hash->HashField(data), offset);
    }
CAT_INLINE void cat::bombay::TableIndex::InsertVarField ( const void *  data,
u32  bytes,
u64  offset 
) [inline]

Definition at line 198 of file BombayTableIndex.hpp.

References _index_hash, cat::bombay::IHash::HashVarField(), and Insert().

    {
        Insert(_index_hash->HashVarField(data, bytes), offset);
    }
u64 cat::bombay::TableIndex::Lookup ( u64  hash)
CAT_INLINE u64 cat::bombay::TableIndex::LookupComplete ( const void *  data) [inline]

Definition at line 192 of file BombayTableIndex.hpp.

References _index_hash, cat::bombay::IHash::HashComplete(), and Lookup().

    {
        return Lookup(_index_hash->HashComplete(data));
    }
CAT_INLINE u64 cat::bombay::TableIndex::LookupField ( const void *  data) [inline]

Definition at line 188 of file BombayTableIndex.hpp.

References _index_hash, cat::bombay::IHash::HashField(), and Lookup().

    {
        return Lookup(_index_hash->HashField(data));
    }
CAT_INLINE u64 cat::bombay::TableIndex::LookupVarField ( const void *  data,
u32  bytes 
) [inline]

Definition at line 184 of file BombayTableIndex.hpp.

References _index_hash, cat::bombay::IHash::HashVarField(), and Lookup().

    {
        return Lookup(_index_hash->HashVarField(data, bytes));
    }
virtual bool cat::bombay::TableIndex::OnRead ( ThreadPoolLocalStorage tls,
int  error,
AsyncBuffer buffer,
u32  bytes 
) [protected, virtual]
void cat::bombay::TableIndex::Remove ( u64  hash)
CAT_INLINE void cat::bombay::TableIndex::RemoveComplete ( const void *  data) [inline]

Definition at line 220 of file BombayTableIndex.hpp.

References _index_hash, cat::bombay::IHash::HashComplete(), and Remove().

    {
        Remove(_index_hash->HashComplete(data));
    }
CAT_INLINE void cat::bombay::TableIndex::RemoveField ( const void *  data) [inline]

Definition at line 216 of file BombayTableIndex.hpp.

References _index_hash, cat::bombay::IHash::HashField(), and Remove().

    {
        Remove(_index_hash->HashField(data));
    }
CAT_INLINE void cat::bombay::TableIndex::RemoveVarField ( const void *  data,
u32  bytes 
) [inline]

Definition at line 212 of file BombayTableIndex.hpp.

References _index_hash, cat::bombay::IHash::HashVarField(), and Remove().

    {
        Remove(_index_hash->HashVarField(data, bytes));
    }
void cat::bombay::TableIndex::Save ( ) [protected]
CAT_INLINE u64 cat::bombay::TableIndex::VarField ( const void *  data,
u32  bytes 
) [inline]

Definition at line 164 of file BombayTableIndex.hpp.

References _index_hash, and cat::bombay::IHash::HashVarField().

    {
        return _index_hash->HashVarField(data, bytes);
    }

Friends And Related Function Documentation

friend class Table [friend]

Definition at line 113 of file BombayTableIndex.hpp.


Member Data Documentation

char cat::bombay::TableIndex::_file_path[MAX_PATH+1] [protected]

Reimplemented from cat::AsyncFile.

Definition at line 141 of file BombayTableIndex.hpp.

Referenced by GetFilePath().

Definition at line 134 of file BombayTableIndex.hpp.

Definition at line 118 of file BombayTableIndex.hpp.

Definition at line 118 of file BombayTableIndex.hpp.

Definition at line 118 of file BombayTableIndex.hpp.

Definition at line 116 of file BombayTableIndex.hpp.

Definition at line 115 of file BombayTableIndex.hpp.

Definition at line 136 of file BombayTableIndex.hpp.

Definition at line 138 of file BombayTableIndex.hpp.

Definition at line 137 of file BombayTableIndex.hpp.

Definition at line 139 of file BombayTableIndex.hpp.

Definition at line 128 of file BombayTableIndex.hpp.

const u32 cat::bombay::TableIndex::COLLISION_INCREMENTER = 1017234223 [static, protected]

Definition at line 125 of file BombayTableIndex.hpp.

const u32 cat::bombay::TableIndex::COLLISION_MULTIPLIER = 71*7487 * 4 + 1 [static, protected]

Definition at line 124 of file BombayTableIndex.hpp.

const u32 cat::bombay::TableIndex::MIN_ELEMENTS = 1024 [static, protected]

Definition at line 129 of file BombayTableIndex.hpp.

const u64 cat::bombay::TableIndex::OFFSET_MASK = (~(u64)0) >> 1 [static, protected]

Definition at line 127 of file BombayTableIndex.hpp.

const u64 cat::bombay::TableIndex::TABLE_CHECK_HASH_SALT = 0x74B1301234DEADBE [static, protected]

Definition at line 132 of file BombayTableIndex.hpp.

const u32 cat::bombay::TableIndex::TABLE_FOOTER_BYTES = 16 [static, protected]

Definition at line 131 of file BombayTableIndex.hpp.


The documentation for this class was generated from the following file:

Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.

GNU Lesser General Public License 3 Sourceforge.net