root/simulator/trunk/src/simulator/interface.h

Revision 1468, 9.0 kB (checked in by sehenley, 6 months ago)

Update to Ogre 1.7.0 - removed CEGUI (no mingw support).

  • Property WBS set to 1.1
  • Property svn:keywords set to
    Url
    Rev
    Author
    Date
    Id
Line 
1 //    OSRail -- a network enabled railroad operations simulator and utilities
2 //    Copyright (C) 2007,2008 Samuel E. Henley sehenley@comcast.net
3 //
4 //    This program 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 2 of the License, or
7 //    (at your option) any later version.
8 //
9 //    This program 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 along
15 //    with this program; if not, write to the Free Software Foundation, Inc.,
16 //    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 //
18 //
19 // //////////////////// Interfaces /////////////////////////////////
20 /// \file
21 /// Header file for all simulator interfaces using ISimulatorComponent base class.
22
23
24 #ifndef _
25     #define _(x) x //i18n tag
26 #endif // _
27
28 #ifndef String
29     #ifdef _UNICODE
30         typedef std::wstring String;
31     #else
32         typedef std::string String;
33     #endif //_UNICODE
34 #endif //String
35
36 /// \addtogroup simulator "Simulator"
37 /// @{
38     /// \addtogroup simulatorcomponent "Simulator Components"
39     /// @{
40
41
42     class ISystem;
43
44     /// \interface ISimulatorComponent
45     /// ISimulatorComponent is the common interface for simulator components.
46     /// This is an abstract class to insure the simulator components
47     /// have a common interface.
48     /// \remarks
49     /// \par Simulator interfaces.
50     /// All calls between simulator components should
51     /// be represented by an abstract function in the
52     /// following protocol classes.
53     /// This will reduce coupling leaving the only
54     /// the hazard of a cast from ISimulatorComponent
55     /// to the interface for the function
56     /// (Example dynamic_cast<ISimulatorComponent*>(IGraphics*) ).
57     /// \remarks
58     /// \par Requirement for a protocol class
59     /// - Does not contain or inherit from a non-protocol class.
60     /// - The class has a non-inline virtual destructor.
61     /// - All other member functions are pure virtual.
62     class ISimulatorComponent
63     {
64     public:
65         virtual void startup() = 0;
66         virtual void operator()() = 0;
67         virtual void shutdown() = 0;
68
69
70         /// Protocol classes may require a non-inline virtual
71         /// destructor for some compilers.
72         /// from "Large-Scale C++ Software Design", Lakos, John, 1996
73         virtual ~ISimulatorComponent(){}
74     };
75
76     /// \interface IGraphics
77     /// IGraphics is the simulation interface to Ogre.
78     /// This is an abstract class to insure a common inteface for the use of
79     /// the ISystem classes.
80     class IGraphics : public ISimulatorComponent
81     {
82     public:
83         virtual bool isClosed() const = 0;
84         virtual bool isVisible() const = 0;
85
86         /// Get time from last render
87         /// \return milliseconds from last graphics render
88         virtual unsigned long getFrameMilliseconds() = 0;
89
90         virtual ~IGraphics(){}
91     };
92
93     /// \interface ITask
94     /// ITask is the simulation interface to it's micro threads.
95     /// This is an abstract class to insure a common inteface for the use of
96     /// the ISystem classes. This class is used to control background tasks
97     /// for game enities and the game enities events. The class will register
98     /// and unregister events from other interfaces and game enities.
99     class ITask : public ISimulatorComponent
100     {
101     public:
102         virtual bool addScript( const char* module, const char* script, const clock_t max, const int priority ) = 0;
103
104         virtual ~ITask(){}
105     };
106
107     /// \interface ISound
108     /// ISound is the simulation interface to OpenAL.
109     /// This is an abstract class to insure a common inteface for the use of
110     /// the ISystem classes. This class is used to control sound for
111     /// game enities.
112     class ISound : public ISimulatorComponent
113     {
114     public:
115
116         virtual ~ISound(){}
117     };
118
119     /// \interface IAi
120     /// IAi is the simulation interface to control game enities.
121     /// This is an abstract class to insure a common inteface for the use of
122     /// the ISystem classes. This class is used to control game enities.
123     class IAi : public ISimulatorComponent
124     {
125     public:
126
127         virtual ~IAi(){}
128     };
129
130     /// \interface IInput
131     /// IInput is the simulation interface to OIS.
132     /// This is an abstract class to insure a common inteface for the use of
133     /// the ISystem classes. This class is used to generate events.
134     class IInput : public ISimulatorComponent
135     {
136     public:
137
138         virtual ~IInput(){}
139     };
140
141     /// \interface IGui
142     /// IGui is the simulation interface to GUI.
143     /// This is an abstract class to insure a common inteface for the use of
144     /// the ISystem classes. This class is used to show 2d overlays and associate
145     /// them with input/output events and tasks.
146     class IGui : public ISimulatorComponent
147     {
148     public:
149
150         virtual ~IGui(){}
151     };
152
153     /// \interface INetwork
154     /// INetwork is the simulation interface to a peer network.
155     /// This is an abstract class to insure a common inteface for the use of
156     /// the ISystem classes. This class is used to execute tasks that preform
157     /// network input/output.
158     class INetwork : public ISimulatorComponent
159     {
160     public:
161
162         virtual ~INetwork(){}
163     };
164
165     /// \interface IConsoleClient
166     /// IConsoleClient is the simulation interface to the console utility.
167     /// This is an abstract class to insure a common inteface for the use of
168     /// the ISystem classes. This class is used show information to, and retrieve
169     /// debug and tweaker settings from the console user.
170     class IConsoleClient : public ISimulatorComponent
171     {
172     public:
173
174         virtual ~IConsoleClient(){}
175     };
176
177     /// \interface IFactory
178     /// IFactory is the simulation interface used to generate game entities.
179     /// This is an abstract class to insure a common interface for the use of
180     /// the ISystem classes. This class is interface between the route data files
181     /// and the Ogre resource system.
182     class IFactory : public ISimulatorComponent
183     {
184     public:
185
186         virtual ~IFactory(){}
187     };
188
189     /// \interface IPropertyManager
190     /// IPropertyManager is the simulation interface used to retrieve the rights
191     /// to game media. This is an abstract class to insure a common inteface
192     /// for the use of the ISystem classes. This class is interface to the
193     /// Propermanager utility.
194     class IPropertyManager : public ISimulatorComponent
195     {
196     public:
197
198         virtual ~IPropertyManager(){}
199     };
200
201     /// \interface ISimulation
202     /// ISimulation is the simulation interface for moviable or antimated
203     /// game enities. This is an abstract class to insure a common inteface
204     /// for the use of the ISystem classes. This class is used to control
205     /// background simulation of the enitiestasks
206     /// for game enities and the game enities.
207     class ISimulation : public ISimulatorComponent
208     {
209     public:
210
211         virtual ~ISimulation(){}
212     };
213
214     /// \interface ITest
215     /// ITest is the simulation interface to internal tests.
216     /// This is an abstract class to insure a common inteface for the use of
217     /// the ISystem classes. This class is used to test routines and devices
218     /// and send results to the console. The class will register
219     /// and unregister test with the console.
220     class ITest : public ISimulatorComponent
221     {
222     public:
223
224         virtual ~ITest(){}
225     };
226
227     /// \interface ISystem
228     /// ISystem is the simulation main loop.
229     /// This is an abstract class to insure a common inteface for the use of
230     /// all other interface classes.
231     class ISystem : public ISimulatorComponent
232     {
233     public:
234         virtual bool  running() const = 0;
235         virtual bool  anyState() const = 0;
236         virtual void  setOptions( const boost::program_options::variables_map& map ) = 0;
237         virtual IAi*              getAiInterface()  = 0;
238         virtual IConsoleClient*   getConsoleClientInterface()  = 0;
239         virtual IFactory*         getFactoryInterface()  = 0;
240         virtual IGraphics*        getGraphicsInterface()  = 0;
241         virtual IGui*             getGuiInterface()  = 0;
242         virtual IInput*           getInputInterface()  = 0;
243         virtual INetwork*         getNetworkInterface()  = 0;
244         virtual IPropertyManager* getPropertyManagerInterface()  = 0;
245         virtual ISimulation*      getSimulationInterface()  = 0;
246         virtual ISound*           getSoundInterface()  = 0;
247         virtual ISystem*          getSystemInterface()  = 0;
248         virtual ITask*            getTaskInterface()  = 0;
249         virtual ITest*            getTestInterface()  = 0;
250         /// Get time from last render
251         /// \return milliseconds from last graphics render
252         virtual unsigned long     getFrameMilliseconds() = 0;
253         virtual ~ISystem(){}
254     };
255
256
257     /// @}   group simulatorcomponent
258 /// @}   group simulator
Note: See TracBrowser for help on using the browser.