Matrix3DStack.cpp 545 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #include "Matrix3DStack.h"
  2. #include "StackOverflow.h"
  3. #include "StackUnderflow.h"
  4. Matrix3DStack::Matrix3DStack()
  5. {
  6. }
  7. Matrix3DStack::Matrix3DStack(const Matrix3DStack& orig)
  8. {
  9. }
  10. Matrix3DStack::~Matrix3DStack()
  11. {
  12. }
  13. void Matrix3DStack::pop()
  14. {
  15. if(index <= 0)
  16. {
  17. throw StackUnderflow();
  18. }
  19. index--;
  20. }
  21. void Matrix3DStack::push()
  22. {
  23. if(index >= STACK_SIZE - 1)
  24. {
  25. throw StackOverflow();
  26. }
  27. index++;
  28. stack[index].set(stack[index - 1]);
  29. }
  30. Matrix3D& Matrix3DStack::get()
  31. {
  32. return stack[index];
  33. }