Web Interfaces for C++ Introspection?
Milo_Mindbender asks: "For a C++ application I'm working on I want to be able to pop up an interface to a class that will display all the 'tunable' parameters of the class and let me inspect/modify them, while the program is running. The catch is that I'm running on a minimal embedded OS with Open GL but no GUI library. Rather than porting a widget set or writing my own, I was thinking about having the application talk to a web browser, and then use the browser to display the GUI, take user input, and finally push the data back to the app. The classes have metadata that describes the public data locations/types so they can be accessed, but not being a web-wizard I'm not sure of the best way of generating the information I need to create the UI. My first thought is to generate HTML and push that to the browser, but it seems like there must be a better way than this, maybe someone has written a library specifically for doing this sort of thing? Any help/suggestions would be appreciated!"
Any particular reason that it has to be a GUI? Something like an ncurses interface might be a lit easier.
I find this question somewhat odd... The guy clearly knows C++ and is able to develop on an embedded OS which isn't an easy thing to do but yet can't write himself a simple web-server, which a lot of us learnt during our first few years of programming in something nooby like VBA or Java...
So either he isn't being completely accurate in so much that he might not be as knowledgeable as he claims or just by freak chance managed never to write a web-server in a couple of hours like everyone else...
If it must be accessible via the web/intranet/browser/etc, set up some of your favorite CGI/PHP/JSP/Python/Ruby and have it talk to the application via TCP/IP and to the browser with HTTP.
The World Wide Web is dying. Soon, we shall have only the Internet.
You may be interested in XUL then. Especially, in remote XUL.
Also, see Remote XUL Application Development with_Mozilla I and Remote XUL Application Development with Mozilla II.
You may even be able to create the UI XML files automatically from your interfaces, using a script, or introspection.
You can then send the data back to your host, using RPCs or a REST-like interface.
Windows is like decaf - it tastes like the real thing, but it won't get you through the day.
You might consider a very minimal XML interface on top of a very very very simple HTTP server. Your UI could live on a completely different device on a completely different server... or on the same server in a different application stack. You could run your service on port 8080 or something if you didn't want to run it on 80 to prevent
You could display your state as a single XML document that is gotten at a single URL. Each setting could be manipulated by posting to a URL specified in the XML document. These sets of documents and post URLs could become a simple CGI set of interfaces you could describe for anything from webservers, application servers, or other web-aware C++ programs to hook into.
[signature]
Have you looked at GLUI?
Powered by Web3.5 RC 2
PS. Good alternative to CORBA is ICE (http://www.zeroc.com/ice.html), which is basically the same thing as CORBA, and founded by one of the CORBA gurus. ICE has much better C++ mapping, and lots of other nice features.
Hope this helps!
Use Qt and declare your tunable parameters as properties. Writing a minimal server using Qt is trivial.
How about minimal server-side XML + Client side XSLT?
Requirements:
Now all you have to do is serve the XML and stylesheet, attach the stylesheet to the XML file and watch any XSLT-aware browser do the heavy work of transforming that simple XML into beautiful XHTML (or HTML) for you.
Benefits:
Problems:
Why re-invent the wheel writing C++ UIs and stuff when there is plenty of simpler ways out there.