CARMA C++
FastPdbClientTask.h
Go to the documentation of this file.
1 // $Id: FastPdbClientTask.h,v 1.1 2014/05/05 22:51:57 eml Exp $
2 
3 #ifndef SZA_UTIL_FASTPDBCLIENTTASK_H
4 #define SZA_UTIL_FASTPDBCLIENTTASK_H
5 
18 
19 #define MAX_NAME_LEN 100
20 
21 #define FASTPDB_CALLBACK_FN(fn) void (fn)(std::string s)
22 
23 namespace sza {
24  namespace util {
25 
26  class CondVar;
27 
28  //------------------------------------------------------------
29  // A message class for use with this task
30  //------------------------------------------------------------
31 
32  class FastPdbClientMsg : public GenericTaskMsg {
33  public:
34 
35  enum MsgType {
36  SRCLIST = 0x1,
37  PROJLIST = 0x2,
38  };
39 
40  union {
41  char source[MAX_NAME_LEN+1];
42  char project[MAX_NAME_LEN+1];
43  } body;
44 
45  FASTPDB_CALLBACK_FN(*callback);
46 
47  // A type for this message
48 
49  MsgType type;
50  };
51 
52  //------------------------------------------------------------
53  // Test class for communicating with RtdServer
54  //------------------------------------------------------------
55 
56  class FastPdbClientTask : public ClientTask<FastPdbClientMsg> {
57  public:
58 
59 
63  FastPdbClientTask(bool spawn, std::string host, unsigned connectPort, CondVar* condVar=0);
64 
68  virtual ~FastPdbClientTask();
69 
70  virtual void processServerData();
71  virtual void processMsg(FastPdbClientMsg* msg);
72 
73  void sendListSourceMsg(std::string source, FASTPDB_CALLBACK_FN(*callback)=0);
74  void sendListProjectMsg(std::string project, FASTPDB_CALLBACK_FN(*callback)=0);
75 
76  void serviceMsgQ();
77 
78  private:
79 
80  CondVar* condVar_;
81  FastPdbData data_;
82  FASTPDB_CALLBACK_FN(*callback_);
83 
84  }; // End class FastPdbClientTask
85 
86  } // End namespace util
87 } // End namespace sza
88 
89 
90 
91 #endif // End #ifndef SZA_UTIL_FASTPDBCLIENTTASK_H
virtual void processMsg(Msg *msg)
This method should be defined by each inheriting task to process its own task-specific messages...
Definition: SpawnableTask.h:57
Tagged: Wed 01-Feb-06 10:43:27.
Tagged: Fri Nov 14 12:39:34 UTC 2003.
Tagged: Tue Feb 18 13:08:16 PST 2014.