vrj::Callable Struct Reference

This struct implements a callable object (a functor, basically). More...

Collaboration diagram for vrj::Callable:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Callable (vrj::PerformanceMediator *mgr)
bool operator() (void *func)
 This will be invoked as a callback by methods of vpr::LibraryLoader.

Public Attributes

vrj::PerformanceMediatormed

Detailed Description

This struct implements a callable object (a functor, basically).

An instance can be passed in where a boost::function1<bool, void*> is expected. In vrj:PerformanceMediator::loadPerfPlugin(), instances are used to handle dynamic loading of plug-ins via vpr::LibraryLoader.

Definition at line 80 of file PerformanceMediator.cpp.


Constructor & Destructor Documentation

vrj::Callable::Callable ( vrj::PerformanceMediator mgr  )  [inline]

Definition at line 82 of file PerformanceMediator.cpp.

00082                                             : med(mgr)
00083       {
00084       }


Member Function Documentation

bool vrj::Callable::operator() ( void *  func  )  [inline]

This will be invoked as a callback by methods of vpr::LibraryLoader.

Parameters:
func A function pointer for the entry point in a dynamically loaded plug-in. This must be cast to the correct signature before being invoked.

Definition at line 93 of file PerformanceMediator.cpp.

References med.

00094       {
00095          vrj::PerfPlugin* (*init_func)(vrj::PerformanceMediator* mediator, jccl::ConfigManager* configMgr);
00096 
00097          // Cast the entry point function to the correct signature so that we can
00098          // call it.  All dynamically plug-ins must have an entry point function
00099          // that takes no argument and returns a pointer to an implementation of
00100          // the vrj::RemoteReconfig interface.
00101          init_func = (vrj::PerfPlugin* (*)(vrj::PerformanceMediator*, jccl::ConfigManager*)) func;
00102 
00103          jccl::ConfigManager* mgr = jccl::ConfigManager::instance();
00104 
00105          // Call the entry point function.
00106          vrj::PerfPlugin* plugin = (*init_func)(med, mgr);
00107 
00108          if ( NULL != plugin )
00109          {
00110             med->setPerfPlugin(plugin);
00111             return true;
00112          }
00113          else
00114          {
00115             return false;
00116          }
00117       }


Member Data Documentation

vrj::PerformanceMediator* vrj::Callable::med

Definition at line 119 of file PerformanceMediator.cpp.

Referenced by operator()().


The documentation for this struct was generated from the following file:
Generated on Thu Jan 4 10:58:31 2007 for VR Juggler by  doxygen 1.5.1