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 "IMG_TileBuffer.h"
19 #include <UT/UT_NetSocket.h>
20 #include <UT/UT_NonCopyable.h>
21 #include <UT/UT_SysClone.h>
22 
23 class UT_String;
24 
26 {
27 public:
28  IMG_TileInetBuf( char *host = NULL, UT_NetSocket *theServer = NULL,
29  int port = 0 );
30 
31  ~IMG_TileInetBuf() override;
32 
34 
35  int getTileWidth() const override { return myTW; }
36  int getTileHeight() const override { return myTH; }
37 
38  void setQuitFlag(int val=1) override;
39  int getQuitFlag() const override;
40 
41  void setMouseXY(int x, int y) override
42  { myMX = x; myMY = y; };
43  void getMouseXY(int &x, int &y) const override
44  { x = myMX; y = myMY; };
45 
46  int canWriteTile() const override;
47  int canReadTile() const override;
48 
49  void writeTile(int xl, int xr, int yb, int yt,
50  const void *data) override;
51  void readTile(IMG_Raster &rp, int *coords=0) override;
52  void getKeyString( char *str ) override;
53 
54  int getPort()
55  {
56  return myInetSocket ? myInetSocket->getPort() : 0;
57  }
58  void getStartupCommand( UT_String &cmd );
59  void sendStartupCommand( int pid, int x, int y,
60  int w, int h );
61 
62  int promptRetry();
63 
64  static int getServerPort();
65 
66 protected:
67  void setTileSize(int w, int h) override
68  {
69  myTW = w; myTH = h;
70  }
71 
72 private:
73  int myTW, myTH, myQuitFlag;
74  int myMX, myMY;
75  int myTotalData, myDataSoFar;
76  UT_NetSocket *myInetSocket;
77 };
78 
79 #endif
virtual void getKeyString(char *str)=0
typedef int(APIENTRYP RE_PFNGLXSWAPINTERVALSGIPROC)(int)
virtual int canReadTile() const =0
GLint y
Definition: glcorearb.h:103
#define IMG_API
Definition: IMG_API.h:10
void setTileSize(int w, int h) override
virtual void writeTile(int xl, int xr, int yb, int yt, const void *data)=0
void setMouseXY(int x, int y) override
#define UT_NON_COPYABLE(CLASS)
Define deleted copy constructor and assignment operator inside a class.
GLuint coords
Definition: glad.h:4091
void getMouseXY(int &x, int &y) const override
GLint GLenum GLint x
Definition: glcorearb.h:409
virtual int getQuitFlag() const =0
GLfloat GLfloat GLfloat GLfloat h
Definition: glcorearb.h:2002
virtual int canWriteTile() const =0
virtual void readTile(IMG_Raster &rp, int *coords=0)=0
GLuint GLfloat * val
Definition: glcorearb.h:1608
virtual void setQuitFlag(int val=1)=0
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:857
int getTileHeight() const override
Definition: format.h:895