ScriptStack 1.0.0
A .NET scripting language
Lade ...
Suche ...
Keine Treffer
ScriptStack.Runtime.Memory Klassenreferenz

Öffentliche Methoden

void Clear ()
 
bool Exists (string identifier)
 
void Remove (string identifier)
 
Scope Find (string identifier)
 

Öffentliche, statische Methoden

static Memory AllocateSharedMemory ()
 
static Memory AllocateScriptMemory (Memory sharedMemory)
 
static Memory AllocateLocalMemory (Memory scriptMemory)
 

Propertys

ReadOnlyCollection< string > Identifiers [get]
 
object this[string identifier] [get, set]
 
Scope Scope [get]
 

Private Methoden

 Memory (Scope scope, Memory sharedMemory, Memory scriptMemory)
 

Private Attribute

Scope scope
 
Memory sharedMemory
 
Memory scriptMemory
 
Dictionary< string, object > variables
 
Dictionary< string, object > tempVariables
 

Beschreibung der Konstruktoren und Destruktoren

◆ Memory()

ScriptStack.Runtime.Memory.Memory ( Scope scope,
Memory sharedMemory,
Memory scriptMemory )
private
25 {
26 this.scope = scope;
27 this.sharedMemory = sharedMemory;
28 this.scriptMemory = scriptMemory;
29 variables = new Dictionary<string, object>();
30 tempVariables = new Dictionary<string, object>();
31 }
Dictionary< string, object > tempVariables
Definition Memory.cs:22
Dictionary< string, object > variables
Definition Memory.cs:21
Memory scriptMemory
Definition Memory.cs:20
Scope scope
Definition Memory.cs:18
Memory sharedMemory
Definition Memory.cs:19

Benutzt ScriptStack.Runtime.Memory.scope, ScriptStack.Runtime.Memory.scriptMemory, ScriptStack.Runtime.Memory.sharedMemory, ScriptStack.Runtime.Memory.tempVariables und ScriptStack.Runtime.Memory.variables.

Wird benutzt von ScriptStack.Runtime.Memory.AllocateLocalMemory(), ScriptStack.Runtime.Memory.AllocateScriptMemory() und ScriptStack.Runtime.Memory.AllocateSharedMemory().

Dokumentation der Elementfunktionen

◆ AllocateLocalMemory()

