Jafar
|
GDHE is a client/server application for 3D display using OpenGL, GDHE also provides a tcl interface. When using GDHE tcl interface, objects can be drawn using basic tcl procedures provided by GDHE, for complex objects it can be convenient to define them directly with OpenGL.
In a Jafar module pipo, you have defined the structure MyStruct, and you want to display instances of MyStruct using GDHE. In the pipo module, you add a displayMyStruct()
function which contains OpenGL statements.
myStruct.hpp
#include <GL/gl.h> #include "jafarConfig.h" namespace jafar { namespace pipo { struct MyStruct; #ifdef HAVE_OPENGL void displayMyStruct(MyStruct const& s_); #endif } }
myStruct.cpp
#include "pipo/myStruct.hpp" #ifdef HAVE_OPENGL void jafar::pipo::displayMyStruct(MyStruct const& s_) { // OpenGL statements } #endif
Do not forget to add myStruct.hpp
to pipo.i
. If OpenGL is enabled (see subsecInstallConfigure) the function pipo::displayMyStruct() is available in tcl and can be used with GDHE.
Currently, the best way is to produce by hand a limited pure C interface to your jafar module. Such an example can be found in module vme in files genomWrapper.{h,cpp}. Be sure to make a C++ friendly header:
#ifdef __cplusplus extern "C" { #endif // C interface declaration goes here #ifdef __cplusplus } #endif
Then this is trivial to call these C functions from within your GenoM module.
The minimum to do is to catch all exceptions that can be thrown by the jafar module and display the debug messages. These two macros can do the job:
#define EXCEPTION_STOP_BEGIN \ try { ((void)0) #define EXCEPTION_STOP_END \ } \ catch(jafar::kernel::Exception& e) { \ std::ostringstream m; \ m << "EXCEPTION_STOP"; \ e.addTrace(_JFR_MODULE_, __FILE__, __LINE__, m.str()); \ DebugStream::instance() << e << jafar::debug::endl; \ } \ catch(std::exception& e) { \ DebugStream::setup(_JFR_MODULE_, DebugStream::Trace); \ DebugStream::sendLocation(_JFR_MODULE_, __FILE__, __LINE__); \ DebugStream::instance() << "std::exception" << jafar::debug::endl \ << "EXCEPTION_STOP" << jafar::debug::endl; \ DebugStream::instance() << e.what() << jafar::debug::endl; \ } \ catch(...) { \ DebugStream::setup(_JFR_MODULE_, DebugStream::Trace); \ DebugStream::sendLocation(_JFR_MODULE_, __FILE__, __LINE__); \ DebugStream::instance() << "unknown exception" \ << jafar::debug::endl \ << "EXCEPTION_STOP" << jafar::debug::endl; \ } ((void)0)
Generated on Wed Oct 15 2014 00:37:30 for Jafar by doxygen 1.7.6.1 |
![]() |