PeriDyno 1.0.0
Loading...
Searching...
No Matches
Stack.inl
Go to the documentation of this file.
1#include "Math/SimpleMath.h"
2#include <glm/glm.hpp>
3
4namespace dyno
5{
6 template <typename T>
7 DYN_FUNC Stack<T>::Stack()
8 {
9 }
10
11 template <typename T>
12 DYN_FUNC T Stack<T>::top()
13 {
14 return ::dyno::STLBuffer<T>::m_startLoc[m_size-1];
15 }
16
17 template <typename T>
18 DYN_FUNC void Stack<T>::push(T val)
19 {
20 //if the data buffer is full
21 //if (m_size >= m_maxSize)
22 //cout<<"Stack is full!"<<endl;
23
24 //if not full add to the end
26 m_size++;
27 }
28
29 template <typename T>
30 DYN_FUNC void Stack<T>::pop()
31 {
32 //if the data buffer is empty
33 //if (m_size == 0 )
34 //cout << "Stack is empty!" << endl;
35
36 //else return the data at the top
37 m_size = m_size > 0 ? m_size - 1 : 0;
38 }
39
40 template <typename T>
41 DYN_FUNC void Stack<T>::clear()
42 {
43 m_size = 0;
44 }
45
46 template <typename T>
48 {
49 return m_size;
50 }
51
52 template <typename T>
53 DYN_FUNC uint Stack<T>::count(T val)
54 {
55 uint ind = 0;
56 uint num = 0;
57 while (ind < m_size)
58 {
60 num++;
61 ind++;
62 }
63
64 return num;
65 }
66
67 template <typename T>
68 DYN_FUNC bool Stack<T>::empty()
69 {
70 return m_size == 0;
71 }
72}
73
DYN_FUNC void pop()
Definition Stack.inl:30
DYN_FUNC void clear()
Definition Stack.inl:41
DYN_FUNC void push(T val)
Definition Stack.inl:18
DYN_FUNC Stack()
Definition Stack.inl:7
DYN_FUNC T top()
Definition Stack.inl:12
DYN_FUNC uint size()
Definition Stack.inl:47
DYN_FUNC uint count(T val)
Definition Stack.inl:53
DYN_FUNC bool empty()
Definition Stack.inl:68
uint m_size
Definition Stack.h:45
#define T(t)
This is an implementation of AdditiveCCD based on peridyno.
Definition Array.h:25
unsigned int uint
Definition VkProgram.h:14