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 #ifndef _ModuleMessagingNode_h
14 #define _ModuleMessagingNode_h
15 
16 
17 #include "Node.h"
18 
19 
20 //
21 // Class name definition:
22 //
23 #define ClassModuleMessagingNode	"ModuleMessagingNode"
24 
25 //
26 // Referenced Classes
27 //
28 class NodeDefinition;
29 class Network;
30 
31 //
32 // ModuleMessagingNode class definition:
33 //
34 class ModuleMessagingNode : public Node
35 {
36   private:
37     //
38     // Private member data:
39     //
40 
41   protected:
42     //
43     // Protected member data:
44     //
45 
46     //
47     // Return TRUE/FALSE, indicating whether or not we support a message
48     // protocol between the executive module that runs for this node and the
49     // UI.
50     //
hasModuleMessageProtocol()51     virtual boolean hasModuleMessageProtocol() { return TRUE; }
52 
53     //
54     // Return TRUE/FALSE, indicating whether or not we expect to receive
55     // a message from the UI when our module executes in the executive.
56     //
expectingModuleMessage()57     virtual boolean expectingModuleMessage() { return TRUE; }
58 
59     //
60     // Called when a message is received from the executive after
61     // this->ExecModuleMessageHandler() is registered in
62     // this->Node::netPrintNode() to receive messages for this node.
63     // The format of the message coming back is defined by the derived class.
64     //
65     virtual void execModuleMessageHandler(int id, const char *line) = 0;
66 
67     //
68     // Returns a string that is used to register
69     // this->ExecModuleMessageHandler(). Be default we use the super class'
70     // method.
71     //
72     // virtual const char *getModuleMessageIdString();
73 
74 
75   public:
76     //
77     // Constructor:
78     //
ModuleMessagingNode(NodeDefinition * nd,Network * net,int instnc)79     ModuleMessagingNode(NodeDefinition *nd, Network *net, int instnc)
80 			: Node(nd,net,instnc)  {}
81 
82     //
83     // Destructor:
84     //
~ModuleMessagingNode()85     ~ModuleMessagingNode() {}
86 
87     //
88     // Determine if this node is a node of the given class
89     //
90     virtual boolean isA(Symbol classname);
91 
92     //
93     // Returns a pointer to the class name.
94     //
getClassName()95     const char* getClassName()
96     {
97 	return ClassModuleMessagingNode;
98     }
99 };
100 
101 
102 #endif // _ModuleMessagingNode_h
103