TuttleOFX  1
tuttle::host::ofx::OfxhPluginCache Class Reference

#include <OfxhPluginCache.hpp>

Collaboration diagram for tuttle::host::ofx::OfxhPluginCache:

Public Types

typedef OfxhPluginCache This
typedef boost::ptr_list
< OfxhPluginBinary
OfxhPluginBinaryList

Public Member Functions

 OfxhPluginCache ()
 ctor, which inits _pluginPath to default locations and not much else
 ~OfxhPluginCache ()
 dtor
OfxhPlugingetPluginById (const std::string &id, int vermaj=-1, int vermin=-1)
const OfxhPlugingetPluginById (const std::string &id, int vermaj=-1, int vermin=-1) const
const std::list< std::string > & getPluginPath ()
 get the list in which plugins are sought
bool isDirty () const
 was the cache outdated?
void setDirty ()
void addDirectoryToPath (const std::string &f, bool recurse=true)
 add a directory to the plugin path
void setPluginHostPath (const std::string &hostId)
void setCacheVersion (const std::string &cacheVersion)
std::string seekPluginFile (const std::string &baseName) const
void setPluginSeekEnabled (bool enabled)
void scanPluginFiles ()
 scan for plugins
void registerAPICache (APICache::OfxhPluginAPICacheI &apiCache)
 register an API cache handler
APICache::OfxhPluginAPICacheIfindApiHandler (const std::string &api, int apiver)
 find the API cache handler for the given api/apiverson
const std::list< OfxhPlugin * > & getPlugins () const
 obtain a list of plugins to walk through
OfxhPluginBinaryListgetBinaries ()

Protected Member Functions

void scanDirectory (std::set< std::string > &foundBinFiles, const std::string &dir, bool recurse)
void addPlugin (OfxhPlugin *plugin)

Protected Attributes

tuttle::host::ofx::property::OfxhPropSpec_hostSpec
std::list< std::string > _pluginPath
 list of directories to look in
std::set< std::string > _nonrecursePath
 list of directories to look in (non-recursively)
std::list< std::string > _pluginDirs
 list of directories we found
OfxhPluginBinaryList _binaries
 all the binaries we know about, we own these
std::list< OfxhPlugin * > _plugins
 all the plugins inside the binaries, we don't own these, populated from _binaries
std::map< std::string,
OfxhPlugin * > 
_pluginsByID
std::map< OfxhPluginIdent, bool > _loadedMap
 Used to check if a plugin is loaded twice.
std::set< std::string > _knownBinFiles
std::list
< PluginCacheSupportedApi
_apiHandlers
bool _ignoreCache
std::string _cacheVersion
bool _dirty
bool _enablePluginSeek
 Turn off to make all seekPluginFile() calls return an empty string.

Private Member Functions

template<class Archive >
void serialize (Archive &ar, const unsigned int version)

Friends

class boost::serialization::access
std::ostream & operator<< (std::ostream &os, const This &g)

Detailed Description

Where we keep our plugins.

Definition at line 76 of file OfxhPluginCache.hpp.


Member Typedef Documentation


Constructor & Destructor Documentation

tuttle::host::ofx::OfxhPluginCache::OfxhPluginCache ( )

ctor, which inits _pluginPath to default locations and not much else

Definition at line 144 of file OfxhPluginCache.cpp.

References _pluginPath, DIRLIST_SEP_CHARS, and tuttle::host::ofx::OFXGetEnv().

Here is the call graph for this function:

tuttle::host::ofx::OfxhPluginCache::~OfxhPluginCache ( )

dtor

Definition at line 184 of file OfxhPluginCache.cpp.


Member Function Documentation

void tuttle::host::ofx::OfxhPluginCache::addDirectoryToPath ( const std::string &  f,
bool  recurse = true 
) [inline]

add a directory to the plugin path

Definition at line 167 of file OfxhPluginCache.hpp.

References _nonrecursePath, and _pluginPath.

Referenced by BOOST_AUTO_TEST_CASE(), and tuttle::host::PreloadPlugins::PreloadPlugins().

APICache::OfxhPluginAPICacheI * tuttle::host::ofx::OfxhPluginCache::findApiHandler ( const std::string &  api,
int  apiver 
)

find the API cache handler for the given api/apiverson

Definition at line 399 of file OfxhPluginCache.cpp.

References _apiHandlers.

Referenced by tuttle::host::ofx::OfxhPluginBinary::loadPluginInfo(), and serialize().

OfxhPluginBinaryList& tuttle::host::ofx::OfxhPluginCache::getBinaries ( ) [inline]

Definition at line 218 of file OfxhPluginCache.hpp.

References _binaries.

Referenced by serialize().

OfxhPlugin * tuttle::host::ofx::OfxhPluginCache::getPluginById ( const std::string &  id,
int  vermaj = -1,
int  vermin = -1 
)

get the plugin by id. vermaj and vermin can be specified. if they are not it will pick the highest found version.

Definition at line 417 of file OfxhPluginCache.cpp.

References _plugins, _pluginsByID, tuttle::host::ofx::OfxhPluginDesc::getIdentifier(), tuttle::host::ofx::OfxhPluginDesc::getVersionMajor(), tuttle::host::ofx::OfxhPluginDesc::getVersionMinor(), and tuttle::host::ofx::OfxhPlugin::trumps().

Referenced by getPluginById(), and tuttle::host::Core::operator[]().

Here is the call graph for this function:

const OfxhPlugin* tuttle::host::ofx::OfxhPluginCache::getPluginById ( const std::string &  id,
int  vermaj = -1,
int  vermin = -1 
) const [inline]

Definition at line 146 of file OfxhPluginCache.hpp.

References getPluginById().

