00001 /********************************************************************* 00002 * File: nodelink.hh * 00003 * Description: C++ HEADER File for the RCS Systems Team's Library * 00004 * Purpose: * 00005 * NODE_LINK objects form links between NODEs and their * 00006 * subordinates or NODEs that provide them with WM info. * 00007 *********************************************************************/ 00008 00009 #ifndef NODELINK_HH 00010 #define NODELINK_HH 00011 00012 /* Include Files */ 00013 #include "rcs_defs.hh" /* RCS_EXPORT */ 00014 #include "nml.hh" /* class NML */ 00015 #include "nmlmsg.hh" /* class NMLmsg */ 00016 #include "node.hh" /* class NODE */ 00017 #include "cmd_msg.hh" /* class RCS_CMD_MSG, RCS_CMD_CHANNEL */ 00018 #include "stat_msg.hh" /* class RCS_STAT_MSG, RCS_STAT_CHANNEL */ 00019 #include "wm_msg.hh" /* class RCS_WM_MSG, RCS_WM_CHANNEL */ 00020 00021 enum NODE_LINK_TYPE 00022 { 00023 NODE_WM_ONLY, 00024 NODE_SUBORDINATE_ONLY, 00025 NODE_WM_AND_SUBORDINATE, 00026 }; 00027 00028 class RCS_EXPORT NODE_LINK 00029 { 00030 RCS_CMD_CHANNEL *cmd; /* channel to subordinate's command buffer */ 00031 RCS_STAT_CHANNEL *status; /* channel to subordinate's status buffer */ 00032 RCS_WM_CHANNEL *wm; /* channel to world model buffer */ 00033 int serial_number; /* serial number used to match stats & cmds */ 00034 RCS_CMD_MSG *cmd_msg; /* pointer to command message for sub. */ 00035 int new_cmd; /* user sets to 1 to send a new command */ 00036 RCS_GENERIC_CMD *generic_command; /* Easy way to send gen. cmds. */ 00037 NODE_LINK_TYPE type_of_link; 00038 00039 friend class NODE_LINK_LIST; 00040 public: 00041 NODE_LINK (NML_FORMAT_PTR, char *name, char *file, NODE * node, 00042 NODE_LINK_TYPE link_type = NODE_WM_AND_SUBORDINATE); 00043 ~NODE_LINK (); 00044 void new_command (RCS_CMD_MSG * new_cmd_msg); /* lets user store cmd_msg. */ 00045 void new_command (RCS_GENERIC_CMD_ID); 00046 NMLTYPE status_type; /* NML type id of last status message recvd. */ 00047 RCS_STAT_MSG *status_msg; /* pointer to last status message recvd. */ 00048 int status_new; /* Was a new status message read this cycle? */ 00049 NMLTYPE prev_status_type; /* Status type of last new status message */ 00050 NMLTYPE wm_type; /* NML type id of last status message recvd. */ 00051 RCS_WM_MSG *wm_msg; /* pointer to last wm message recvd. */ 00052 int new_wm; /* Was a new wm message read this cycle? */ 00053 NODE_STATUS_TYPE node_status; /* set by get_status() */ 00054 char *name; /* string used to derive names of buffers */ 00055 NODE *parent_node; 00056 00057 int sub_list_id; /* needed for access via RCS_LINKED_LIST */ 00058 int wm_list_id; /* needed for access via RCS_LINKED_LIST */ 00059 00060 /* Operations */ 00061 int send_command (); /* send command if(new_cmd) */ 00062 int get_status (); /* read status buffer and set node_status */ 00063 int read_wm (); /* read wm buffer */ 00064 }; 00065 00066 00067 #endif