muParser API -  1.35
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
Public Member Functions | List of all members
mu::ParserStack< TValueType > Class Template Reference

Parser stack implementation. More...

#include <muParserStack.h>

Public Member Functions

TValueType pop ()
 Pop a value from the stack. More...
 
void push (const TValueType &a_Val)
 Push an object into the stack. More...
 
unsigned size () const
 Return the number of stored elements.
 
bool empty () const
 Returns true if stack is empty false otherwise.
 
TValueType & top ()
 Return reference to the top object in the stack. More...
 

Detailed Description

template<typename TValueType>
class mu::ParserStack< TValueType >

Parser stack implementation.

Stack implementation based on a std::stack. The behaviour of pop() had been slightly changed in order to get an error code if the stack is empty. The stack is used within the Parser both as a value stack and as an operator stack.

Author
(C) 2004-2011 Ingo Berg

Definition at line 53 of file muParserStack.h.

Member Function Documentation

template<typename TValueType>
TValueType mu::ParserStack< TValueType >::pop ( )
inline

Pop a value from the stack.

Unlike the standard implementation this function will return the value that is going to be taken from the stack.

Exceptions
ParserExceptionin case the stack is empty.
See also
pop(int &a_iErrc)

Definition at line 82 of file muParserStack.h.

Referenced by mu::ParserByteCode::Finalize().

83  {
84  if (empty())
85  throw ParserError( _T("stack is empty.") );
86 
87  TValueType el = top();
88  m_Stack.pop();
89  return el;
90  }
#define _T(x)
Activate this option in order to compile with OpenMP support.
Definition: muParserDef.h:69
TValueType & top()
Return reference to the top object in the stack.
bool empty() const
Returns true if stack is empty false otherwise.
template<typename TValueType>
void mu::ParserStack< TValueType >::push ( const TValueType &  a_Val)
inline

Push an object into the stack.

Parameters
a_Valobject to push into the stack.
Exceptions
nothrow

Definition at line 97 of file muParserStack.h.

Referenced by mu::ParserByteCode::Finalize().

98  {
99  m_Stack.push(a_Val);
100  }
template<typename TValueType>
TValueType& mu::ParserStack< TValueType >::top ( )
inline

Return reference to the top object in the stack.

The top object is the one pushed most recently.

Definition at line 118 of file muParserStack.h.

Referenced by mu::ParserStack< TValueType >::pop().

119  {
120  return m_Stack.top();
121  }

The documentation for this class was generated from the following file: