📄 node.h
字号:
/******************************************* * * general node used in a factor graph * *******************************************/#ifndef NODE#define NODE#include <stddef.h>#include <stdio.h>class Node {protected: // name of this node char name[20]; // identification number int id; // number of neighbours of this node int numNeighbours; // actual messages flowing out of this node double *(*outMessages); public: // array of pointers to all neighbours Node *(*neighbours); // array of port numbers of this node with respect to the according neighbour int *portNumbers; // default constructor Node(void); // constructor Node(const char *name, int id, int numNeighbours); // destructor virtual ~Node(void); // connects two nodes in the following way: // (node1, port1) <--> (node2, port2) static void connect(Node *node1, Node *node2, int port1, int port2, int alphabetSize); // disconnects two nodes // - return value: 0, if the two nodes were connected before // -1, otherwise static int disconnect(Node *node1, Node *node2); // disconnects this node and the one at the specified port // - return value: 0, if the two nodes were connected before // -1, otherwise int disconnect(int port); // returns the outflowing message at the specified port double *getOutMessage(int port); // updates the outflowing message at the specified port virtual void update(int port) = 0; // updates all outflowing messages of this node virtual void updateAll(void); // resets all outflowing messages virtual void reset(void) = 0; const char *getName(void); int getID(void); int getNumNeighbours(void); int getPortNumber(int neighbour); // issues a textual description of the current configuration of this node to standard output // (for debugging purposes) virtual void draw(void); // test method static void test(void);};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -