-
Notifications
You must be signed in to change notification settings - Fork 1
/
node.h
123 lines (84 loc) · 3.74 KB
/
node.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#ifndef NODE_H
#define NODE_H
// {{SMILE_PUBLIC_HEADER}}
#include "generalclases.h"
class DSL_nodeDefinition;
class DSL_nodeValue;
class DSL_nodeCost;
//////////////////////////////////////////////////////////////////////////////
// class DSL_nodeInfo
//////////////////////////////////////////////////////////////////////////////
class DSL_nodeInfo : public DSL_object // this "class" just holds all the "not so important" info
{
protected:
DSL_header header; // id, name, comment, etc
DSL_screenInfo screen; // size, position, color, etc
DSL_userProperties userProperties; // user-defined properties...
DSL_documentation documentation; // documentation for the node
public:
DSL_nodeInfo(void) {CheckReadiness();};
DSL_nodeInfo(DSL_nodeInfo &likeThisOne);
int operator =(DSL_nodeInfo &likeThisOne);
DSL_header &Header(void) {return(header);};
DSL_screenInfo &Screen(void) {return(screen);};
DSL_userProperties &UserProperties(void) {return(userProperties);};
DSL_documentation &Documentation(void) {return(documentation);};
};
//////////////////////////////////////////////////////////////////////////////
// class DSL_node
//////////////////////////////////////////////////////////////////////////////
class DSL_network;
class DSL_extraDefinition;
class DSL_node : public DSL_object
{
protected:
DSL_nodeInfo *info; // information "irrelevant" for reasoning
DSL_nodeDefinition *def; // Definition of the node
DSL_nodeValue *val; // Value of the node
DSL_nodeCost *observCost; // Cost of observing the state of the node
DSL_extraDefinition *extraDef; // holds some custom information
DSL_network *network; // (points to) the network I am included in
int handle;
int submodel; // the (graphical) submodel I belong to (MOVE SOMEWHERE ELSE!!!)
public:
DSL_node(int type, int theID, DSL_network *theNetwork);
DSL_node(DSL_node &likeThisOne);
~DSL_node() {CleanUp();};
int operator =(DSL_node &likeThisOne);
// fast operations
DSL_node(DSL_node &likeThisOne, bool fast);
int FastCopy(DSL_node &likeThisOne);
DSL_nodeInfo &Info(void) {return(*info);};
DSL_network *Network(void) {return(network);};
DSL_nodeDefinition *Definition(void) {return(def);};
DSL_nodeValue *Value(void) {return(val);};
DSL_nodeCost *ObservCost(void) {return(observCost);};
DSL_extraDefinition *ExtraDefinition(void) {return(extraDef);};
int Handle(void) {return(handle);};
const char* GetId() const;
int SetId(const char *newId);
int GetSubmodel(void) {return(submodel);};
int SetSubmodel(int thisSubmodel);
int SetSubmodel(char *thisSubmodel);
int SetNetwork(DSL_network *thisOne);
void SetDefinition(DSL_nodeDefinition &thisOne) {def = &thisOne;};
void SetValue(DSL_nodeValue &thisOne) {val = &thisOne;};
void InheritAspect();
void CleanUp(int deep = 0);
void CheckReadiness(int deep = 0);
void CheckConsistency(int deep = 0);
int CreateDefinition(int thisType);
int CreateValue(int thisType);
int ChangeType(int newType);
int CreateDefinition(DSL_nodeDefinition &likeThisOne);
int CreateValue(DSL_nodeValue &likeThisOne);
int NodeTypeFromName(const char *typeName);
int ChangeType(const char *typeName);
int CheckNetworkStructure(int warnChildren);
/////////// THERE GUYS ARE TO BE REMOVED!!! DO NOT USE THEM!!!
DSL_intArray &Parents(void);
DSL_intArray &Children(void);
private:
int CreateExtraDefinition(void);
};
#endif