CARMA C++
NetCommHandler.h
Go to the documentation of this file.
1 #ifndef SZA_UTIL_NETCOMMHANDLER_H
2 #define SZA_UTIL_NETCOMMHANDLER_H
3 
11 #include "carma/szautil/AntNum.h"
14 
15 namespace sza {
16  namespace util {
17 
18  class NetCommHandler {
19  public:
20 
24  NetCommHandler();
25 
29  virtual ~NetCommHandler();
30 
34  void attachReadStream(int fd);
35 
39  void attachSendStream(int fd);
40 
44  void attach(int fd);
45 
49  void packNetMsg(NetMsg* msg);
50 
54  void packNetCmd(NetCmd* cmd);
55 
59  void packRtcNetCmd(sza::array::RtcNetCmd* cmd,
60  sza::array::NetCmdId opcode);
61 
65  sza::util::NetReadStr::NetReadId readNetMsg();
66 
70  sza::util::NetSendStr::NetSendId sendNetMsg();
71 
75  sza::util::NetReadStr::NetReadId readNetCmd();
76 
80  sza::util::NetSendStr::NetSendId sendNetCmd();
81 
85  sza::util::NetCmd* getLastReadNetCmd();
86 
90  sza::util::NetCmd* getLastSentNetCmd();
91 
95  sza::util::NetMsg* getLastReadNetMsg();
96 
100  sza::util::NetMsg* getLastSentNetMsg();
101 
105  int getReadFd();
106 
107  /*
108  * Return the fd that our send streams are attached to.
109  */
110  int getSendFd();
111 
115  int getFd();
116 
120  NetMsgHandler* getNetMsgHandler();
121 
125  NetCmdHandler* getNetCmdHandler();
126 
130  inline AntNum::Id getId() {
131  return antNum_.getId();
132  }
133 
134  inline unsigned getIntId() {
135  return antNum_.getIntId();
136  }
137 
141  inline void setId(AntNum::Id id) {
142  antNum_.setId(id);
143  }
144 
145  private:
146 
147  int readFd_;
148  int sendFd_;
149  AntNum antNum_;
150  NetMsgHandler netMsgHandler_;
151  NetCmdHandler netCmdHandler_;
152 
153  }; // End class NetCommHandler
154 
155  } // End namespace util
156 } // End namespace sza
157 
158 
159 
160 #endif // End #ifndef SZA_UTIL_NETCOMMHANDLER_H
Tagged: Mon Mar 15 18:24:26 UTC 2004.
Started: Thu Feb 26 16:21:06 UTC 2004.
Tagged: Fri Nov 14 12:39:31 UTC 2003.
Id
Enumerate known receivers.
Definition: AntNum.h:35