Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_Stack.c
Go to the documentation of this file.
1
4// may be replaced with cpp implementation with script API later on
5class SCR_Stack<Class T>
6{
7 protected ref array<ref T> m_aArray = {};
8
9 //------------------------------------------------------------------------------------------------
12 void Push(T item)
13 {
14 m_aArray.Insert(item);
15 }
16
17 //------------------------------------------------------------------------------------------------
21 {
22 int index = m_aArray.Count() - 1;
23 if (index < 0)
24 return null;
25
26 T poppedItem = m_aArray[index];
27 m_aArray.Remove(index);
28
29 return poppedItem;
30 }
31
32 //------------------------------------------------------------------------------------------------
36 {
37 int index = m_aArray.Count() - 1;
38 if (index < 0)
39 return null;
40
41 return m_aArray[index];
42 }
43
44 //------------------------------------------------------------------------------------------------
48 {
49 if (m_aArray.IsEmpty())
50 return null;
51
52 return m_aArray[0];
53 }
54
55 //------------------------------------------------------------------------------------------------
57 bool IsEmpty()
58 {
59 return m_aArray.IsEmpty();
60 }
61
62 //------------------------------------------------------------------------------------------------
64 int Count()
65 {
66 return m_aArray.Count();
67 }
68}
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
class SCR_MapHelperT< Class T, Class U > T
Super root of all classes in Enforce script.
Definition Types.c:35
ref array< ref T > m_aArray
Definition SCR_Stack.c:7
void Push(T item)
Definition SCR_Stack.c:12
int Count()
Returns the count of elements stored in this stack.
Definition SCR_Stack.c:64