Initial Patch of Auction House bot rev. 135
[auctionmangos.git] / src / framework / GameSystem / GridLoader.h
blobe7391363820bb6e17505ce48aa647a744ca43dc2
1 /*
2 * Copyright (C) 2005-2008 MaNGOS <http://getmangos.com/>
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.
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.
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
19 #ifndef MANGOS_GRIDLOADER_H
20 #define MANGOS_GRIDLOADER_H
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).
33 #include "Platform/Define.h"
34 #include "Grid.h"
35 #include "TypeContainerVisitor.h"
37 template
39 class ACTIVE_OBJECT,
40 class WORLD_OBJECT_TYPES,
41 class GRID_OBJECT_TYPES
43 class MANGOS_DLL_DECL GridLoader
45 public:
47 /** Loads the grid
49 template<class LOADER>
50 void Load(Grid<ACTIVE_OBJECT,WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES> &grid, LOADER &loader)
52 grid.LockGrid();
53 loader.Load(grid);
54 grid.UnlockGrid();
57 /** Stop the grid
59 template<class STOPER>
60 void Stop(Grid<ACTIVE_OBJECT,WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES> &grid, STOPER &stoper)
62 grid.LockGrid();
63 stoper.Stop(grid);
64 grid.UnlockGrid();
66 /** Unloads the grid
68 template<class UNLOADER>
69 void Unload(Grid<ACTIVE_OBJECT,WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES> &grid, UNLOADER &unloader)
71 grid.LockGrid();
72 unloader.Unload(grid);
73 grid.UnlockGrid();
76 #endif