MezzanineEngine 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
scriptworkunit.h
Go to the documentation of this file.
1 // © Copyright 2010 - 2014 BlackTopp Studios Inc.
2 /* This file is part of The Mezzanine Engine.
3 
4  The Mezzanine Engine is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  The Mezzanine Engine is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with The Mezzanine Engine. If not, see <http://www.gnu.org/licenses/>.
16 */
17 /* The original authors have included a copy of the license specified above in the
18  'Docs' folder. See 'gpl.txt'
19 */
20 /* We welcome the use of the Mezzanine engine to anyone, including companies who wish to
21  Build professional software and charge for their product.
22 
23  However there are some practical restrictions, so if your project involves
24  any of the following you should contact us and we will try to work something
25  out:
26  - DRM or Copy Protection of any kind(except Copyrights)
27  - Software Patents You Do Not Wish to Freely License
28  - Any Kind of Linking to Non-GPL licensed Works
29  - Are Currently In Violation of Another Copyright Holder's GPL License
30  - If You want to change our code and not add a few hundred MB of stuff to
31  your distribution
32 
33  These and other limitations could cause serious legal problems if you ignore
34  them, so it is best to simply contact us or the Free Software Foundation, if
35  you have any questions.
36 
37  Joseph Toppi - toppij@gmail.com
38  John Blackwood - makoenergy02@gmail.com
39 */
40 #ifndef _scriptworkunit_h
41 #define _scriptworkunit_h
42 
43 /// @file
44 /// @brief This file has the interfaces for ScriptsWorkUnit
45 
46 #include "script.h"
47 #include "countedptr.h"
48 
49 #include "Threading/workunit.h"
50 
51 namespace Mezzanine
52 {
53  namespace Scripting
54  {
55  // Forward Declares
56  class iScriptCompilable;
57  class iScriptMultipleReturn;
58 
59  ///////////////////////////////////////////////////////////////////////////////////////////////////
60  /// @brief The interface for a container of script that can be executed each frame
61  /// @details All the methods that all script wokunits for all languages must implement.
62  /// These are minimalistic containers which will execute some of all of the scripts the container
63  /// every frame.
64  /// @n @n
65  /// This uses multiple inheritance to minimize the amount of features a scripting langauge with need to
66  /// implement.
67  ///////////////////////////////////////
69  {
70  public:
71  /// @brief This adds a script to list to be run each frame.
72  /// @param SCriptToAdd A CountedPtr to a script
73  virtual void AddScript(CountedPtr<iScript> ScriptToAdd) = 0;
74 
75  /// @brief Remove a Script.
76  /// @param ArScriptToRemoveg A CountedPtr matching the one to be removed.
77  virtual void RemoveScript(CountedPtr<iScript> ScriptToRemove) = 0;
78 
79  /// @brief Remove Script based on index.
80  /// @details This removes the specified Script from the internal list. This should be treated as taking linear
81  /// time, relative to the total count of svripts assigned to this workunit, to run.
82  /// @param Index The number of the Script to be removed. This behaves similar to an array or vector as it starts counting at 0.
83  virtual void RemoveScript(Whole Index) = 0;
84 
85  /// @brief How many Scripts have been added to this workunit
86  /// @return A Whole containing the amount of iScripts passed in so far.
87  virtual Whole GetScriptCount() const = 0;
88 
89  /// @brief Remove all the Scripts!!! http://imgur.com/PI8YiyG
90  /// @details This should run in constant time. It still might be slower than removing and reading just one a few Scripts.
91  virtual void ClearScripts() = 0;
92 
93  /// @brief Retrieve a Script previously passed in.
94  /// @param Index The index of the passed parameter to retrun.
95  /// @return A reference counted pointer to an iScript.
96  virtual CountedPtr<iScript> GetScript(Whole Index) = 0;
97 
98  /// @brief Virtual deconstructor
99  virtual ~iScriptWorkUnit() {}
100 
101  }; // iScript
102  }
103 
104 
105 }//Mezzanine
106 
107 
108 
109 #endif // \_script_h