client.hh
Go to the documentation of this file.
1 //
2 // client-cpp.hh
3 // C++ CORBA client interface for SceneViewer.
4 //
5 // Created by Mathieu Geisert in December 2014.
6 // Copyright (c) 2014 LAAS-CNRS. All rights reserved.
7 //
8 
9 #ifndef SCENEVIEWER_CORBASERVER_CLIENTCPP_HH
10 #define SCENEVIEWER_CORBASERVER_CLIENTCPP_HH
11 
12 #include <iostream>
13 #include <omniORB4/CORBA.h>
14 #include <gepetto/viewer/corba/graphical-interface.hh>
15 
16 
17 namespace gepetto {
18 namespace viewer {
19 namespace corba {
20  class Client
21  {
22  public:
23  typedef CORBA::ULong WindowID;
24 
25  Client (int argc, char* argv[]);
26 
27  ~Client ();
28 
29  void connect (const std::string& iiop = "corbaloc:iiop:");
30 
31  gepetto::corbaserver::GraphicalInterface_var& gui () {
32  return gui_;
33  }
34 
35  private:
36  bool createFromDirectLink(const std::string& iiop);
37  bool createFromNameService(const std::string& iiop);
38 
39  corbaserver::GraphicalInterface_var gui_;
40 
41  CORBA::ORB_var orb_;
42  };
43 
48  void connect (const char* windowName = NULL, bool dontRaise = false,
49  const char* url = NULL, const char* host = "localhost",
50  const int port = 12321);
51 
53  corbaserver::GraphicalInterface_var& gui ();
54 
56  inline bool connected ()
57  {
58  return !CORBA::is_nil(gui());
59  }
60 
67  inline corbaserver::GraphicalInterface_var& gui (const char* windowName,
68  bool dontRaise = false, const char* url = NULL,
69  const char* host = "localhost", const int port = 12321)
70  {
71  connect (windowName, dontRaise, url, host, port);
72  return gui();
73  }
74 
75 #if __cplusplus >= 201103L
76  constexpr corbaserver::Color
77  white { 1.0f, 1.0f, 1.0f, 1.0f },
78  lightWhite { 0.9f, 0.9f, 0.9f, 1.0f },
79  green { 0.0f, 1.0f, 0.0f, 1.0f },
80  lightGreen { 0.0f, 0.9f, 0.0f, 1.0f },
81  yellow { 1.0f, 1.0f, 0.0f, 1.0f },
82  lightYellow { 0.9f, 0.9f, 0.0f, 1.0f },
83  blue { 0.0f, 0.0f, 1.0f, 1.0f },
84  lightBlue { 0.0f, 0.0f, 0.9f, 1.0f },
85  grey { 0.7f, 0.7f, 0.7f, 1.0f },
86  lightGrey { 0.7f, 0.7f, 0.7f, 0.7f },
87  red { 1.0f, 0.0f, 0.0f, 1.0f },
88  lightRed { 0.9f, 0.0f, 0.0f, 1.0f },
89  black { 0.0f, 0.0f, 0.0f, 1.0f },
90  lightBlack { 0.1f, 0.1f, 0.1f, 1.0f },
91  brown {0.85f, 0.75f, 0.15f, 1.0f },
92  lightBrown {0.75f, 0.65f, 0.10f, 1.0f };
93 #endif
94 
95 } //end of namespace corba
96 } //end of namespace viewer
97 } //end of namespace gepetto
98 
99 #endif // SCENEVIEWER_CORBASERVER_CLIENTCPP_HH
Helper class.
Definition: __init__.py:8
Client(int argc, char *argv[])
Definition: client.hh:20
void connect(const std::string &iiop="corbaloc:iiop:")
CORBA::ULong WindowID
Definition: client.hh:23
bool connected()
Tells whether the connection to the gui is ok.
Definition: client.hh:56
gepetto::corbaserver::GraphicalInterface_var & gui()
Definition: client.hh:31