static Memory ScriptStack.Runtime.Memory.AllocateLocalMemory ( Memory scriptMemory)
static
66 {
67 return new Memory(
69 }
Memory(Scope scope, Memory sharedMemory, Memory scriptMemory)
Definition Memory.cs:24
Scope Scope
Definition Memory.cs:203

Benutzt ScriptStack.Runtime.Memory.Memory(), ScriptStack.Runtime.Memory.scriptMemory und ScriptStack.Runtime.Memory.sharedMemory.

Wird benutzt von ScriptStack.Runtime.Interpreter.CALL() und ScriptStack.Runtime.Interpreter.Reset().

◆ AllocateScriptMemory()

static Memory ScriptStack.Runtime.Memory.AllocateScriptMemory ( Memory sharedMemory)
static

◆ AllocateSharedMemory()

static Memory ScriptStack.Runtime.Memory.AllocateSharedMemory ( )
static
56 {
57 return new Memory(Scope.Shared, null, null);
58 }

Benutzt ScriptStack.Runtime.Memory.Memory().

Wird benutzt von ScriptStack.Manager.Manager().

◆ Clear()

void ScriptStack.Runtime.Memory.Clear ( )

◆ Exists()

bool ScriptStack.Runtime.Memory.Exists ( string identifier)
78 {
79
80 switch (scope)
81 {
82
83 case Scope.Shared:
84 return variables.ContainsKey(identifier);
85
86 case Scope.Script:
87 if (variables.ContainsKey(identifier))
88 return true;
89 else
90 return sharedMemory.Exists(identifier);
91
92 case Scope.Local:
93 if (variables.ContainsKey(identifier))
94 return true;
95 else
96 return scriptMemory.Exists(identifier);
97
98 default:
99 throw new ExecutionException("Der Scope '" + scope + "' ist unkelannt.");
100
101 }
102
103 }
bool Exists(string identifier)
Definition Memory.cs:77

Benutzt ScriptStack.Runtime.Memory.Exists(), ScriptStack.Runtime.Memory.scope, ScriptStack.Runtime.Memory.scriptMemory, ScriptStack.Runtime.Memory.sharedMemory und ScriptStack.Runtime.Memory.variables.

Wird benutzt von ScriptStack.Runtime.Interpreter.Assignment() und ScriptStack.Runtime.Memory.Exists().

◆ Find()

Scope ScriptStack.Runtime.Memory.Find ( string identifier)
111 {
112 switch (scope)
113 {
114
115 case Scope.Shared:
116 if (variables.ContainsKey(identifier))
117 return scope;
118 else
119 throw new ExecutionException("Variable '" + identifier + "' undefined.");
120
121 case Scope.Script:
122 if (variables.ContainsKey(identifier))
123 return scope;
124 else
125 return sharedMemory.Find(identifier);
126
127 case Scope.Local:
128 if (variables.ContainsKey(identifier))
129 return scope;
130 else
131 return scriptMemory.Find(identifier);
132
133 default:
134 throw new ExecutionException("Unknown scope: " + scope);
135
136 }
137
138 }
Scope Find(string identifier)
Definition Memory.cs:110

Benutzt ScriptStack.Runtime.Memory.Find(), ScriptStack.Runtime.Memory.scope, ScriptStack.Runtime.Memory.scriptMemory, ScriptStack.Runtime.Memory.sharedMemory und ScriptStack.Runtime.Memory.variables.

Wird benutzt von ScriptStack.Runtime.Memory.Find().

◆ Remove()

void ScriptStack.Runtime.Memory.Remove ( string identifier)
106 {
107 variables.Remove(identifier);
108 }

Benutzt ScriptStack.Runtime.Memory.variables.

Dokumentation der Datenelemente

◆ scope

◆ scriptMemory

◆ sharedMemory

◆ tempVariables

Dictionary<string, object> ScriptStack.Runtime.Memory.tempVariables
private

◆ variables

Dokumentation der Propertys

◆ Identifiers

ReadOnlyCollection<string> ScriptStack.Runtime.Memory.Identifiers
get
141 {
142 get
143 {
144 List<String> listIdentifiers
145 = new List<String>(variables.Keys);
146 return listIdentifiers.AsReadOnly();
147 }
148 }

◆ Scope

Scope ScriptStack.Runtime.Memory.Scope
get
203 {
204 get { return scope; }
205 }

◆ this[string identifier]

object ScriptStack.Runtime.Memory.this[string identifier]
getset
151 {
152 get
153 {
154 switch (scope)
155 {
156 case Scope.Shared:
157 if (!variables.ContainsKey(identifier))
158 throw new ExecutionException( "Globale Variable '" + identifier + "' wurde nicht deklariert.");
159 return variables[identifier];
160 case Scope.Script:
161 if (variables.ContainsKey(identifier))
162 return variables[identifier];
163 else
164 return sharedMemory[identifier];
165 case Scope.Local:
166 if (variables.ContainsKey(identifier))
167 return variables[identifier];
168 else
169 return scriptMemory[identifier];
170 default:
171 throw new ExecutionException("Der Scope '" + scope + "' int unbekannt.");
172 }
173 }
174 set
175 {
176 if (!Exists(identifier))
177 variables[identifier] = value;
178 else
179 {
180 switch (scope)
181 {
182 case Scope.Shared:
183 variables[identifier] = value;
184 break;
185 case Scope.Script:
186 if (sharedMemory.Exists(identifier))
187 sharedMemory[identifier] = value;
188 else
189 variables[identifier] = value;
190 break;
191 case Scope.Local:
192 if (scriptMemory.Exists(identifier))
193 scriptMemory[identifier] = value;
194 else
195 variables[identifier] = value;
196 break;
197 }
198 }
199 }
200 }

Die Dokumentation für diese Klasse wurde erzeugt aufgrund der Datei: