COVISE Core
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
VRBClient.h
Go to the documentation of this file.
1 /* This file is part of COVISE.
2 
3  You can use it under the terms of the GNU Lesser General Public License
4  version 2.1 or later, see lgpl-2.1.txt.
5 
6  * License: LGPL 2+ */
7 
8 #ifndef _VRB_CLIENT_H
9 #define _VRB_CLIENT_H
10 #include <stdio.h>
11 #include <future>
12 #include <mutex>
13 #include <util/DLinkList.h>
14 #include <util/coTypes.h>
15 namespace covise
16 {
17 
18 class Host;
19 class CoviseConfig;
20 class ClientConnection;
21 class Message;
22 class TokenBuffer;
23 
24 //
25 //
26 //
27 
29 {
30 
31 public:
32  VRBClient(const char *name, const char *collaborativeConfigurationFile = NULL, bool isSlave = false);
33  VRBClient(const char *name, const char *host, int pPort, bool isSlave = false);
34  ~VRBClient();
35  int connectToServer(); // returns -1, if Connection to Server fails
36  void connectToCOVISE(int argc, const char **argv);
37  int isCOVERRunning();
38  int isConnected();
39  int poll(Message *m);
40  int wait(Message *m);
41  int wait(Message *m, int messageType);
42  int setUserInfo(const char *userInfo);
43  int sendMessage(const Message *m);
44  void sendMessage(TokenBuffer &tb, int type);
45  int getID();
46  void setID(int ID);
48  float getSendDelay();
49 
50 private:
51  ClientConnection *sConn; // connection to Server
52  char *name;
53  int port;
54  int ID;
56  bool isSlave; // it true, we are a slave in a multiPC config, so do not actually connect to server
57  float sendDelay; // low-pass filtered time for sending one packet of 1000 bytes
58  std::mutex connMutex;
59  std::future<ClientConnection *> connFuture;
60  bool firstVrbConnection = true;
61 };
62 }
63 #endif
std::future< ClientConnection * > connFuture
Definition: VRBClient.h:59
DLinkList< Message * > messageQueue
Definition: VRBClient.h:47
#define ID(x)
Definition: coObjID.cpp:18
GLuint const GLchar * name
Definition: khronos-glext.h:6722
Definition: covise_host.h:18
int port
Definition: VRBClient.h:53
Host * serverHost
Definition: VRBClient.h:55
std::mutex connMutex
Definition: VRBClient.h:58
bool isSlave
Definition: VRBClient.h:56
const GLfloat * m
Definition: khronos-glext.h:12117
Definition: DLinkList.h:59
Definition: covise_connect.h:241
float sendDelay
Definition: VRBClient.h:57
#define VRBEXPORT
Definition: coExport.h:81
int ID
Definition: VRBClient.h:54
Definition: VRBClient.h:28
ClientConnection * sConn
Definition: VRBClient.h:51
char * name
Definition: VRBClient.h:52
GLenum type
Definition: khronos-glext.h:6279
#define NULL
Definition: covise_list.h:22
Definition: tokenbuffer.h:74
Definition: message.h:111