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

#include <OfxhPluginCache.hpp>

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 () const
 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 clearPluginFiles ()
 Remove all 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

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 58 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 160 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 200 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 123 of file OfxhPluginCache.hpp.

References _nonrecursePath, and _pluginPath.

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

void tuttle::host::ofx::OfxhPluginCache::clearPluginFiles ( )

Remove all plugins.

Definition at line 468 of file OfxhPluginCache.cpp.

References _binaries, _knownBinFiles, _loadedMap, _plugins, _pluginsByID, and setDirty().

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

Here is the call graph for this function:

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 484 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 174 of file OfxhPluginCache.hpp.

References _binaries.

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 502 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 102 of file OfxhPluginCache.hpp.

References getPluginById().

Here is the call graph for this function:

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

get the list in which plugins are sought

Definition at line 105 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 169 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 111 of file OfxhPluginCache.hpp.

References _dirty.

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

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

register an API cache handler

Definition at line 479 of file OfxhPluginCache.cpp.

References _apiHandlers.

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

std::string tuttle::host::ofx::OfxhPluginCache::seekPluginFile ( const std::string &  baseName) const

Definition at line 366 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]
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 138 of file OfxhPluginCache.hpp.

References _cacheVersion.

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

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

Definition at line 116 of file OfxhPluginCache.hpp.

References _dirty.

Referenced by clearPluginFiles(), 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 203 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 151 of file OfxhPluginCache.hpp.

References _enablePluginSeek.


Friends And Related Function Documentation

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

Definition at line 180 of file OfxhPluginCache.hpp.

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

Definition at line 537 of file OfxhPluginCache.cpp.


Field Documentation

all the binaries we know about, we own these

Definition at line 69 of file OfxhPluginCache.hpp.

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

Definition at line 79 of file OfxhPluginCache.hpp.

Referenced by setCacheVersion().

Definition at line 80 of file OfxhPluginCache.hpp.

Referenced by isDirty(), and setDirty().

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

Definition at line 81 of file OfxhPluginCache.hpp.

Referenced by seekPluginFile(), and setPluginSeekEnabled().

Definition at line 78 of file OfxhPluginCache.hpp.

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

Definition at line 73 of file OfxhPluginCache.hpp.

Referenced by clearPluginFiles(), scanDirectory(), and serialize().

Used to check if a plugin is loaded twice.

Definition at line 72 of file OfxhPluginCache.hpp.

Referenced by addPlugin(), and clearPluginFiles().

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

list of directories to look in (non-recursively)

Definition at line 66 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 67 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 65 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 70 of file OfxhPluginCache.hpp.

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


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