Detailed Description
/
class ExceptionStack : public BaseException {
protected:
vector<BaseException *> stack;
public:
ExceptionStack() {};
BaseException *add(BaseException *e)
{
stack.insert(stack.end(), e);
return this;
}
virtual ~ExceptionStack()
{for (size_t i=0;i<stack.size();i++) delete stack[i];}
///The print method that prints on stderr by default
virtual void print(ostream &out = cerr) {
for (unsigned int i=0;i<stack.size();i++)
stack[i]->print(out);
}
virtual void freeze()
{
for (unsigned int i=0;i<stack.size();i++)
stack[i]->freeze();
}
};
inline BaseException *BaseException::add(BaseException *e)
{
return (new ExceptionStack)->add(this)->add(e);
}
#endif