BadgerDB
 All Classes Namespaces Functions Variables Typedefs Friends
Public Member Functions | Protected Attributes | Friends
badgerdb::InvalidSlotException Class Reference

An exception that is thrown when a slot that doesn't have data is requested from a page. More...

#include <invalid_slot_exception.h>

Inheritance diagram for badgerdb::InvalidSlotException:
badgerdb::BadgerDbException

List of all members.

Public Member Functions

 InvalidSlotException (const PageId page_num, const SlotId slot_num)
virtual PageId page_number () const
virtual SlotId slot_number () const
virtual const std::string & message () const
virtual const char * what () const throw ()

Protected Attributes

const PageId page_number_
const SlotId slot_number_
std::string message_

Friends

std::ostream & operator<< (std::ostream &out, const BadgerDbException &exception)

Detailed Description

An exception that is thrown when a slot that doesn't have data is requested from a page.

Definition at line 21 of file invalid_slot_exception.h.


Constructor & Destructor Documentation

badgerdb::InvalidSlotException::InvalidSlotException ( const PageId  page_num,
const SlotId  slot_num 
)

Constructs an invalid slot exception for the given page and slot.

Parameters:
page_numNumber of page containing slot.
slot_numNumber of slot which is invalid.

Definition at line 15 of file invalid_slot_exception.cpp.

    : BadgerDbException(""),
      page_number_(page_num),
      slot_number_(slot_num) {
  std::stringstream ss;
  ss << "Attempt to access a slot which is not currently in use."
     << " Page: " << page_number_ << " Slot: " << slot_number_;
  message_.assign(ss.str());
}

Member Function Documentation

virtual const std::string& badgerdb::BadgerDbException::message ( ) const [inline, virtual, inherited]

Returns a message describing the problem that caused this exception.

Returns:
Message describing the problem that caused this exception.

Definition at line 38 of file badgerdb_exception.h.

{ return message_; }
virtual PageId badgerdb::InvalidSlotException::page_number ( ) const [inline, virtual]

Returns the page number of the page containing the slot which caused this exception.

Definition at line 35 of file invalid_slot_exception.h.

{ return page_number_; }
virtual SlotId badgerdb::InvalidSlotException::slot_number ( ) const [inline, virtual]

Returns the slot number of the slot which caused this exception.

Definition at line 40 of file invalid_slot_exception.h.

{ return slot_number_; }
virtual const char* badgerdb::BadgerDbException::what ( ) const throw () [inline, virtual, inherited]

Returns a description of the exception.

Returns:
Description of the exception.

Definition at line 45 of file badgerdb_exception.h.

{ return message_.c_str(); }

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  out,
const BadgerDbException exception 
) [friend, inherited]

Formats this exception for printing on the given stream.

Parameters:
outStream to print exception to.
exceptionException to print.
Returns:
Stream with exception printed.

Definition at line 54 of file badgerdb_exception.h.

                                                                      {
    out << exception.message();
    return out;
  }

Member Data Documentation

std::string badgerdb::BadgerDbException::message_ [protected, inherited]

Message describing the problem that caused this exception.

Definition at line 64 of file badgerdb_exception.h.

Page number of the page containing the slot which caused this exception.

Definition at line 46 of file invalid_slot_exception.h.

Slot number of the slot which caused this exception.

Definition at line 51 of file invalid_slot_exception.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Friends