WiscDB
bufferHashTable.cpp
00001 
00008 #include <memory>
00009 #include <iostream>
00010 #include "buffer.h"
00011 #include "bufferHashTable.h"
00012 #include "exceptions/hash_already_present_exception.h"
00013 #include "exceptions/hash_not_found_exception.h"
00014 #include "exceptions/hash_table_exception.h"
00015 
00016 namespace wiscdb {
00017 
00018 int BufferHashTable::hash(const File* file, const PageId pageNo){
00019   int tmp, value;
00020   tmp = (long)file;  // cast of pointer to the file object to an integer
00021   value = (tmp + pageNo) % HTSIZE;
00022   return value;
00023 }
00024 
00025 BufferHashTable::BufferHashTable(const int htSize) {
00026   SIZE = htSize;
00027   // allocate an array of pointers to HashItems
00028   table = new HashItem* [htSize];
00029   for(int i=0; i < SIZE; i++)
00030     table[i] = NULL;
00031 }
00032 
00033 BufferHashTable::~BufferHashTable(){
00034 }
00035 
00036 void BufferHashTable::insert(const File* file, const PageId pageNo, 
00037                              const FrameId frameNo){
00038 }
00039 
00040 void BufferHashTable::lookup(const File* file, const PageId pageNo, 
00041                              FrameId &frameNo) {
00042 }
00043 
00044 void BufferHashTable::remove(const File* file, const PageId pageNo) {
00045 }
00046 
00047 }
 All Classes Functions Variables Friends