Ilwis-Objects  1.0
GIS and Remote Sensing framework for data access and processing
 All Classes Functions Enumerations Pages
Public Member Functions | Static Public Member Functions | Protected Attributes | Static Protected Attributes | Friends | List of all members
Ilwis::ConnectorFactory Class Reference

#include <connectorfactory.h>

Inheritance diagram for Ilwis::ConnectorFactory:
Ilwis::AbstractFactory Ilwis::FactoryInterface

Public Member Functions

 ConnectorFactory ()
 ConnectorFactory constructor for the factory.
 
void addCreator (quint64 objecttypes, const QString &provider, ConnectorCreate)
 Each connector must implement a create method (static method) that can be passed to this factory to be available to the system. More...
 
void addCreator (const QString &format, const QString &provider, ConnectorCreate)
 Each connector must implement a create method (static method) that can be passed to this factory to be available to the system. More...
 
template<class T = ConnectorInterface>
T * createFromResource (const Resource &resource, const QString &provider, const PrepareOptions &options=PrepareOptions()) const
 
template<class T = ConnectorInterface>
QList< T * > connectorsForResource (const Resource &resource, const QString &provider="*", const PrepareOptions &options=PrepareOptions()) const
 
template<class T = ConnectorInterface>
T * createFromFormat (const Resource &resource, const QString &format, const QString &provider=sUNDEF, const PrepareOptions &options=PrepareOptions()) const
 
template<class T = ConnectorInterface>
T * createContainerConnector (const Resource &resource, const QString &provider=sUNDEF, const PrepareOptions &options=PrepareOptions()) const
 
std::vector< CatalogExplorer * > explorersForResource (const Resource &resource, const QString &provider=sUNDEF, const PrepareOptions &options=PrepareOptions()) const
 
- Public Member Functions inherited from Ilwis::AbstractFactory
QString description () const
 
QString type () const
 
QString subtype () const
 
QString key () const
 
bool prepare ()
 
bool canUse (const Resource &resource) const
 

Static Public Member Functions

static std::nullptr_t registerCatalogExplorer (createCatalogExplorer func)
 

Protected Attributes

QHash< ConnectorFilter,
ConnectorCreate > 
_creatorsPerObject
 
QHash< ConnectorFormatSelector,
ConnectorCreate > 
_creatorsPerFormat
 

Static Protected Attributes

static std::vector
< createCatalogExplorer > 
_explorers
 

Friends

class ConnectorInterface
 

Additional Inherited Members

- Protected Member Functions inherited from Ilwis::AbstractFactory
 AbstractFactory (const QString &ty, const QString &sub, const QString &desc="")
 

Detailed Description

This class creates a connector for a certain resource Connectors (implementations of the connector interface) exist in many forms in Ilwis. They are usually tied to specific type of format. The factory produces a specific implementation of the interface. It does this by applying a filter on the set of known connectors to find a suitable create function for a specific type of resource. Connectors can be created based on a format or purely on the resource.

Member Function Documentation

void ConnectorFactory::addCreator ( quint64  objecttypes,
const QString &  provider,
ConnectorCreate  func 
)

Each connector must implement a create method (static method) that can be passed to this factory to be available to the system.

Parameters
objecttypesa create function creates an connector that creates at least one type of objects but it may create more types. This parameter is OR combination of all the types it might create
providerthe search key that is used to locate a particular create method
void ConnectorFactory::addCreator ( const QString &  format,
const QString &  provider,
ConnectorCreate  func 
)

Each connector must implement a create method (static method) that can be passed to this factory to be available to the system.

Parameters
format
provider
template<class T = ConnectorInterface>
T* Ilwis::ConnectorFactory::createFromFormat ( const Resource resource,
const QString &  format,
const QString &  provider = sUNDEF,
const PrepareOptions options = PrepareOptions() 
) const
inline

Creates a connector based on the properties of the resource. The method will try to find a create function based on the type of the resource and the format This method is usually called when a object must be connected to a specific format. For example when a script forces the use of a certain output format.

Parameters
resourcea resource of a certain type. To work the type must have a valid IlwisType
Returns
an instantiation of a connector or 0. In the case of 0 the error can be found in the issuelogger
template<class T = ConnectorInterface>
T* Ilwis::ConnectorFactory::createFromResource ( const Resource resource,
const QString &  provider,
const PrepareOptions options = PrepareOptions() 
) const
inline

Creates a connector based on the properties of the resource. The method will try to find a create function based on the type of the resource and the provider This method is usually called from objectfactories in a plug-in that implements a defined set of connectors. At that place the name of the provider is known and can be used. outside the plug-in the name of the provider is often not known and can not be used.

Parameters
resourcea resource of a certain type. To work the type must have a valid IlwisType
provideran identifier identifying the connector type
Returns
an instantiation of a connector or 0. In the case of 0 the error can be found in the issuelogger

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