(svn r26107) -Codechange/cleanup: remove some coding bloat and simplify the driver factory instatiations
This commit is contained in:
18
src/driver.h
18
src/driver.h
@@ -60,8 +60,9 @@ DECLARE_POSTFIX_INCREMENT(Driver::Type)
|
||||
class DriverFactoryBase {
|
||||
private:
|
||||
Driver::Type type; ///< The type of driver.
|
||||
int priority; ///< The priority of this factory.
|
||||
const char *name; ///< The name of the drivers of this factory.
|
||||
int priority; ///< The priority of this factory.
|
||||
const char *description; ///< The description of this driver.
|
||||
|
||||
typedef std::map<const char *, DriverFactoryBase *, StringCompare> Drivers; ///< Type for a map of drivers.
|
||||
|
||||
@@ -97,15 +98,11 @@ private:
|
||||
}
|
||||
|
||||
protected:
|
||||
void RegisterDriver(const char *name, Driver::Type type, int priority);
|
||||
|
||||
public:
|
||||
DriverFactoryBase() :
|
||||
name(NULL)
|
||||
{}
|
||||
DriverFactoryBase(Driver::Type type, int priority, const char *name, const char *description);
|
||||
|
||||
virtual ~DriverFactoryBase();
|
||||
|
||||
public:
|
||||
/**
|
||||
* Shuts down all active drivers
|
||||
*/
|
||||
@@ -124,13 +121,16 @@ public:
|
||||
* Get a nice description of the driver-class.
|
||||
* @return The description.
|
||||
*/
|
||||
virtual const char *GetDescription() = 0;
|
||||
const char *GetDescription() const
|
||||
{
|
||||
return this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of this driver-class.
|
||||
* @return The instance.
|
||||
*/
|
||||
virtual Driver *CreateInstance() = 0;
|
||||
virtual Driver *CreateInstance() const = 0;
|
||||
};
|
||||
|
||||
#endif /* DRIVER_H */
|
||||
|
Reference in New Issue
Block a user