Code Search for Developers
 
 
  

TPluginManagerProxy.h from osgDesigner at Krugle


Show TPluginManagerProxy.h syntax highlighted

#ifndef __INCLUDE_BY_TPLUGINMANAGER_SPECIALIZED__CLASS__
#error " ERROR osgDesigner/plugins/TPluginManagerProxy.h must no be included directly ERROR !!!"
#error " ===>> Include TPluginManager specialized class' header instead."
#error " ===>> If you want instantiated a new class with the TPluginManager template."
#error " ===>> You must done the specialization for this class."
#error " ===>> See example at the end of the osgDesigner/plugins/TPluginManager.h file."
#endif


#ifndef __TPLUGINMANAGERPROXY__
#define __TPLUGINMANAGERPROXY__ 1

#include <osg/Notify>

/*
 * Proxy used for the plugin to register itself
 * when loaded and  unregister when unloaded
 */
 
namespace osgDesigner
{
    template < typename PluginDesc, typename PluginDescBase >
    class TPluginManagerProxy
    {
            typedef TPluginManager< PluginDescBase >        Manager;
        public:
    
            TPluginManagerProxy()
            {
                _pluginDesc = new PluginDesc;

                osg::notify(osg::DEBUG_INFO) << "TPluginManagerProxy Manager::instance() = " << Manager::instance() << std::endl;
                Manager::instance()->regist(_pluginDesc->getName(), _pluginDesc.get());
                osg::notify(osg::DEBUG_INFO)    << "Module registered"
                                                << "    Name          : " << _pluginDesc->getName() << std::endl
                                                << "    Version       : " << _pluginDesc->getVersion() << std::endl
                                                << "    Author        : " << _pluginDesc->getAuthor() << std::endl
                                                << "    Description   : " << _pluginDesc->getDescription() << std::endl;
            }
    
            ~TPluginManagerProxy()
            {
                osg::notify(osg::DEBUG_INFO) << "~TPluginManagerProxy Manager::instance() = " << Manager::instance() << std::endl;
                Manager::instance()->unregist(_pluginDesc->getName());
                osg::notify(osg::DEBUG_INFO)    << "Module unregistered"
                                                << "    Name          : " << _pluginDesc->getName() << std::endl
                                                << "    Version       : " << _pluginDesc->getVersion() << std::endl
                                                << "    Author        : " << _pluginDesc->getAuthor() << std::endl
                                                << "    Description   : " << _pluginDesc->getDescription() << std::endl;
                _pluginDesc = NULL;
            }
            
        protected:
        
            osg::ref_ptr< PluginDesc >              _pluginDesc;
    };

}
#endif // ** __TPLUGINMANAGERPROXY__ ** //




See more files for this project here

osgDesigner

osgDesigner is a graphical tool used to modify an OpenSceneGraph (OSG) scene using the osgIntrospection framework. OpenSceneGraph developpers will be able to extend osgDesigner at need using (editor | render | osgIntrospection wrapper) plugin system.

Project homepage: http://sourceforge.net/projects/osgdesigner
Programming language(s): C++,Shell Script
License: other

  CModulePrefixSuffix.h
  DynamicLibrary.h
  IEditorPluginABC.h
  IEditorPluginDescABC.h
  IEditorPluginWidgetABC.h
  IPluginDescABC.h
  IRenderPluginABC.h
  IRenderPluginDescABC.h
  SEditorPluginManager.h
  SEditorPluginRegistry.h
  SRenderPluginManager.h
  SRenderPluginRegistry.h
  TPluginManagerProxy.h