Here is the call graph for this function:

const std::list<std::string>& tuttle::host::ofx::OfxhPluginCache::getPluginPath ( ) [inline]

get the list in which plugins are sought

Definition at line 149 of file OfxhPluginCache.hpp.

References _pluginPath.

const std::list<OfxhPlugin*>& tuttle::host::ofx::OfxhPluginCache::getPlugins ( ) const [inline]

obtain a list of plugins to walk through

Definition at line 213 of file OfxhPluginCache.hpp.

References _plugins.

Referenced by tuttle::host::Core::getPlugins().

bool tuttle::host::ofx::OfxhPluginCache::isDirty ( ) const [inline]

was the cache outdated?

Definition at line 155 of file OfxhPluginCache.hpp.

References _dirty.

Referenced by tuttle::host::Core::preload().

void tuttle::host::ofx::OfxhPluginCache::registerAPICache ( APICache::OfxhPluginAPICacheI apiCache) [inline]

register an API cache handler

Definition at line 204 of file OfxhPluginCache.hpp.

References _apiHandlers.

Referenced by tuttle::host::Core::Core().

void tuttle::host::ofx::OfxhPluginCache::scanDirectory ( std::set< std::string > &  foundBinFiles,
const std::string &  dir,
bool  recurse 
) [protected]
std::string tuttle::host::ofx::OfxhPluginCache::seekPluginFile ( const std::string &  baseName) const

Definition at line 307 of file OfxhPluginCache.cpp.

References _enablePluginSeek, _pluginDirs, and DIRSEP.

template<class Archive >
void tuttle::host::ofx::OfxhPluginCache::serialize ( Archive &  ar,
const unsigned int  version 
) [inline, private]

Definition at line 226 of file OfxhPluginCache.hpp.

References _binaries, _knownBinFiles, _plugins, findApiHandler(), and getBinaries().

Here is the call graph for this function:

void tuttle::host::ofx::OfxhPluginCache::setCacheVersion ( const std::string &  cacheVersion) [inline]

set the version string to write to the cache, and also that we expect on cachess read in

Definition at line 182 of file OfxhPluginCache.hpp.

References _cacheVersion.

Referenced by tuttle::host::Core::Core().

void tuttle::host::ofx::OfxhPluginCache::setDirty ( ) [inline]

Definition at line 160 of file OfxhPluginCache.hpp.

References _dirty.

Referenced by scanDirectory(), and scanPluginFiles().

void tuttle::host::ofx::OfxhPluginCache::setPluginHostPath ( const std::string &  hostId)

specify which subdirectory of /usr/OFX or equivilant (as well as 'Plugins') to look in for plugins.

Definition at line 187 of file OfxhPluginCache.cpp.

References _pluginPath.

void tuttle::host::ofx::OfxhPluginCache::setPluginSeekEnabled ( bool  enabled) [inline]

Sets behaviour of seekPluginFile(). Enable (the default): normal operation; disable: returns an empty string instead

Definition at line 195 of file OfxhPluginCache.hpp.

References _enablePluginSeek.


Friends And Related Function Documentation

friend class boost::serialization::access [friend]

Definition at line 224 of file OfxhPluginCache.hpp.

std::ostream& operator<< ( std::ostream &  os,
const This g 
) [friend]

Definition at line 452 of file OfxhPluginCache.cpp.


Field Documentation

all the binaries we know about, we own these

Definition at line 88 of file OfxhPluginCache.hpp.

Referenced by getBinaries(), scanDirectory(), scanPluginFiles(), and serialize().

Definition at line 98 of file OfxhPluginCache.hpp.

Referenced by setCacheVersion().

Definition at line 99 of file OfxhPluginCache.hpp.

Referenced by isDirty(), and setDirty().

Turn off to make all seekPluginFile() calls return an empty string.

Definition at line 100 of file OfxhPluginCache.hpp.

Referenced by seekPluginFile(), and setPluginSeekEnabled().

Definition at line 97 of file OfxhPluginCache.hpp.

std::set<std::string> tuttle::host::ofx::OfxhPluginCache::_knownBinFiles [protected]

Definition at line 92 of file OfxhPluginCache.hpp.

Referenced by scanDirectory(), and serialize().

Used to check if a plugin is loaded twice.

Definition at line 91 of file OfxhPluginCache.hpp.

Referenced by addPlugin().

std::set<std::string> tuttle::host::ofx::OfxhPluginCache::_nonrecursePath [protected]

list of directories to look in (non-recursively)

Definition at line 86 of file OfxhPluginCache.hpp.

Referenced by addDirectoryToPath(), and scanPluginFiles().

std::list<std::string> tuttle::host::ofx::OfxhPluginCache::_pluginDirs [protected]

list of directories we found

Definition at line 87 of file OfxhPluginCache.hpp.

Referenced by scanDirectory(), and seekPluginFile().

std::list<std::string> tuttle::host::ofx::OfxhPluginCache::_pluginPath [protected]

list of directories to look in

Definition at line 85 of file OfxhPluginCache.hpp.

Referenced by addDirectoryToPath(), getPluginPath(), OfxhPluginCache(), scanPluginFiles(), and setPluginHostPath().

all the plugins inside the binaries, we don't own these, populated from _binaries

Definition at line 89 of file OfxhPluginCache.hpp.

Referenced by addPlugin(), getPluginById(), getPlugins(), and serialize().

std::map<std::string, OfxhPlugin*> tuttle::host::ofx::OfxhPluginCache::_pluginsByID [protected]

Definition at line 90 of file OfxhPluginCache.hpp.

Referenced by addPlugin(), getPluginById(), and tuttle::host::ofx::operator<<().


The documentation for this class was generated from the following files: