40 #ifndef _lua51workunit_cpp
41 #define _lua51workunit_cpp
60 : LuaRuntime(TargetRuntime)
67 { ScriptsToRun.push_back(ScriptToAdd); }
89 for(Lua51WorkUnit::iterator Iter=this->
begin(); Iter!=this->
end() ; Iter++)
99 for(Lua51WorkUnit::const_iterator Iter=this->
begin(); Iter!=this->
end(); Iter++)
109 Lua51WorkUnit::iterator Iter = this->
find(Target);
110 if(Iter!=this->
end())
111 { ScriptsToRun.erase(Iter); }
115 { ScriptsToRun.erase(Target); }
129 {
erase(ScriptToRemove); }
135 {
return ScriptsToRun.begin(); }
137 {
return ScriptsToRun.begin(); }
140 {
return ScriptsToRun.end(); }
142 {
return ScriptsToRun.end(); }
145 {
return ScriptsToRun.size(); }
148 { ScriptsToRun.clear(); }
151 {
return CountedPtrCast<iScript>(ScriptsToRun.at(Index)); }
154 {
return ScriptsToRun.at(Index); }
159 Log <<
"Running Per Frame LuaScripts." << std::endl;
160 for(iterator Iter = this->
begin(); Iter!=this->
end(); Iter++)
163 Log <<
"Executing \"" << (*Iter)->GetName() <<
"\"" << std::endl;
virtual Whole GetScriptCount() const
How many Scripts have been added to this workunit.
std::stringstream Logger
In case we ever replace the stringstream with another class, this will allow us to swap it out...
iterator find(CountedPtr< Lua51Script > Target)
Get an Iterator to a script from the counted pointer.
virtual CountedPtr< iScript > Execute(const String &ScriptSource)
Compile and execute a passed string.
virtual void AddScript(CountedPtr< iScript > ScriptToAdd)
Adds a script similar to push_back.
#define MEZZ_EXCEPTION(num, desc)
An easy way to throw exceptions with rich information.
All the definitions for datatypes as well as some basic conversion functions are defined here...
A simple reference counting pointer.
This class is used to store a Lua script and in its source and compiled state.
void push_back(CountedPtr< Lua51Script > ScriptToAdd)
Adds a script to be run once each frame.
virtual CountedPtr< Lua51Script > GetLua51Script(Whole Index) const
Retrieve a Script previously passed in.
A thread specific collection of double-buffered and algorithm specific resources. ...
This file has the declaration for a workunit that can execute lua script every frame.
The workhorse of the Lua scripting system. All scripts come here to be executed.
virtual CountedPtr< iScript > GetScript(Whole Index)
Retrieve a Script previously passed in.
Lua51WorkUnit(Lua51ScriptingEngine *TargetRuntime)
Create a Lua51WorkUnit.
Logger & GetUsableLogger()
Get the usable logger for this thread specific resource.
void erase(CountedPtr< Lua51Script > Target)
Erase The first found Script use that pointer.
virtual void RemoveScript(CountedPtr< iScript > ScriptToRemove)
Similar to calling erase.
The bulk of the engine components go in this namspace.
unsigned long Whole
Whole is an unsigned integer, it will be at least 32bits in size.
virtual ~Lua51WorkUnit()
Virtual deconstructor.
Thrown when a pointer parameter is checked at runtime and cannot be cast as expected.
virtual void DoWork(Threading::DefaultThreadSpecificStorage::Type &CurrentThreadStorage)
Runs all scripts that have been added to this work unit.
iterator begin()
Get an iterator to the first script.
This file has the interface for the Lua based implementation of the Scripting system.
virtual void ClearScripts()
Remove all the Scripts from this workunit.
std::string String
A datatype used to a series of characters.
iterator end()
Get an iterator one past the last script.