TuttleOFX
1
|
00001 #include "OfxhPluginHandle.hpp" 00002 #include "OfxhPlugin.hpp" 00003 #include "OfxhPluginBinary.hpp" 00004 00005 #include <boost/lexical_cast.hpp> 00006 00007 namespace tuttle { 00008 namespace host { 00009 namespace ofx { 00010 00011 OfxhPluginHandle::OfxhPluginHandle( OfxhPlugin& p, OfxhHost& host ) : _p( &p ) 00012 { 00013 _b = &_p->getBinary(); 00014 _b->_binary.ref(); 00015 _op = 0; 00016 OfxPlugin* ( *getPlug )(int) = ( OfxPlugin * ( * )( int ) )_b->_binary.findSymbol( "OfxGetPlugin" ); 00017 _op = getPlug( _p->getIndex() ); 00018 if( !_op ) 00019 { 00020 BOOST_THROW_EXCEPTION( exception::Data() 00021 << exception::user( "Loading plugin failed." ) 00022 << exception::dev() + "OfxGetPlugin call failed at index " + _p->getIndex() + "." 00023 << exception::filename( _b->getBundlePath() ) ); 00024 } 00025 _op->setHost( host.getHandle() ); 00026 } 00027 00028 OfxhPluginHandle::~OfxhPluginHandle() 00029 { 00030 _b->_binary.unref(); 00031 } 00032 00033 } 00034 } 00035 } 00036