SwatDB
exceptions.h
Go to the documentation of this file.
1 /*
2  * SwatDB
3  *
4  * @authors: See Contributors.doc for code contributors
5  *
6  * Copyright (c) 2020 Swarthmore College Computer Science Department
7  * Swarthmore PA, Professors Tia Newhall, Ameet Soni
8  */
9 
10 #pragma once
11 
16 #include <string>
17 #include <exception>
18 
19 #include <swatdb_types.h>
20 
27 class SwatDBException : virtual public std::exception {
28 
29  public:
30 
34  explicit SwatDBException(const std::string& msg): message(msg){ }
35 
39  virtual ~SwatDBException() throw() {}
40 
49  virtual const char* what() const throw() {
50  return message.c_str();
51  }
52 
53  protected:
54 
58  std::string message;
59 };
60 
61 
70 
71  public:
72 
78  explicit InvalidFileIdDiskMgr(FileId file_id);
79 
83  ~InvalidFileIdDiskMgr() throw() {}
84 
90  FileId getFileId() const throw();
91 
92  private:
93 
98 };
99 
104 
105  public:
106 
112  explicit InvalidPageNumDiskMgr(PageNum page_num);
113 
118 
124  PageNum getPageNum() const throw();
125 
126  private:
127 
132 
133 };
134 
140 
141  public:
142 
148  explicit InsufficientSpaceDiskMgr(FileId file_id);
149 
154 
160  FileId getFileId() const throw();
161 
162  private:
163 
168 };
169 
170 
175 
176  public:
177 
183  explicit FileAlreadyExistDiskMgr(const std::string& file);
184 
189 
193  std::string getFileName() const throw();
194 
195  private:
196 
200  std::string file_name;
201 };
202 
208 
209  public:
210 
216  explicit FileIdAlreadyExistDiskMgr(FileId file_id);
217 
222 
228  FileId getFileId() const throw();
229 
230  private:
231 
236 };
237 
238 
244 
245  public:
246 
250  explicit DiskErrorDiskMgr();
251 
255  ~DiskErrorDiskMgr() throw() {}
256 
257 };
258 
259 
268 
269  public:
270 
276  explicit InvalidPageIdBufMgr(PageId page_id);
277 
281  ~InvalidPageIdBufMgr() throw() {}
282 
288  PageId getPageId() const throw();
289 
290  private:
291 
296 };
297 
303 
304  public:
305 
311  explicit PageNotFoundBufMgr(PageId page_id);
312 
316  ~PageNotFoundBufMgr() throw() {}
317 
323  PageId getPageId() const throw();
324 
325  private:
326 
331 
332 };
333 
341 
342  public:
343 
349  explicit PageAlreadyLoadedBufMgr(PageId page_id);
350 
355 
361  PageId getPageId() const throw();
362 
363  private:
364 
369 
370 };
371 
376 
377  public:
378 
384  explicit PageNotPinnedBufMgr(PageId page_id);
385 
389  ~PageNotPinnedBufMgr() throw() {}
390 
396  PageId getPageId() const throw();
397 
398  private:
399 
404 
405 };
406 
411 
412  public:
413 
419  explicit PagePinnedBufMgr(PageId page_id);
420 
424  ~PagePinnedBufMgr() throw() {}
425 
431  PageId getPageId() const throw();
432 
433  private:
434 
439 
440 };
441 
442 
448 
449  public:
450 
454  explicit InsufficientSpaceBufMgr();
455 
460 
461 };
462 
472 
473  public:
474 
480  explicit InvalidFileTypeFileMgr(CatType file_type);
481 
486 
492  CatType getFileType() const throw();
493 
494  private:
495 
500 
501 };
502 
507 
508  public:
509 
513  explicit FileNotFoundFileMgr();
514 
518  ~FileNotFoundFileMgr() throw() {}
519 
520 };
521 
522 
523 
533 
534  public:
535 
541  explicit FileAlreadyExistCat(const std::string& filename);
542 
546  ~FileAlreadyExistCat() throw() {}
547 
553  std::string getFileName() const throw();
554 
555  private:
556 
560  std::string file_name;
561 };
562 
563 
569 
570  public:
571 
577  explicit NameAlreadyExistCat(const std::string& relname);
578 
582  ~NameAlreadyExistCat() throw() {}
583 
589  std::string getName() const throw();
590 
591  private:
592 
596  std::string name;
597 };
598 
599 
600 
605 
606  public:
607 
613  explicit InvalidFileIdCat(FileId file_id);
614 
618  ~InvalidFileIdCat() throw() {}
619 
625  FileId getFileId() const throw();
626 
627  private:
628 
633 };
634 
639 
640  public:
641 
647  explicit InvalidNameCat(const std::string& name);
648 
652  ~InvalidNameCat() throw() {}
653 
657  std::string getName() const throw();
658 
659  private:
660 
664  std::string name;
665 };
666 
675 
676  public:
677 
683  explicit InvalidSlotIdHeapPage(SlotId slot_id);
684 
689 
695  SlotId getSlotId() const throw();
696 
697  private:
698 
702  SlotId slot_id;
703 
704 };
705 
710 
711  public:
712 
716  explicit InsufficientSpaceHeapPage();
717 
722 
723 };
724 
725 
730 
731  public:
732 
736  explicit CorruptedDataHeapPage();
737 
742 
743 };
744 
750 
751  public:
752 
756  explicit EmptyDataHeapPage();
757 
761  ~EmptyDataHeapPage() throw() {}
762  };
763 
773 
774  public:
775 
781  explicit InvalidFileIdHeapFile(FileId file_id);
782 
787 
793  FileId getFileId() const throw();
794 
795  private:
796 
801 
802 };
803 
804 
810 
811  public:
812 
816  explicit InvalidSchemaHeapFile();
817 
822 
823 };
824 
830 
831  public:
832 
836  explicit InsufficientSpaceHeapFile();
837 
842 
843 };
844 
853 
854  public:
855 
859  explicit InvalidSizeData();
860 
864  ~InvalidSizeData() throw() {}
865 
866 };
~PagePinnedBufMgr()
Destructor.
Definition: exceptions.h:424
Definition: exceptions.h:471
~FileIdAlreadyExistDiskMgr()
Destructor.
Definition: exceptions.h:221
std::string file_name
Definition: exceptions.h:200
std::uint32_t PageNum
Definition: swatdb_types.h:34
std::string message
Definition: exceptions.h:58
~InsufficientSpaceHeapPage()
Destructor.
Definition: exceptions.h:721
CatType
Definition: swatdb_types.h:98
~InvalidPageIdBufMgr()
Destructor.
Definition: exceptions.h:281
~InvalidNameCat()
Destructor.
Definition: exceptions.h:652
~InvalidFileIdCat()
Destructor.
Definition: exceptions.h:618
~InvalidFileIdDiskMgr()
Destructor.
Definition: exceptions.h:83
~DiskErrorDiskMgr()
Destructor.
Definition: exceptions.h:255
CatType type
Definition: exceptions.h:499
Definition: exceptions.h:69
~InsufficientSpaceDiskMgr()
Destructor.
Definition: exceptions.h:153
Definition: exceptions.h:638
Definition: exceptions.h:674
~NameAlreadyExistCat()
Destructor.
Definition: exceptions.h:582
Definition: exceptions.h:410
Definition: exceptions.h:829
Definition: exceptions.h:852
~InvalidSlotIdHeapPage()
Destructor.
Definition: exceptions.h:688
~PageAlreadyLoadedBufMgr()
Destructor.
Definition: exceptions.h:354
Definition: exceptions.h:27
~InsufficientSpaceBufMgr()
Destructor.
Definition: exceptions.h:459
Definition: exceptions.h:302
Definition: exceptions.h:532
PageNum page_num
Definition: exceptions.h:131
Definition: exceptions.h:772
Definition: exceptions.h:207
~CorruptedDataHeapPage()
Destructor.
Definition: exceptions.h:741
FileId file_id
Definition: exceptions.h:167
~FileNotFoundFileMgr()
Destructor.
Definition: exceptions.h:518
FileId file_id
Definition: exceptions.h:632
Definition: exceptions.h:243
PageId page_id
Definition: exceptions.h:438
Definition: exceptions.h:174
~InvalidFileTypeFileMgr()
Destructor.
Definition: exceptions.h:485
Definition: exceptions.h:103
SlotId slot_id
Definition: exceptions.h:702
virtual const char * what() const
Returns the error message of the exception.
Definition: exceptions.h:49
Definition: exceptions.h:375
std::string name
Definition: exceptions.h:596
~InvalidPageNumDiskMgr()
Destructor.
Definition: exceptions.h:117
Definition: swatdb_types.h:50
Definition: exceptions.h:506
virtual ~SwatDBException()
Definition: exceptions.h:39
~PageNotFoundBufMgr()
Destructor.
Definition: exceptions.h:316
PageId page_id
Definition: exceptions.h:295
PageId page_id
Definition: exceptions.h:403
Definition: exceptions.h:749
FileId file_id
Definition: exceptions.h:97
~PageNotPinnedBufMgr()
Destructor.
Definition: exceptions.h:389
~FileAlreadyExistCat()
Destructor.
Definition: exceptions.h:546
std::string file_name
Definition: exceptions.h:560
std::string name
Definition: exceptions.h:664
PageId page_id
Definition: exceptions.h:368
~FileAlreadyExistDiskMgr()
Destructor.
Definition: exceptions.h:188
Definition: exceptions.h:729
~InvalidSchemaHeapFile()
Destructor.
Definition: exceptions.h:821
Definition: exceptions.h:139
Definition: exceptions.h:340
~EmptyDataHeapPage()
Destructor.
Definition: exceptions.h:761
SwatDBException(const std::string &msg)
Definition: exceptions.h:34
FileId file_id
Definition: exceptions.h:235
Definition: exceptions.h:604
~InsufficientSpaceHeapFile()
Destructor.
Definition: exceptions.h:841
Definition: exceptions.h:267
Definition: exceptions.h:568
~InvalidSizeData()
Destructor.
Definition: exceptions.h:864
std::uint32_t FileId
Definition: swatdb_types.h:29
Definition: exceptions.h:447
Definition: exceptions.h:709
Definition: exceptions.h:809
PageId page_id
Definition: exceptions.h:330
FileId file_id
Definition: exceptions.h:800
~InvalidFileIdHeapFile()
Destructor.
Definition: exceptions.h:786