Commit | Line | Data |
---|---|---|
970ed795 | 1 | /////////////////////////////////////////////////////////////////////////////// |
3abe9331 | 2 | // Copyright (c) 2000-2015 Ericsson Telecom AB |
970ed795 EL |
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 | #ifndef _langviz_Node_HH | |
9 | #define _langviz_Node_HH | |
10 | ||
11 | /** | |
12 | * Base class for AST-classes. | |
13 | */ | |
14 | class Node { | |
15 | private: | |
16 | /** To detect missing/duplicated invoking of destructor. */ | |
17 | static int counter; | |
18 | #ifdef MEMORY_DEBUG | |
19 | /** Linked list for tracking undeleted nodes. */ | |
20 | Node *prev_node, *next_node; | |
21 | #endif | |
22 | protected: | |
23 | /** Default constructor. */ | |
24 | Node(); | |
25 | /** The copy constructor. */ | |
26 | Node(const Node& p); | |
27 | public: | |
28 | /** | |
29 | * "Virtual constructor". | |
30 | */ | |
31 | virtual Node* clone() const =0; | |
32 | /** The destructor. */ | |
33 | virtual ~Node(); | |
34 | /** Gives an error message if counter is not zero. It can be | |
35 | * invoked before the program exits (like check_mem_leak()) to | |
36 | * verify that all Nodes are destructed. */ | |
37 | static void chk_counter(); | |
38 | }; | |
39 | ||
40 | #endif // _langviz_Node_HH |