Code Search for Developers
 
 
  

SWrapperManager.h from osgDesigner at Krugle


Show SWrapperManager.h syntax highlighted

#ifndef __SWRAPPERMANAGER_H__
#define __SWRAPPERMANAGER_H__ 1

#include <vector>
#include <string>
#include <map>
#include <list>

#include <osgDB/DynamicLibrary>
#include <osg/ref_ptr>

#include <boost/thread/mutex.hpp>
#include <boost/signal.hpp>
#include <boost/filesystem/path.hpp>

#include <gen_prog/plugin/dynamic_library.h>

#include <osgIntrospectionToolKit/Export.h>
#include <osgIntrospectionToolKit/signalslib.hpp>

namespace osgIntrospectionToolKit
{
    
    
    /**
     * SWrapperManager is a singleton class to manager the wrapper (dynamic library).
     */
    class OSGINTROSPECTIONTOOLKIT_EXPORT SWrapperManager
    {
        public:
            
            typedef boost::signal< void (void) >                                                UpdateSignal;
            
            typedef std::vector< std::string >                                                  WrapperNameList;
            typedef std::vector< boost::filesystem::path >                                      WrapperPathList;
            typedef std::map< std::string, osg::ref_ptr< gen_prog::plugin::dynamic_library > >   DLMap;
           
        private:
            SWrapperManager();
           
        public:
            virtual ~SWrapperManager();
            
            
        public:
            /** Singleton accessor */
            static SWrapperManager*                                 instance();
    
			/**
			 * add a wrapper from is path.
             * 
			 * Return : true if the wrapper is correctly load or if the wrapper is already loaded, 
			 *          false otherwise
			 */
            bool                                                    add(const boost::filesystem::path & wrapperPath);

			/**
			 * remove a wrapper from is path.
             * 
			 * Return : true if the wrapper is correctly unload
			 *          false otherwise
			 */
            bool                                                    remove(const boost::filesystem::path & wrapperPath);
            /** unload all wrapper. */
            void                                                    clear();



			/** Fill the list past in parameter with the name of all wrapper loaded. */
            void                                                    getLoadedWrappers(WrapperNameList& wrapperList) const;
            /** Fill the list past in parameter with the path of all wrapper found. */
			void                                                    getAvailablePathWrappers(WrapperPathList& wrapperPathList) const;
            /** Fill the list past in parameter with the path of wrapper past in parameter. */
            void                                                    getAvailablePathForWrapper(WrapperPathList & wrapperPathList, const std::string & wrapperName) const;
			/** check if a wrapper is loaded or not. */
            bool                                                    isLoadedKey(const std::string & name) const;
            /** check if a wrapper is loaded or not. */
            bool                                                    isLoadedPath(const boost::filesystem::path & wrapperPath) const;

            /** get a wrapper name from a path. */
            std::string                                             pathToKey(const boost::filesystem::path & wrapperPath) const;
            /** create a platform-specific library name for a wrapper. */
			std::string                                             createLibraryNameForWrapper(const std::string& ext) const;
            /** create a wrapper name from a platform-specific library name. */
            std::string                                             createWrapperNameForLibrary(const std::string& libraryPath) const;
            /** get a platform-specific library prefix. */


            std::string                                             getLibraryPrefix() const;
            /** get a platform-specific library extension. */
            std::string                                             getLibraryExtension() const;



            /** return the signal call before a modification of the WrapperManager */
            UpdateSignal&                                           preUpdateSignal()
            { return (_preUpdateSignal); }
            /** return the signal call after a modification of the WrapperManager */
            UpdateSignal&                                           postUpdateSignal()
            { return (_postUpdateSignal); }
        private:
            
			// ** private No-Thread-Safe functions
            bool                                                    _add(const boost::filesystem::path & wrapperPath);
            bool                                                    _remove(const boost::filesystem::path & wrapperPath);

			/** map the wrapper name with the DynamicLibrary used to load the wrapper */
            DLMap                                                   _dlMap;
            
            /** signal call before any modification */
            UpdateSignal                                            _preUpdateSignal;
			/** signal call after any modification */
            UpdateSignal                                            _postUpdateSignal;

			/** mutex to keep the class Thread-Safe */
			mutable boost::mutex									_mutex;
    };
}
#endif // ** __SWRAPPERMANAGER_H__ ** //




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

  CArrayItemLink.h
  CIndexedItemLink.h
  CPropertyExtractor.h
  CReflectedInstance.h
  CReflectedPointer.h
  CReflectedRefPointer.h
  CReflectedValueLinkExtractor.h
  CValueTree.h
  CValueTreeFunctor.h
  CValueTreeModifier.h
  CommonStdType.h
  ControlList.h
  ExceptionUtility.h
  Export.h
  IGraph.h
  IReflectedValue.h
  IReflectedValueLink.h
  SMemoryManager.h
  STypeGraph.h
  SWrapperManager.h
  signalslib.hpp