TuttleOFX  1
TuttleOFX/libraries/tuttle/src/tuttle/plugin/Plugin.hpp
Go to the documentation of this file.
00001 #ifndef _TUTTLE_PLUGIN_PLUGIN_HPP_
00002 #define _TUTTLE_PLUGIN_PLUGIN_HPP_
00003 
00004 #include <ofxsImageEffect.h>
00005 
00006 #include <boost/preprocessor/stringize.hpp>
00007 #include <string>
00008 
00009 namespace tuttle {
00010 namespace plugin {
00011 
00012 /**
00013  * @brief Suppress 'warning: unused variable'
00014  */
00015 void unusedString( const char* ) {}
00016 
00017 /**
00018  * @brief Internal, use mAppendPluginFactory instead.
00019  */
00020 template<class PluginFactory>
00021 void appendPluginFactory( OFX::PluginFactoryArray& ids, const char* idString, const int versionMajor, const int versionMinor, const char* uniqueId )
00022 {
00023         static const char* uniqueIdStr = uniqueId; //Make the uniqueId present in the final binary, even in release. OFXPLUGIN_tuttle.myplug_1.0
00024 
00025         unusedString( uniqueIdStr );
00026         static PluginFactory p( idString, versionMajor, versionMinor );
00027         ids.push_back( &p );
00028 }
00029 
00030 /**
00031  * @brief Use this macro to declare your plugin in the mainEntry.cpp if you have plugins who don't have the same version in the bundle.
00032  */
00033 #define mAppendPluginFactoryVersions( ids, ClassName, idString, versionMajor, versionMinor ) \
00034     tuttle::plugin::appendPluginFactory < ClassName > ( ids, idString, versionMajor, versionMinor, "OFXPLUGIN_" idString "_" BOOST_PP_STRINGIZE( versionMajor ) "." BOOST_PP_STRINGIZE( versionMinor ) );
00035 
00036 /**
00037  * @brief Use this macro to declare your plugin in the mainEntry.cpp
00038  */
00039 #define mAppendPluginFactory( ids, ClassName, idString ) \
00040     mAppendPluginFactoryVersions( ids, ClassName, idString, OFXPLUGIN_VERSION_MAJOR, OFXPLUGIN_VERSION_MINOR )
00041 }
00042 }
00043 
00044 #endif