root/trunk/src/framework/GameSystem/GridLoader.h @ 2

Revision 2, 2.4 kB (checked in by yumileroy, 17 years ago)

[svn] * Proper SVN structure

Original author: Neo2003
Date: 2008-10-02 16:23:55-05:00

Line 
1/*
2 * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/>
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
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17 */
18
19#ifndef MANGOS_GRIDLOADER_H
20#define MANGOS_GRIDLOADER_H
21
22/**
23  @class GridLoader
24  The GridLoader is working in conjuction with the Grid and responsible
25  for loading and unloading object-types (one or more) when objects
26  enters a grid.  Unloading is scheduled and might be canceled if
27  an interested object re-enters.  GridLoader does not do the actuall
28  loading and unloading but implements as a template pattern that
29  delicate its loading and unloading for the actualy loader and unloader.
30  GridLoader manages the grid (both local and remote).
31 */
32
33#include "Platform/Define.h"
34#include "Grid.h"
35#include "TypeContainerVisitor.h"
36
37template
38<
39class ACTIVE_OBJECT,
40class WORLD_OBJECT_TYPES,
41class GRID_OBJECT_TYPES
42>
43class MANGOS_DLL_DECL GridLoader
44{
45    public:
46
47        /** Loads the grid
48         */
49        template<class LOADER>
50            void Load(Grid<ACTIVE_OBJECT,WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES> &grid, LOADER &loader)
51        {
52            grid.LockGrid();
53            loader.Load(grid);
54            grid.UnlockGrid();
55        }
56
57        /** Stop the grid
58         */
59        template<class STOPER>
60            void Stop(Grid<ACTIVE_OBJECT,WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES> &grid, STOPER &stoper)
61        {
62            grid.LockGrid();
63            stoper.Stop(grid);
64            grid.UnlockGrid();
65        }
66        /** Unloads the grid
67         */
68        template<class UNLOADER>
69            void Unload(Grid<ACTIVE_OBJECT,WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES> &grid, UNLOADER &unloader)
70        {
71            grid.LockGrid();
72            unloader.Unload(grid);
73            grid.UnlockGrid();
74        }
75};
76#endif
Note: See TracBrowser for help on using the browser.