1 /***********************************************************************/
2 /* Open Visualization Data Explorer                                    */
3 /* (C) Copyright IBM Corp. 1989,1999                                   */
4 /* ALL RIGHTS RESERVED                                                 */
5 /* This code licensed under the                                        */
6 /*    "IBM PUBLIC LICENSE - Open Visualization Data Explorer"          */
7 /***********************************************************************/
8 
9 #include <dxconfig.h>
10 #include "../base/defines.h"
11 
12 
13 
14 
15 #ifndef _SymbolManager_h
16 #define _SymbolManager_h
17 
18 
19 #include "StringTable.h"
20 
21 
22 //
23 // Class name definition:
24 //
25 #define ClassSymbolManager	"SymbolManager"
26 
27 
28 //
29 // Symbol type definition:
30 //
31 typedef long Symbol;
32 
33 
34 //
35 // SymbolManager class definition:
36 //
37 class SymbolManager : private StringTable
38 {
39   public:
40     //
41     // Constructor:
42     //
SymbolManager()43     SymbolManager(){}
44 
45     //
46     // Destructor:
47     //
~SymbolManager()48     ~SymbolManager(){}
49 
50     //
51     // Registers the symbol string and returns a unique symbol ID
52     // for the symbol string.
53     //
54     Symbol registerSymbol(const char* symbolString);
55 
56     //
57     // Returns the corresponding symbol ID for the specified string.
58     // Returns 0 if the string is not registered.
59     //
getSymbol(const char * symbolString)60     Symbol getSymbol(const char* symbolString)
61     {
62 	return this->StringTable::findString(symbolString);
63     }
64 
65     //
66     // Returns the corresponding symbol string for the specified symbol.
67     // Returns NULL if an invalid symbol value has been specified.
68     //
getSymbolString(const Symbol symbol)69     const char* getSymbolString(const Symbol symbol)
70     {
71 	return this->StringTable::getString(symbol);
72     }
73 
74     //
75     // Returns a pointer to the class name.
76     //
getClassName()77     const char* getClassName()
78     {
79 	return ClassSymbolManager;
80     }
81 };
82 
83 
84 extern SymbolManager* theSymbolManager;
85 
86 
87 #endif // _SymbolManager_h
88