Rollback from r3608 to r3606
[public/netxms.git] / src / server / include / nxcore_maps.h
1 /*
2 ** NetXMS - Network Management System
3 ** Copyright (C) 2003, 2004, 2005, 2006 Victor Kirhenshtein
4 **
5 ** This program is free software; you can redistribute it and/or modify
6 ** it under the terms of the GNU General Public License as published by
7 ** the Free Software Foundation; either version 2 of the License, or
8 ** (at your option) any later version.
9 **
10 ** This program 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
13 ** GNU General Public License for more details.
14 **
15 ** You should have received a copy of the GNU General Public License
16 ** along with this program; if not, write to the Free Software
17 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 **
19 ** File: nxcore_maps.h
20 **
21 **/
22
23 #ifndef _nxcore_maps_h_
24 #define _nxcore_maps_h_
25
26 #include <netxms_maps.h>
27
28
29 //
30 // Server-side submap class
31 //
32
33 class nxSubmapSrv : public nxSubmap
34 {
35 protected:
36 DWORD m_dwMapId; // ID of parent map
37
38 public:
39 nxSubmapSrv(DB_RESULT hResult, int nRow, DWORD dwMapId);
40 nxSubmapSrv(DWORD dwObjectId, DWORD dwMapId);
41
42 DWORD SaveToDB(void);
43 };
44
45
46 //
47 // Server-side map class
48 //
49
50 class nxMapSrv : public nxMap
51 {
52 protected:
53 int m_nRefCount;
54
55 public:
56 nxMapSrv(DB_RESULT hResult, int nRow);
57 nxMapSrv(DWORD dwMapId, DWORD dwObjectId, const TCHAR *pszName, const TCHAR *pszDescription);
58
59 DWORD SaveToDB(void);
60 BOOL CheckUserRights(DWORD dwUserId, DWORD dwDesiredAccess);
61
62 void IncRefCount(void) { Lock(); m_nRefCount++; Unlock(); }
63 void DecRefCount(void) { Lock(); if (m_nRefCount > 0) m_nRefCount--; Unlock(); }
64 int GetRefCount(void) { int nRef; Lock(); nRef = m_nRefCount; Unlock(); return nRef; }
65 };
66
67
68 //
69 // Functions
70 //
71
72 void CreateMapListMessage(CSCPMessage &msg, DWORD dwUserId);
73 DWORD CreateNewMap(DWORD rootObj, const TCHAR *name, DWORD *newId);
74 void LoadMaps(void);
75 DWORD GetMapIdFromName(TCHAR *pszName, DWORD *pdwMapId);
76 BOOL LockMaps(void);
77 void UnlockMaps(void);
78 nxMapSrv *FindMapByID(DWORD dwMapId);
79
80
81 //
82 // Webmaps functions
83 //
84
85 DWORD CreateWebMap(const TCHAR *name, const TCHAR *props, DWORD *id);
86 DWORD DeleteWebMap(DWORD id);
87 DWORD UpdateWebMapData(DWORD mapId, const TCHAR *data);
88 DWORD UpdateWebMapProperties(DWORD mapId, const TCHAR *name, const TCHAR *props);
89
90
91 #endif /* _nxcore_maps_h_ */