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

An exception that is thrown when a record is requested from a page that has a bad record ID. More...

#include <invalid_record_exception.h>

Inheritance diagram for badgerdb::InvalidRecordException:
badgerdb::BadgerDbException

List of all members.

Public Member Functions

 InvalidRecordException (const RecordId &rec_id, const PageId page_num)
virtual const RecordIdrecord_id () const
virtual PageId page_number () const
virtual const std::string & message () const
virtual const char * what () const throw ()

Protected Attributes

const RecordId record_id_
const PageId page_number_
std::string message_

Friends

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

Detailed Description

An exception that is thrown when a record is requested from a page that has a bad record ID.

Definition at line 21 of file invalid_record_exception.h.


Constructor & Destructor Documentation

Constructs an invalid record exception for the given requested record ID and page number.

Parameters:
rec_idRequested record ID.
page_numPage from which record is requested.

Definition at line 15 of file invalid_record_exception.cpp.

    : BadgerDbException(""),
      record_id_(rec_id),
      page_number_(page_num) {
  std::stringstream ss;
  ss << "Request made for an invalid record."
     << " Record {page=" << record_id_.page_number
     << ", slot=" << record_id_.slot_number
     << "} from page " << page_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::InvalidRecordException::page_number ( ) const [inline, virtual]

Returns the page number of the page that caused this exception.

Definition at line 41 of file invalid_record_exception.h.

{ return page_number_; }
virtual const RecordId& badgerdb::InvalidRecordException::record_id ( ) const [inline, virtual]

Returns the requested record ID that caused this exception.

Definition at line 36 of file invalid_record_exception.h.

{ return record_id_; }
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 page which caused this exception.

Definition at line 52 of file invalid_record_exception.h.

Record ID which caused this exception.

Definition at line 47 of file invalid_record_exception.h.


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