MNE-CPP  beta 1.0
shmemsocket.h
Go to the documentation of this file.
1 //=============================================================================================================
36 #ifndef SHMEMSOCKET_H
37 #define SHMEMSOCKET_H
38 
39 //*************************************************************************************************************
40 //=============================================================================================================
41 // INCLUDES
42 //=============================================================================================================
43 
44 #include "types_definitions.h"
45 #include <fiff/fiff_tag.h>
46 
47 
48 //*************************************************************************************************************
49 //=============================================================================================================
50 // QT INCLUDES
51 //=============================================================================================================
52 
53 #include <QObject>
54 
55 
56 //*************************************************************************************************************
57 //=============================================================================================================
58 // DEFINE NAMESPACE NeuromagPlugin
59 //=============================================================================================================
60 
61 namespace NeuromagPlugin
62 {
63 
64 
65 //*************************************************************************************************************
66 //=============================================================================================================
67 // USED NAMESPACES
68 //=============================================================================================================
69 
70 using namespace FIFFLIB;
71 
72 
73 //*************************************************************************************************************
74 //=============================================================================================================
75 // FORWARD DECLARATIONS
76 //=============================================================================================================
77 
78 //class FiffTag;
79 
80 
81 //=============================================================================================================
88 class ShmemSocket : public QObject
89 {
90  Q_OBJECT
91 public:
92  explicit ShmemSocket(QObject *parent = 0);
93 
94  virtual ~ShmemSocket();
95 
96 
97  // client_socket.c
98  //=========================================================================================================
117  int receive_tag (FiffTag::SPtr& p_pTag);
118 
119  //ToDo Connect is different? to: telnet localhost collector ???
120  //=========================================================================================================
126  bool connect_client ();
127 
128  //=========================================================================================================
134  int disconnect_client ();
135 
136  //=========================================================================================================
137  /*
138  * Select tags that we are not interested in!
139  *
140  */
141  void set_data_filter (int *kinds, int nkind);
142 
143  //=========================================================================================================
148  void close_socket ();
149 
150  //=========================================================================================================
155  int connect_disconnect (int sock,int id);
156 
157  //=========================================================================================================
164  int interesting_data (int kind);
165 
166 
167 
168 
169 private:
170 
171  // shmem.c
172  //=========================================================================================================
177  dacqShmBlock get_shmem();
178 
179  //=========================================================================================================
185  int init_shmem();
186 
187 
188  //=========================================================================================================
194  int release_shmem();
195 
196 
197  //=========================================================================================================
202  FILE* open_fif (char *name);
203 
204 
205  //=========================================================================================================
215  int read_fif (FILE *fd, long pos, size_t size, char *data);
216 
217 
218 private:
219 
220  int* filter_kinds;
221  int nfilt;
223  int shmid;
224  dacqShmBlock shmptr;
225 
226  int m_iShmemSock;
227  int m_iShmemId;
228 
229  FILE *fd; /* The temporary file */
230  FILE *shmem_fd;
231  char *filename;
232 
233  long read_loc;
234  FILE *read_fd;
235 
236 
237 signals:
238 
239 public slots:
240 
241 };
242 
243 } // NAMESPACE
244 
245 #endif // SHMEMSOCKET_H
QSharedPointer< FiffTag > SPtr
Definition: fiff_tag.h:166
Neuromag Types and Defines.
Definition: fiff.h:98
The ShmemSocket class provides...
Definition: shmemsocket.h:88
FiffTag class declaration, which provides fiff tag I/O and processing methods.