My Project
 All Classes Files Functions Variables Enumerations Enumerator Friends Macros Pages
XMLConsumer.h
Go to the documentation of this file.
1 #ifndef GCP_RECEIVER_XMLCONSUMER_H
2 #define GCP_RECEIVER_XMLCONSUMER_H
3 
12 #include "Utilities/HardwareManagerClient.h"
13 
14 #include "gcp/util/common/GenericTask.h"
15 
16 #include "gcp/mediator/specific/ScannerMsg.h"
17 
18 #include "gcp/receiver/specific/XMLDataFrameManager.h"
19 
20 namespace gcp {
21 
22  namespace mediator {
23  class Scanner;
24  }
25 
26 
27  namespace receiver {
28 
29  class XMLConsumer :
30  public gcp::util::GenericTask<gcp::mediator::ScannerMsg> {
31 
32  public:
33 
35  gcp::mediator::Scanner* scanner,
36  std::string regMapName,
37  std::string host="localhost",
38  unsigned short port=5207,
39  bool send_connect_request=true);
40 
44  virtual ~XMLConsumer();
45 
46  void sendDispatchDataFrameMsg();
47 
52  friend class gcp::mediator::Scanner;
53 
54  static const unsigned nConnAttemptBeforeReport_ = 30;
55 
56  protected:
57 
58  // Process a message received on our message queue
59 
60  virtual void processMsg(gcp::mediator::ScannerMsg* msg);
61 
62  // Get the next set of data from the server
63 
64  virtual bool getData();
65 
66  // Check that we have a valid client connection
67 
68  virtual bool checkClient();
69 
70  // Register a communciation error
71 
72  void registerError();
73 
74  // Report a connection error
75 
76  virtual void reportError();
77  virtual void reportSuccess();
78 
79  // Generic method to send a command to the HWM
80 
81  bool commandPending_;
82 
83  unsigned nConnAttempt_;
84 
85  gcp::mediator::Scanner* parent_;
86 
87  std::string regMapName_;
88 
89  std::string host_; // Data server host name
90 
91  unsigned short port_; // Data server TCP port
92 
93  bool send_connect_request_;
94  bool connected_;
95  int clientFd_;
96 
98 
99  MuxReadout::HardwareManagerClient* client_;
100 
101  }; // End class XMLConsumer
102 
103  } // End namespace receiver
104 } // End namespace gcp
105 
106 #endif // End #ifndef
virtual void reportSuccess()
Definition: XMLConsumer.cc:193
virtual bool getData()
Definition: XMLConsumer.cc:175
virtual ~XMLConsumer()
Definition: XMLConsumer.cc:47
void registerError()
Definition: XMLConsumer.cc:137
virtual void reportError()
Definition: XMLConsumer.cc:183
Definition: Scanner.h:58
Definition: ScannerMsg.h:18
Definition: XMLConsumer.h:29
virtual void processMsg(gcp::mediator::ScannerMsg *msg)
Definition: XMLConsumer.cc:98
Definition: XMLDataFrameManager.h:30
XMLConsumer(gcp::receiver::XMLDataFrameManager *dataFrame, gcp::mediator::Scanner *scanner, std::string regMapName, std::string host="localhost", unsigned short port=5207, bool send_connect_request=true)
Definition: XMLConsumer.cc:21
Definition: GenericTask.h:33
virtual bool checkClient()
Definition: XMLConsumer.cc:65