36 , mLoadedAllPlugins(false)
75 std::string entry = directory.
next();
80 if (prefixIndex == -1 || postfixIndex == -1) {
107 std::string entry = directory.
next();
112 if (prefixIndex == -1 || postfixIndex == -1) {
118 if (entry != captureType) {
146 typedef void (*RegisterPlugin)(
const std::string &captureType,
CapturePlugin *&capturePlugin);
149 if (registerPlugin) {
150 registerPlugin(captureType, capturePlugin);
154 if (capturePlugin == NULL) {
159 mPluginMap.insert(PluginMap::value_type(captureType, plugin));
160 mCapturePluginMap.insert(CapturePluginMap::value_type(captureType, capturePlugin));
164 #if defined(_DEBUG) || !defined(NDEBUG) 165 std::cout << e.what() << std::endl;
173 CapturePluginMap::iterator itr;
185 capturePlugin = itr->second;
187 return capturePlugin;
203 if (mInstance == NULL) {
205 mDestroyer.set(mInstance);
227 for (CaptureFactoryPrivate::PluginMap::iterator itr =
d->
mPluginMap.begin(); itr !=
d->
mPluginMap.end(); ++itr) {
228 keys.push_back(itr->first);
239 if (captureType.empty()) {
243 devices.insert(devices.end(), pluginDevices.begin(), pluginDevices.end());
PluginPathsVector mPluginPaths
Capture * createCapture(const CaptureDevice captureDevice)
Create Capture class. Transfers onwership to the caller.
CaptureFactoryDestroyer for deleting the CaptureFactory singleton.
Mutex for synchronizing multiple threads.
CapturePluginMap mCapturePluginMap
CaptureFactoryPrivate * d
std::string pluginExtension()
CaptureFactory for creating Capture classes.
static CaptureFactory * instance()
The singleton instance of CaptureFactory.
static const char * ALVAR_VERSION_NODOTS
Entire version string without dots.
std::string mPluginPrefix
CapturePlugin * getPlugin(const std::string &captureType)
~CaptureFactory()
Destructor.
std::vector< CaptureDevice > CaptureDeviceVector
Vector of CaptureDevices.
bool hasNext()
Verifies if another entry exist in the directory.
Plugin for loading dynamic libraries.
std::string captureType() const
The type of capture backend.
std::vector< std::string > CapturePluginVector
Vector of strings.
CaptureDevice holder for camera information.
static CaptureFactory * mInstance
std::string currentPath()
Returns the path of the current entry.
This file implements a capture plugin interface.
std::string next()
Advances the iterator and returns the name of the next entry.
This file implements a directory iterator.
CapturePlugin interface that plugins must implement.
CaptureDeviceVector enumerateDevices(const std::string &captureType="")
Enumerate capture devices currently available.
Lock for simplifying mutex handling.
void loadPlugin(const std::string &captureType)
This file implements a capture factory with a plugin interface to allow for different capture backend...
CapturePluginVector enumeratePlugins()
Enumerate capture plugins currently available.
void registerPlugin(const std::string &class_name, const std::string &base_class_name)
std::string pluginPrefix()
Capture interface that plugins must implement.
virtual CaptureDeviceVector enumerateDevices()=0
Enumerate capture devices currently available.
DirectoryIterator for iterating over files and directories.
static CaptureFactoryDestroyer mDestroyer
void * resolve(const char *symbol)
Resolves the address of a symbol.
virtual Capture * createCapture(const CaptureDevice captureDevice)=0
Create Capture class. Transfers onwership to the caller.
std::string mPluginPostfix