#ifndef MATRIXSTACK_H #define MATRIXSTACK_H #include "utils/Stack.h" #include "math/Matrix.h" template class MatrixStack final { Stack stack; public: MatrixStack() { stack.push(Matrix()); } bool pop() { stack.pop(); if(stack.isEmpty()) { stack.push(Matrix()); return true; } return false; } bool push() { return stack.push(stack.peek()); } Matrix& peek() { return stack.peek(); } const Matrix& peek() const { return stack.peek(); } void clear() { stack.clear(); stack.push(Matrix()); } template void toString(StringBuffer& s) const { s.append(stack); } }; #endif