All Classes Functions Typedefs
PluginMultipleVessels.hpp
1 // ==============================================================
2 // ORBITER AUX LIBRARY: Multiple Vessels Support
3 // http://sf.net/projects/enjomitchsorbit
4 // Part of the ORBITER SDK
5 //
6 // Copyright (C) 2008 Mohd "Computerex" Ali - original concept
7 // Copyright (C) 2011 Szymon "Enjo" Ender - object oriented design,
8 // simplifications, fixes
9 // All rights reserved
10 //
11 // PluginMultipleVessels.hpp - Base plugin functionalities. To be derived.
12 //
13 // Multiple Vessels Support is free software: you can redistribute it
14 // and/or modify it under the terms of the GNU Lesser General Public
15 // License as published by the Free Software Foundation, either version
16 // 3 of the License, or (at your option) any later version.
17 //
18 // Multiple Vessels Support is distributed in the hope that it will
19 // be useful, but WITHOUT ANY WARRANTY; without even the implied
20 // warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
21 // See the GNU Lesser General Public License for more details.
22 //
23 // You should have received a copy of the GNU Lesser General Public
24 // License along with Multiple Vessels Support. If not, see
25 // <http://www.gnu.org/licenses/>.
26 // ==============================================================
27 
28 #ifndef PLUGINMULTIPLEVESSELS_HPP_INCLUDED
29 #define PLUGINMULTIPLEVESSELS_HPP_INCLUDED
30 
31 #include <vector>
32 #include "MFDData.hpp"
33 #include "SimulationTimeData.hpp"
34 #include <orbitersdk.h>
35 
36 namespace EnjoLib
37 {
38 namespace MFDGoodies
39 {
41 
47 #ifndef ORB2006
48  : public oapi::Module
49 #endif
50 {
51 public:
53 
56  PluginMultipleVessels( HINSTANCE hDLL );
57 
59 
63  virtual ~PluginMultipleVessels();
64 
66 
76  MFDData * AssociateMFDData( VESSEL * vessel );
77 
79 
85  void UpdatePreStep( const SimulationTimeData & timeData );
86 
87  void UpdatePostStep( const SimulationTimeData & timeData );
88 
89  void clbkSimulationStart(
90  #ifndef ORB2006
91  RenderMode mode
92  #endif
93  );
94  void clbkSimulationEnd();
95 
97 
103  void Init();
104  void Cleanup();
105 
107 
113  void DeleteVessel( OBJHANDLE hVessel );
114 
116 
117  void clbkPreStep (double simt, double simdt, double mjd);
118 
120 
121  void clbkPostStep (double simt, double simdt, double mjd);
122 
124 
125  void clbkDeleteVessel (OBJHANDLE hVessel);
126 
127 protected:
129 
136  virtual void UpdateClientPreStep( MFDData * data, const SimulationTimeData & timeData ) = 0;
137 
139 
142  virtual void UpdateClientPostStep( MFDData * data, const SimulationTimeData & timeData ) = 0;
143 
145 
151  virtual void InitClient() = 0;
152  virtual void CleanupClient() = 0;
153 
155 
160  virtual MFDData * ConstructNewMFDData( VESSEL * vessel ) = 0;
161 
162 private:
163  void CleanVectors();
164 
165  typedef std::vector<MFDData*> VMFDData;
166 
167  VMFDData m_vMFDData;
168  VMFDData m_vMFDDataInvalid;
169 };
170 }
171 }
172 #endif // PLUGINMULTIPLEVESSELS_HPP_INCLUDED