TrinityCore
Loading...
Searching...
No Matches
ScriptReloadMgr.h
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef SCRIPT_RELOADER_H
19#define SCRIPT_RELOADER_H
20
21#include "Define.h"
22#include <memory>
23#include <string>
24
25namespace boost::filesystem
26{
27class path;
28}
29
39{
40public:
41 virtual ~ModuleReference() = default;
42
44 virtual char const* GetScriptModuleRevisionHash() const = 0;
46 virtual char const* GetScriptModule() const = 0;
48 virtual boost::filesystem::path const& GetModulePath() const = 0;
49};
50
57{
58protected:
59 ScriptReloadMgr() = default;
60
61public:
66 virtual ~ScriptReloadMgr() = default;
67
69 virtual void Initialize() { }
70
74 virtual void Update() { }
75
77 virtual void Unload() { }
78
80 static std::shared_ptr<ModuleReference> AcquireModuleReferenceOfContext(
81 std::string const& context);
82
84 static ScriptReloadMgr* instance();
85};
86
87#define sScriptReloadMgr ScriptReloadMgr::instance()
88
89#endif // SCRIPT_RELOADER_H
#define TC_GAME_API
Definition Define.h:129
virtual char const * GetScriptModule() const =0
Returns the name of the referenced script module.
virtual boost::filesystem::path const & GetModulePath() const =0
Returns the path to the script module.
virtual ~ModuleReference()=default
virtual char const * GetScriptModuleRevisionHash() const =0
Returns the git revision hash of the referenced script module.
ScriptReloadMgr()=default
ScriptReloadMgr & operator=(ScriptReloadMgr const &)=delete
ScriptReloadMgr(ScriptReloadMgr &&)=delete
virtual void Unload()
Unloads the ScriptReloadMgr.
virtual ~ScriptReloadMgr()=default
ScriptReloadMgr & operator=(ScriptReloadMgr &&)=delete
ScriptReloadMgr(ScriptReloadMgr const &)=delete
virtual void Initialize()
Initializes the ScriptReloadMgr.
virtual void Update()