TuttleOFX  1
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 
00011 OfxhPluginDesc::~OfxhPluginDesc() {}
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 /**
00025  * constructor for the case where we have already loaded the plugin binary and
00026  * are populating this object from it
00027  */
00028 OfxhPluginDesc::OfxhPluginDesc( OfxPlugin& ofxPlugin )
00029         : _pluginApi( ofxPlugin.pluginApi )
00030         , _apiVersion( ofxPlugin.apiVersion )
00031         , _ident( ofxPlugin.pluginIdentifier, ofxPlugin.pluginIdentifier, ofxPlugin.pluginVersionMinor, ofxPlugin.pluginVersionMajor )
00032 {
00033         boost::to_lower( _ident._identifier );
00034 }
00035 
00036 bool OfxhPluginDesc::operator==( const This& other ) const
00037 {
00038         if( _pluginApi != other._pluginApi ||
00039             _apiVersion != other._apiVersion ||
00040             _ident != other._ident )
00041                 return false;
00042         return true;
00043 }
00044 
00045 std::size_t OfxhPluginDesc::getHash() const
00046 {
00047         std::size_t seed = 0;
00048         boost::hash_combine( seed, getIdentifier() );
00049         boost::hash_combine( seed, getVersionMajor() );
00050         // The minor version should not change the rendering,
00051         // so it's not part of the hash.
00052         return seed;
00053 }
00054 
00055 }
00056 }
00057 }
00058