Implemented Debug Tag functionality
[public/netxms.git] / src / libnetxms / debug_tag_tree.h
1 /*
2 ** NetXMS - Network Management System
3 ** Utility Library
4 ** Copyright (C) 2003-2017 Raden Solutions
5 **
6 ** This program is free software; you can redistribute it and/or modify
7 ** it under the terms of the GNU Lesser General Public License as published
8 ** by the Free Software Foundation; either version 3 of the License, or
9 ** (at your option) any later version.
10 **
11 ** This program is distributed in the hope that it will be useful,
12 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ** GNU General Public License for more details.
15 **
16 ** You should have received a copy of the GNU Lesser General Public License
17 ** along with this program; if not, write to the Free Software
18 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 **
20 ** File: debug_tag_tree.h
21 **
22 **
23 */
24 #include <nms_util.h>
25
26 class DebugTagTreeNode
27 {
28 friend class DebugTagTree;
29
30 private:
31 String *m_value;
32 StringObjectMap<DebugTagTreeNode> *m_children;
33 bool m_direct;
34 bool m_asterisk;
35 int m_directLvL;
36 int m_asteriskLvL;
37
38 DebugTagTreeNode(const TCHAR *value);
39
40 int getDebugLvl(const StringList *tags, UINT32 pos);
41 void add(const StringList *tags, UINT32 pos, UINT32 lvl);
42 bool remove(const StringList *tags, UINT32 pos);
43
44 public:
45 ~DebugTagTreeNode() { delete(m_value); delete(m_children); }
46 };
47
48 class DebugTagTree
49 {
50 private:
51 DebugTagTreeNode *m_root;
52
53 public:
54 DebugTagTree() { m_root = new DebugTagTreeNode(_T("")); }
55 ~DebugTagTree() { delete(m_root); }
56
57 void add(const TCHAR *tags, UINT32 lvl);
58 void remove(const TCHAR *tags);
59 int getDebugLvl(const TCHAR *tags);
60 };