PLplot  5.11.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
wxwidgets_comms.h
Go to the documentation of this file.
1 // Copyright (C) 2008 Werner Smekal
2 //
3 // This file is part of PLplot.
4 //
5 // PLplot is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU Library General Public License as published
7 // by the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 //
10 // PLplot is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU Library General Public License for more details.
14 //
15 // You should have received a copy of the GNU Library General Public License
16 // along with PLplot; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //
19 
20 #ifndef __PL_WXWIDGETS_COMMS__
21 #define __PL_WXWIDGETS_COMMS__
22 
23 #include "plplotP.h"
24 #ifdef WIN32
25 #include <Windows.h>
26 #else
27 #include <sys/mman.h>
28 #include <sys/stat.h>
29 #include <fcntl.h>
30 #include <semaphore.h>
31 #include <errno.h>
32 #endif
33 
34 #include <wx/font.h>
35 
36 //data transmission codes
37 const unsigned char transmissionRegular = 0;
38 const unsigned char transmissionSkipFileEnd = 1;
39 const unsigned char transmissionEndOfPage = 2;
40 const unsigned char transmissionBeginPage = 3;
41 const unsigned char transmissionLocate = 4;
42 const unsigned char transmissionPartial = 5;
43 const unsigned char transmissionComplete = 6;
44 const unsigned char transmissionRequestTextSize = 7;
45 const unsigned char transmissionEndOfPageNoPause = 8;
46 const unsigned char transmissionClose = 9;
47 
49 {
50  long width;
51  long height;
52  wxFontFamily family;
53  int style;
54  int weight;
55  int pt;
56  bool underlined;
57  wchar_t text[501];
58  bool written;
59 };
60 
62 {
63  size_t readLocation;
64  size_t writeLocation;
67  size_t completeFlag;
70 };
71 
73 
75 {
76 public:
77  PLMemoryMap();
78  PLMemoryMap( const char *name, PLINT size, bool mustExist, bool mustNotExist );
79  void create( const char *name, PLINT size, bool mustExist, bool mustNotExist );
80  void close();
81  ~PLMemoryMap();
82  char *getBuffer() { return (char *) m_buffer; }
83  bool isValid() { return m_buffer != NULL; }
84  size_t getSize() { return m_size; }
85 private:
86 #ifdef WIN32
87  HANDLE m_mapFile;
88 #else
89  int m_mapFile;
90  char * m_name;
91 #endif
92  size_t m_size;
93  void *m_buffer;
94 };
95 
97 {
98 public:
99  PLNamedMutex();
100  PLNamedMutex( const char *name, bool aquireOnCreate = false );
101  ~PLNamedMutex();
102  void create( const char *name, bool aquireOnCreate = false );
103  void clear();
104  void aquire();
105  bool aquire( unsigned long millisecs );
106  bool aquireNoWait();
107  void release();
108  bool isValid();
109 private:
111 #ifdef WIN32
112  HANDLE m_mutex;
113 #else
114  sem_t * m_mutex;
115 #endif
116 };
117 
119 {
120 public:
123 private:
125  //remove default constructors
129 };
130 
131 #endif