Spinning Topp Logo BlackTopp Studios
inc
scriptworkunit.h
Go to the documentation of this file.
1 // © Copyright 2010 - 2016 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 ScriptToRemove 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
81  /// be treated as taking linear time, relative to the total count of scripts
82  /// assigned to this workunit, to run.
83  /// @param Index The number of the Script to be removed. This behaves similar to an
84  /// array or vector as it starts counting at 0.
85  virtual void RemoveScript(Whole Index) = 0;
86 
87  /// @brief How many Scripts have been added to this workunit
88  /// @return A Whole containing the amount of iScripts passed in so far.
89  virtual Whole GetScriptCount() const = 0;
90 
91  /// @brief Remove all the Scripts!!! http://imgur.com/PI8YiyG
92  /// @details This should run in constant time. It still might be slower than removing and reading just one a few Scripts.
93  virtual void ClearScripts() = 0;
94 
95  /// @brief Retrieve a Script previously passed in.
96  /// @param Index The index of the passed parameter to retrun.
97  /// @return A reference counted pointer to an iScript.
98  virtual CountedPtr<iScript> GetScript(Whole Index) = 0;
99 
100  /// @brief Virtual deconstructor
101  virtual ~iScriptWorkUnit() {}
102 
103  }; // iScript
104  }
105 
106 
107 }//Mezzanine
108 
109 
110 
111 #endif // \_script_h
Default implementation of WorkUnit. This represents on piece of work through time.
Definition: workunit.h:160
A simple reference counting pointer.
Definition: countedptr.h:70
This file has the interfaces for Scripts and tag derived classes.
virtual ~iScriptWorkUnit()
Virtual deconstructor.
This file describes and implements a reference counted pointer that is NOT threadsafe.
The interface for a container of script that can be executed each frame.
#define MEZZ_LIB
Some platforms require special decorations to denote what is exported/imported in a share library...
The bulk of the engine components go in this namspace.
Definition: actor.cpp:56
unsigned long Whole
Whole is an unsigned integer, it will be at least 32bits in size.
Definition: datatypes.h:151
This file has the definition of the workunit.