gepetto-viewer-corba  6.0.0
Corba server for gepetto-viewer
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 <omniORB4/CORBA.h>
13 
14 #include <gepetto/viewer/corba/graphical-interface.hh>
15 #include <iostream>
16 
17 namespace gepetto {
18 namespace viewer {
19 namespace corba {
20 class Client {
21  public:
22  typedef CORBA::ULong WindowID;
23 
24  Client(int argc, char* argv[]);
25 
27 
28  void connect(const std::string& iiop = "corbaloc:iiop:");
29 
30  gepetto::corbaserver::GraphicalInterface_var& gui() { return gui_; }
31 
32  private:
33  bool createFromDirectLink(const std::string& iiop);
34  bool createFromNameService(const std::string& iiop);
35 
36  corbaserver::GraphicalInterface_var gui_;
37 
38  CORBA::ORB_var orb_;
39 };
40 
46 void connect(const char* windowName = NULL, bool dontRaise = false,
47  const char* url = NULL, const char* host = "localhost",
48  const int port = 12321);
49 
51 corbaserver::GraphicalInterface_var& gui();
52 
54 inline bool connected() { return !CORBA::is_nil(gui()); }
55 
62 inline corbaserver::GraphicalInterface_var& gui(const char* windowName,
63  bool dontRaise = false,
64  const char* url = NULL,
65  const char* host = "localhost",
66  const int port = 12321) {
67  connect(windowName, dontRaise, url, host, port);
68  return gui();
69 }
70 
71 #if __cplusplus >= 201103L
72 constexpr corbaserver::Color white{1.0f, 1.0f, 1.0f, 1.0f},
73  lightWhite{0.9f, 0.9f, 0.9f, 1.0f}, green{0.0f, 1.0f, 0.0f, 1.0f},
74  lightGreen{0.0f, 0.9f, 0.0f, 1.0f}, yellow{1.0f, 1.0f, 0.0f, 1.0f},
75  lightYellow{0.9f, 0.9f, 0.0f, 1.0f}, blue{0.0f, 0.0f, 1.0f, 1.0f},
76  lightBlue{0.0f, 0.0f, 0.9f, 1.0f}, grey{0.7f, 0.7f, 0.7f, 1.0f},
77  lightGrey{0.7f, 0.7f, 0.7f, 0.7f}, red{1.0f, 0.0f, 0.0f, 1.0f},
78  lightRed{0.9f, 0.0f, 0.0f, 1.0f}, black{0.0f, 0.0f, 0.0f, 1.0f},
79  lightBlack{0.1f, 0.1f, 0.1f, 1.0f}, brown{0.85f, 0.75f, 0.15f, 1.0f},
80  lightBrown{0.75f, 0.65f, 0.10f, 1.0f};
81 #endif
82 
83 } // end of namespace corba
84 } // end of namespace viewer
85 } // end of namespace gepetto
86 
87 #endif // SCENEVIEWER_CORBASERVER_CLIENTCPP_HH
Definition: __init__.py:17
Definition: client.hh:20
CORBA::ULong WindowID
Definition: client.hh:22
gepetto::corbaserver::GraphicalInterface_var & gui()
Definition: client.hh:30
Client(int argc, char *argv[])
void connect(const std::string &iiop="corbaloc:iiop:")
bool connected()
Tells whether the connection to the gui is ok.
Definition: client.hh:54
corbaserver::GraphicalInterface_var & gui()
Get a client to the GUI.
void connect(const char *windowName=NULL, bool dontRaise=false, const char *url=NULL, const char *host="localhost", const int port=12321)
Definition: url.hh:24