PLplot  5.12.0
 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 #include "wxPLplot_nanosec.h"
36 
37 //data transmission codes
38 const unsigned char transmissionRegular = 0;
39 const unsigned char transmissionSkipFileEnd = 1;
40 const unsigned char transmissionEndOfPage = 2;
41 const unsigned char transmissionBeginPage = 3;
42 const unsigned char transmissionLocate = 4;
43 const unsigned char transmissionPartial = 5;
44 const unsigned char transmissionComplete = 6;
45 const unsigned char transmissionRequestTextSize = 7;
46 const unsigned char transmissionEndOfPageNoPause = 8;
47 const unsigned char transmissionClose = 9;
48 
49 #define TEXTSIZEINFO_MAX_LENGTH 500
50 
52 {
53  long width;
54  long height;
55  long depth;
56  long leading;
57  wxFontFamily family;
58  int style;
59  int weight;
60  int pt;
61  bool underlined;
63  bool written;
64 };
65 
67 {
68  size_t readLocation;
69  size_t writeLocation;
72  size_t completeFlag;
75 };
76 
78 
80 {
81 public:
82  PLMemoryMap();
83  PLMemoryMap( const char *name, PLINT size, bool mustExist, bool mustNotExist );
84  void create( const char *name, PLINT size, bool mustExist, bool mustNotExist );
85  void close();
86  ~PLMemoryMap();
87  char *getBuffer() { return (char *) m_buffer; }
88  bool isValid() { return m_buffer != NULL; }
89  size_t getSize() { return m_size; }
90 private:
91 #ifdef WIN32
92  HANDLE m_mapFile;
93 #else
94  int m_mapFile;
95  char * m_name;
96 #endif
97  size_t m_size;
98  void *m_buffer;
99 };
100 
102 {
103 public:
104  PLNamedMutex();
105  PLNamedMutex( const char *name, bool aquireOnCreate = false );
106  ~PLNamedMutex();
107  void create( const char *name, bool aquireOnCreate = false );
108  void clear();
109  void aquire();
110  bool aquire( unsigned long millisecs );
111  bool aquireNoWait();
112  void release();
113  bool isValid();
114 private:
116 #ifdef WIN32
117  HANDLE m_mutex;
118 #else
119  sem_t * m_mutex;
120 #endif
121 };
122 
124 {
125 public:
128 private:
130  //remove default constructors
134 };
135 
136 #endif
#define TEXTSIZEINFO_MAX_LENGTH
static const char * name
Definition: tkMain.c:135
TextSizeInfo textSizeInfo
const unsigned char transmissionRegular
const unsigned char transmissionLocate
char * getBuffer()
PLNamedMutex * m_mutex
size_t getSize()
const unsigned char transmissionClose
int PLINT
Definition: plplot.h:174
const PLINT plMemoryMapReservedSpace
void create(const char *name, bool aquireOnCreate=false)
PLNamedMutexLocker & operator=(const PLNamedMutex &)
const unsigned char transmissionComplete
const unsigned char transmissionBeginPage
const unsigned char transmissionPartial
PLGraphicsIn graphicsIn
wxFontFamily family
const unsigned char transmissionSkipFileEnd
const unsigned char transmissionRequestTextSize
wchar_t text[TEXTSIZEINFO_MAX_LENGTH+1]
void create(const char *name, PLINT size, bool mustExist, bool mustNotExist)
const unsigned char transmissionEndOfPageNoPause
const unsigned char transmissionEndOfPage