Commit | Line | Data |
---|---|---|
d44e3c4f | 1 | /****************************************************************************** |
2 | * Copyright (c) 2000-2016 Ericsson Telecom AB | |
3 | * All rights reserved. This program and the accompanying materials | |
4 | * are made available under the terms of the Eclipse Public License v1.0 | |
5 | * which accompanies this distribution, and is available at | |
6 | * http://www.eclipse.org/legal/epl-v10.html | |
7 | * | |
8 | * Contributors: | |
9 | * Balasko, Jeno | |
10 | * Forstner, Matyas | |
11 | * | |
12 | ******************************************************************************/ | |
970ed795 EL |
13 | #ifndef _langviz_Node_HH |
14 | #define _langviz_Node_HH | |
15 | ||
16 | /** | |
17 | * Base class for AST-classes. | |
18 | */ | |
19 | class Node { | |
20 | private: | |
21 | /** To detect missing/duplicated invoking of destructor. */ | |
22 | static int counter; | |
23 | #ifdef MEMORY_DEBUG | |
24 | /** Linked list for tracking undeleted nodes. */ | |
25 | Node *prev_node, *next_node; | |
26 | #endif | |
27 | protected: | |
28 | /** Default constructor. */ | |
29 | Node(); | |
30 | /** The copy constructor. */ | |
31 | Node(const Node& p); | |
32 | public: | |
33 | /** | |
34 | * "Virtual constructor". | |
35 | */ | |
36 | virtual Node* clone() const =0; | |
37 | /** The destructor. */ | |
38 | virtual ~Node(); | |
39 | /** Gives an error message if counter is not zero. It can be | |
40 | * invoked before the program exits (like check_mem_leak()) to | |
41 | * verify that all Nodes are destructed. */ | |
42 | static void chk_counter(); | |
43 | }; | |
44 | ||
45 | #endif // _langviz_Node_HH |