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 _GlobalLocalNode_h
16 #define _GlobalLocalNode_h
17 
18 //
19 // This class of Node is implemented to address a design problem with the
20 // Get and Set modules that went out in versions 3.1.0 - 3.1.2.  The fix
21 // is to replace them with GetLocal, GetGlobal, and SetLocal, SetGlobal.
22 // To make things easier for your users, we will try and automatically
23 // convert Get and Set nodes (which are assumed to have the same inputs
24 // as the new nodes), by setting a flag (per the user's desires) and then
25 // printing the name of the node accordingly.  So, all this node really
26 // does is change the name to include the Local or Global suffix depending
27 // on the setting of a flag.
28 //
29 
30 
31 #include "Node.h"
32 
33 
34 //
35 // Class name definition:
36 //
37 #define ClassGlobalLocalNode	"GlobalLocalNode"
38 
39 //
40 // Referenced Classes
41 //
42 class NodeDefinition;
43 class Network;
44 class EditorWindow;
45 
46 //
47 // GlobalLocalNode class definition:
48 //
49 class GlobalLocalNode : public Node
50 {
51      friend class EditorWindow; // Actually, I only want convertGetAndSetNodes() to
52 				// be able to call setAsLocal/GlobalNode().
53   private:
54     //
55     // Private member data:
56     //
57     boolean isGlobal;
58     Symbol  myNodeNameSymbol;
59 
60     void clearMyNodeName();
61     void setMyNodeNameIfNecessary();
62 
63 
64   protected:
65     //
66     // Protected member data:
67     //
68 
69     void setAsLocalNode();
70     void setAsGlobalNode();
71     void markForResend();
72 
73     boolean isLocalNode();
74     boolean isGlobalNode();
75 
76   public:
77     //
78     // Constructor:
79     //
80     GlobalLocalNode(NodeDefinition *nd, Network *net, int instnc);
81 
82     //
83     // Destructor:
84     //
85     ~GlobalLocalNode();
86 
87     //
88     // Mangle the name if this is a local or global version of this node.
89     //
90     virtual Symbol getNameSymbol();
91 
92     //
93     // The name string is normally returned by NodeDefinition however nodes
94     // of this class will not all return the same string.
95     //
96     virtual const char *getExecModuleNameString();
97 
98     //
99     // Determine if this node is a node of the given class
100     //
101     virtual boolean isA(Symbol classname);
102 
103     //
104     // Returns a pointer to the class name.
105     //
getClassName()106     const char* getClassName()
107     {
108 	return ClassGlobalLocalNode;
109     }
110 };
111 
112 
113 #endif // _GlobalLocalNode_h
114