My Project
 All Classes Files Functions Variables Enumerations Enumerator Friends Macros Pages
NetTermHandler.h
Go to the documentation of this file.
1 #ifndef GCP_UTIL_NETTERMHANDLER_H
2 #define GCP_UTIL_NETTERMHANDLER_H
3 
11 #include <string>
12 #include "gcp/util/common/NetHandler.h"
13 
14 namespace gcp {
15  namespace util {
16 
21  class NetTermHandler : public NetHandler {
22  public:
23 
24  enum MsgType {
25  NONE, // An initializer
26  LINE, // A line of text has been sent
27  SHUTDOWN, // A message from the server that it is shutting
28  // down
29  DISCONNECT, // A message from a client that it is
30  // disconnecting
31  };
32 
37 
41  NetTermHandler(int fd);
42 
46  virtual ~NetTermHandler();
47 
51  MsgType getLastMsgType();
52 
56  std::string getLastLine();
57 
61  void sendLine(std::string& line);
62 
63  private:
64 
65  static const unsigned LINE_LEN;
66  static const unsigned BUF_SIZE;
67 
68  MsgType lastMsgType_;
69 
70  std::string lastLine_;
71 
75  static NET_READ_HANDLER(readMsg);
76 
77  }; // End class NetTermHandler
78 
79  } // End namespace util
80 } // End namespace gcp
81 
82 
83 
84 
85 #endif // End #ifndef GCP_UTIL_NETTERMHANDLER_H
NetTermHandler()
Definition: NetTermHandler.cc:22
void sendLine(std::string &line)
Definition: NetTermHandler.cc:87
MsgType getLastMsgType()
Definition: NetTermHandler.cc:77
Definition: NetHandler.h:16
std::string getLastLine()
Definition: NetTermHandler.cc:82
Definition: NetTermHandler.h:21
virtual ~NetTermHandler()
Definition: NetTermHandler.cc:53