BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
IteratorMemento Class Reference
Collaboration diagram for IteratorMemento:

Public Member Functions

 IteratorMemento ()
 
virtual ~IteratorMemento ()
 
void push_state (const IteratorState &state)
 
void pop_state ()
 
IteratorStateget_state ()
 
bool empty () const
 
void reset ()
 
const INodegetCurrent ()
 
void next ()
 
size_t size () const
 

Protected Attributes

std::stack< IteratorStatem_state_stack
 

Detailed Description

Holds all iterator states encountered for SampleTreeIterator.

Definition at line 55 of file NodeIterator.h.

Constructor & Destructor Documentation

◆ IteratorMemento()

IteratorMemento::IteratorMemento ( )
inline

Definition at line 58 of file NodeIterator.h.

58 {}

◆ ~IteratorMemento()

virtual IteratorMemento::~IteratorMemento ( )
inlinevirtual

Definition at line 59 of file NodeIterator.h.

59 {}

Member Function Documentation

◆ push_state()

void IteratorMemento::push_state ( const IteratorState state)
inline

Definition at line 61 of file NodeIterator.h.

61 { m_state_stack.push(state); }
std::stack< IteratorState > m_state_stack
Definition: NodeIterator.h:75

References m_state_stack.

Referenced by PreorderStrategy::first(), PostorderStrategy::first(), PreorderStrategy::next(), and PostorderStrategy::next().

◆ pop_state()

void IteratorMemento::pop_state ( )
inline

Definition at line 62 of file NodeIterator.h.

62 { m_state_stack.pop(); }

References m_state_stack.

Referenced by PreorderStrategy::next(), and PostorderStrategy::next().

◆ get_state()

IteratorState& IteratorMemento::get_state ( )
inline

Definition at line 63 of file NodeIterator.h.

63 { return m_state_stack.top(); }

References m_state_stack.

Referenced by PreorderStrategy::next(), and PostorderStrategy::next().

◆ empty()

bool IteratorMemento::empty ( ) const
inline

Definition at line 64 of file NodeIterator.h.

64 { return m_state_stack.empty(); }

References m_state_stack.

Referenced by PreorderStrategy::isDone(), PostorderStrategy::isDone(), and PreorderStrategy::next().

◆ reset()

void IteratorMemento::reset ( )
inline

Definition at line 65 of file NodeIterator.h.

66  {
67  while (!m_state_stack.empty())
68  m_state_stack.pop();
69  }

References m_state_stack.

◆ getCurrent()

const INode* IteratorMemento::getCurrent ( )
inline

Definition at line 70 of file NodeIterator.h.

70 { return m_state_stack.top().getCurrent(); }

References m_state_stack.

Referenced by PostorderStrategy::first(), PreorderStrategy::next(), and PostorderStrategy::next().

◆ next()

void IteratorMemento::next ( )
inline

Definition at line 71 of file NodeIterator.h.

71 { m_state_stack.top().next(); }

References m_state_stack.

Referenced by PreorderStrategy::next(), and PostorderStrategy::next().

◆ size()

size_t IteratorMemento::size ( ) const
inline

Definition at line 72 of file NodeIterator.h.

72 { return m_state_stack.size(); }

References m_state_stack.

Member Data Documentation

◆ m_state_stack

std::stack<IteratorState> IteratorMemento::m_state_stack
protected

Definition at line 75 of file NodeIterator.h.

Referenced by empty(), get_state(), getCurrent(), next(), pop_state(), push_state(), reset(), and size().


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