TuttleOFX  1
TuttleOFX/libraries/tuttle/src/tuttle/host/ofx/OfxhPluginDesc.cpp
Go to the documentation of this file.
00001 #include "OfxhPluginDesc.hpp"
00002 
00003 #include <boost/functional/hash.hpp>
00004 
00005 namespace tuttle {
00006 namespace host {
00007 namespace ofx {
00008 
00009 OfxhPluginDesc::OfxhPluginDesc()
00010         : _apiVersion(-1)
00011 {}
00012 
00013 OfxhPluginDesc::OfxhPluginDesc( const std::string& api,
00014                                 int                apiVersion,
00015                                 const std::string& identifier,
00016                                 const std::string& rawIdentifier,
00017                                 int                versionMajor,
00018                                 int                versionMinor )
00019         : _pluginApi( api )
00020         , _apiVersion( apiVersion )
00021         , _ident( identifier, rawIdentifier, versionMinor, versionMajor )
00022 {}
00023 
00024 OfxhPluginDesc::~OfxhPluginDesc()
00025 {}
00026 
00027 /**
00028  * constructor for the case where we have already loaded the plugin binary and
00029  * are populating this object from it
00030  */
00031 OfxhPluginDesc::OfxhPluginDesc( OfxPlugin& ofxPlugin )
00032         : _pluginApi( ofxPlugin.pluginApi )
00033         , _apiVersion( ofxPlugin.apiVersion )
00034         , _ident( ofxPlugin.pluginIdentifier, ofxPlugin.pluginIdentifier, ofxPlugin.pluginVersionMinor, ofxPlugin.pluginVersionMajor )
00035 {
00036         boost::to_lower( _ident._identifier );
00037 }
00038 
00039 bool OfxhPluginDesc::operator==( const This& other ) const
00040 {
00041         if( _pluginApi != other._pluginApi ||
00042             _apiVersion != other._apiVersion ||
00043             _ident != other._ident )
00044                 return false;
00045         return true;
00046 }
00047 
00048 std::size_t OfxhPluginDesc::getHash() const
00049 {
00050         std::size_t seed = 0;
00051         boost::hash_combine( seed, getIdentifier() );
00052         boost::hash_combine( seed, getVersionMajor() );
00053         // The minor version should not change the rendering,
00054         // so it's not part of the hash.
00055         return seed;
00056 }
00057 
00058 }
00059 }
00060 }
00061