i6engine  1.0
Application.h
Go to the documentation of this file.
1 /*
2  * i6engine
3  * Copyright (2016) Daniel Bonrath, Michael Baer, All rights reserved.
4  *
5  * This file is part of i6engine; i6engine is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
25 #ifndef __I6ENGINE_API_APPLICATION_H__
26 #define __I6ENGINE_API_APPLICATION_H__
27 
29 
31 
33 
34 namespace i6e {
35 namespace core {
36  class IPKey;
37 } /* namespace core */
38 namespace api {
39 
40  class EngineController;
41 
51  public:
52  Application() : core::ModuleController(core::Subsystem::Application), _windowName("Default") {}
53 
54  virtual ~Application() {}
55 
62  virtual void Initialize() = 0;
63 
70  virtual void AfterInitialize() = 0;
71 
78  virtual void Tick() = 0;
79 
87  virtual bool ShutdownRequest() = 0;
88 
95  virtual void Finalize() = 0;
96 
101  std::string getName() const {
102  return _windowName;
103  }
104 
109  void setName(const std::string & name) {
110  _windowName = name;
111  }
112 
117  virtual void disconnectCallback(const core::IPKey &) {}
118 
122  virtual void connectionFailed(const core::IPKey &) {}
123 
127  virtual void bindFailure() {}
128 
133  virtual void connected(const core::IPKey &) {}
134 
138  void ShutDown() {
139  }
140 
141  protected:
143 
144  private:
145  std::string _windowName;
146 
150  void OnThreadStart() {
152  }
153 
157  Application(const Application &) = delete;
158 
162  Application & operator=(const Application &) = delete;
163  };
164 
165 } /* namespace api */
166 } /* namespace i6e */
167 
168 #endif /* __I6ENGINE_API_APPLICATION_H__ */
169 
This class is used as the Controller for the whole engine Create an instance of this class and use th...
#define ISIXE_MODULES_API
Part of the Subsystem that keeps the whole module running.
virtual void disconnectCallback(const core::IPKey &)
called when a player had a disconnect
Definition: Application.h:117
std::string getName() const
returns the name of the Application
Definition: Application.h:101
void ShutDown()
called from engine to signal shutdown
Definition: Application.h:138
#define ASSERT_THREAD_SAFETY_HEADER
Interface for the game developer.
Definition: Application.h:50
virtual void connectionFailed(const core::IPKey &)
called when connecting to server failes
Definition: Application.h:122
void setName(const std::string &name)
sets the name of the Application
Definition: Application.h:109
virtual ~Application()
Definition: Application.h:54
virtual void bindFailure()
called when address or port is already in use while connecting to m2etis
Definition: Application.h:127
virtual void connected(const core::IPKey &)
called when connection request was handled
Definition: Application.h:133
#define ASSERT_THREAD_SAFETY_CONSTRUCTOR