Fawkes API  Fawkes Development Version
fuse_server_client_thread.h
1 
2 /***************************************************************************
3  * fuse_server_client_thread.h - client thread for FuseServer
4  *
5  * Created: Tue Nov 13 19:59:11 2007
6  * Copyright 2005-2007 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 #ifndef __FIREVISION_FVUTILS_NET_FUSE_SERVER_CLIENT_THREAD_H_
25 #define __FIREVISION_FVUTILS_NET_FUSE_SERVER_CLIENT_THREAD_H_
26 
27 #include <core/threading/thread.h>
28 
29 #include <map>
30 #include <string>
31 
32 namespace fawkes {
33  class StreamSocket;
34 }
35 namespace firevision {
36 #if 0 /* just to make Emacs auto-indent happy */
37 }
38 #endif
39 
40 class FuseServer;
41 class FuseNetworkMessageQueue;
42 class FuseNetworkMessage;
43 class SharedMemoryImageBuffer;
44 class SharedMemoryLookupTable;
45 class JpegImageCompressor;
46 
48 {
49  public:
52  virtual ~FuseServerClientThread();
53 
54  void recv();
55  void send();
56  virtual void loop();
57 
58  void process_greeting_message(FuseNetworkMessage *m);
59  void process_getimage_message(FuseNetworkMessage *m);
60  void process_getimageinfo_message(FuseNetworkMessage *m);
61  void process_getimagelist_message(FuseNetworkMessage *m);
62  void process_getlut_message(FuseNetworkMessage *m);
63  void process_setlut_message(FuseNetworkMessage *m);
64  void process_getlutlist_message(FuseNetworkMessage *m);
65 
66  private:
67  void process_inbound();
68  SharedMemoryImageBuffer * get_shmimgbuf(const char *id);
69 
70  FuseServer *__fuse_server;
71  fawkes::StreamSocket *__socket;
72 
73  FuseNetworkMessageQueue *__outbound_queue;
74  FuseNetworkMessageQueue *__inbound_queue;
75 
76  JpegImageCompressor *__jpeg_compressor;
77 
78  std::map< std::string, SharedMemoryImageBuffer * > __buffers;
79  std::map< std::string, SharedMemoryImageBuffer * >::iterator __bit;
80 
81  std::map< std::string, SharedMemoryLookupTable * > __luts;
82  std::map< std::string, SharedMemoryLookupTable * >::iterator __lit;
83 
84  bool __alive;
85 };
86 
87 } // end namespace firevision
88 
89 #endif
FireVision FUSE protocol server.
Definition: fuse_server.h:46
Fawkes library namespace.
Thread class encapsulation of pthreads.
Definition: thread.h:42
TCP stream socket over IP.
Definition: stream.h:31
Jpeg image compressor.
FUSE Network Message.
Definition: fuse_message.h:41
A LockQueue of FuseNetworkMessage to hold messages in inbound and outbound queues.
Shared memory image buffer.
Definition: shm_image.h:181