HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
IMG_TileInetBuf.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: IMG library internet socket interface (C++)
7  *
8  * COMMENTS: This provides a shared memory interface for read/write
9  * of tiles generated by Mantra. Mantra will write to
10  * the buffer and flag it as readable. Until the buffer
11  * has been read, the buffer is flagged as "non-writable".
12  */
13 
14 #ifndef __IMG_TileInetBuf_h__
15 #define __IMG_TileInetBuf_h__
16 
17 #include "IMG_API.h"
18 #include <UT/UT_SysClone.h>
19 #include <UT/UT_NetSocket.h>
20 #include "IMG_TileBuffer.h"
21 
22 class UT_String;
23 
25 public:
26  IMG_TileInetBuf( char *host = NULL, UT_NetSocket *theServer = NULL,
27  int port = 0 );
28 
29  ~IMG_TileInetBuf() override;
30 
31  int getTileWidth() const override { return myTW; }
32  int getTileHeight() const override { return myTH; }
33 
34  void setQuitFlag(int val=1) override;
35  int getQuitFlag() const override;
36 
37  void setMouseXY(int x, int y) override
38  { myMX = x; myMY = y; };
39  void getMouseXY(int &x, int &y) const override
40  { x = myMX; y = myMY; };
41 
42  int canWriteTile() const override;
43  int canReadTile() const override;
44 
45  void writeTile(int xl, int xr, int yb, int yt,
46  const void *data) override;
47  void readTile(IMG_Raster &rp, int *coords=0) override;
48  void getKeyString( char *str ) override;
49 
50  int getPort()
51  {
52  return myInetSocket ? myInetSocket->getPort() : 0;
53  }
54  void getStartupCommand( UT_String &cmd );
55  void sendStartupCommand( int pid, int x, int y,
56  int w, int h );
57 
58  int promptRetry();
59 
60  static int getServerPort();
61 
62 protected:
63  void setTileSize(int w, int h) override
64  {
65  myTW = w; myTH = h;
66  }
67 
68 private:
69  int myTW, myTH, myQuitFlag;
70  int myMX, myMY;
71  int myTotalData, myDataSoFar;
72  UT_NetSocket *myInetSocket;
73 };
74 
75 #endif
virtual void getKeyString(char *str)=0
virtual int canReadTile() const =0
GLuint const GLfloat * val
Definition: glew.h:2794
GLenum GLuint coords
Definition: glew.h:7906
#define IMG_API
Definition: IMG_API.h:10
void setTileSize(int w, int h) override
GLint GLint GLint GLint GLint x
Definition: glew.h:1252
virtual void writeTile(int xl, int xr, int yb, int yt, const void *data)=0
void setMouseXY(int x, int y) override
GLint GLint GLint GLint GLint GLint y
Definition: glew.h:1252
GLint GLenum GLsizei GLint GLsizei const void * data
Definition: glew.h:1379
GLubyte GLubyte GLubyte GLubyte w
Definition: glew.h:1890
void getMouseXY(int &x, int &y) const override
GLfloat GLfloat GLfloat GLfloat h
Definition: glew.h:8011
virtual int getQuitFlag() const =0
virtual int canWriteTile() const =0
virtual void readTile(IMG_Raster &rp, int *coords=0)=0
virtual void setQuitFlag(int val=1)=0
int getTileWidth() const override
int getTileHeight() const override