COPASI API  4.16.103
Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
CMath::CVariableStack Class Reference

#include <CMathEnum.h>

Collaboration diagram for CMath::CVariableStack:
Collaboration graph
[legend]

Public Types

typedef std::vector< StackElementBuffer
 
enum  Context { Variable, Body }
 
typedef std::vector< const
CEvaluationNode * > 
StackElement
 

Public Member Functions

 CVariableStack (Buffer &stack)
 
 CVariableStack (const CVariableStack &src)
 
const CEvaluationNodeoperator[] (const size_t &index) const
 
void pop ()
 
void push (const StackElement &stackElement)
 
size_t size () const
 
 ~CVariableStack ()
 

Private Member Functions

 CVariableStack ()
 

Private Attributes

size_t mBodyLevel
 
Context mContext
 
BuffermpStack
 
size_t mVariableLevel
 

Friends

std::ostream & operator<< (std::ostream &os, const CVariableStack &s)
 

Detailed Description

Definition at line 225 of file CMathEnum.h.

Member Typedef Documentation

Definition at line 229 of file CMathEnum.h.

typedef std::vector< const CEvaluationNode * > CMath::CVariableStack::StackElement

Definition at line 228 of file CMathEnum.h.

Member Enumeration Documentation

Enumerator
Variable 
Body 

Definition at line 233 of file CMathEnum.h.

Constructor & Destructor Documentation

CMath::CVariableStack::CVariableStack ( )
private

Definition at line 18 of file CMathEnum.cpp.

18  :
19  mpStack(NULL),
20  mContext(Body),
23 {}
#define C_INVALID_INDEX
Definition: copasi.h:222
CMath::CVariableStack::CVariableStack ( Buffer stack)

Definition at line 25 of file CMathEnum.cpp.

25  :
26  mpStack(&stack),
27  mContext(Body),
30 {}
#define C_INVALID_INDEX
Definition: copasi.h:222
CMath::CVariableStack::CVariableStack ( const CVariableStack src)

Definition at line 32 of file CMathEnum.cpp.

32  :
33  mpStack(src.mpStack),
34  mContext(src.mContext),
35  mVariableLevel(src.mVariableLevel),
36  mBodyLevel(src.mBodyLevel)
37 {}
CMath::CVariableStack::~CVariableStack ( )

Definition at line 39 of file CMathEnum.cpp.

40 {}

Member Function Documentation

const CEvaluationNode * CMath::CVariableStack::operator[] ( const size_t &  index) const

Definition at line 59 of file CMathEnum.cpp.

References C_INVALID_INDEX.

60 {
61  size_t Level = C_INVALID_INDEX;
62 
63  switch (mContext)
64  {
65  case Variable:
66  Level = mVariableLevel;
67  break;
68 
69  case Body:
70  Level = mBodyLevel;
71 
72  break;
73  }
74 
75  assert(Level < mpStack->size());
76  assert(index < mpStack->at(Level).size());
77 
78  return mpStack->at(Level)[index];
79 }
#define C_INVALID_INDEX
Definition: copasi.h:222
size_t size() const
Definition: CMathEnum.cpp:54
void CMath::CVariableStack::pop ( )

Definition at line 48 of file CMathEnum.cpp.

49 {
50  mpStack->pop_back();
51  mBodyLevel--;
52 }
void CMath::CVariableStack::push ( const StackElement stackElement)

Definition at line 42 of file CMathEnum.cpp.

43 {
44  mpStack->push_back(stackElement);
45  mBodyLevel++;
46 }
size_t CMath::CVariableStack::size ( ) const

Definition at line 54 of file CMathEnum.cpp.

55 {
56  return mpStack->size();
57 }

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const CVariableStack s 
)
friend

Definition at line 81 of file CMathEnum.cpp.

82 {
83  switch (s.mContext)
84  {
86  os << "Context: variable ";
87  break;
88 
90  os << "Context: body ";
91  break;
92  }
93 
94  os << "Variable Level: " << s.mVariableLevel << " Body Level: " << s.mBodyLevel;
95 
96  return os;
97 }

Member Data Documentation

size_t CMath::CVariableStack::mBodyLevel
private

Definition at line 265 of file CMathEnum.h.

Referenced by operator<<().

Context CMath::CVariableStack::mContext
private

Definition at line 261 of file CMathEnum.h.

Referenced by operator<<().

Buffer* CMath::CVariableStack::mpStack
private

Definition at line 258 of file CMathEnum.h.

size_t CMath::CVariableStack::mVariableLevel
private

Definition at line 263 of file CMathEnum.h.

Referenced by operator<<().


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