simulavr
1.1.0
|
Produces AVR devices. More...
#include <avrfactory.h>
Public Types | |
typedef AvrDevice *(* | AvrDeviceCreator) () |
Public Member Functions | |
AvrDevice * | makeDevice (const char *config) |
Static Public Member Functions | |
static AvrFactory & | instance () |
Singleton class access. More... | |
static std::vector< std::string > & | supportedDevices () |
static void | reg (const std::string name, AvrDeviceCreator create) |
Register a creation static method with the factory. More... | |
Private Member Functions | |
AvrFactory () | |
Private Attributes | |
std::map< std::string, AvrFactory::AvrDeviceCreator > | devmap |
map of registered AVR devices More... | |
Produces AVR devices.
Factory for producing AVR devices according to a configuration string. This decouples the instantiation of concrete AVR devices from the code using them. It is helpful to remove all direct references to particular AVR devices in the code which uses them, such as in main.cpp.
Definition at line 39 of file avrfactory.h.
typedef AvrDevice*(* AvrFactory::AvrDeviceCreator) () |
Definition at line 42 of file avrfactory.h.
|
inlineprivate |
Definition at line 62 of file avrfactory.h.
|
static |
Singleton class access.
Definition at line 73 of file avrfactory.cpp.
Referenced by avr_create_tf().
AvrDevice * AvrFactory::makeDevice | ( | const char * | config | ) |
Produces an AVR device according to the configuration string. Right now, the configuration string is simply the full name of the AVR device, like AT90S4433 or ATMEGA128.
Definition at line 51 of file avrfactory.cpp.
References avr_error.
Referenced by avr_create_tf().
|
static |
Register a creation static method with the factory.
Definition at line 38 of file avrfactory.cpp.
References avr_error.
|
static |
Gives a list of all supported devices, which can be supplied to makeDevice() as is.
Definition at line 64 of file avrfactory.cpp.
|
private |
map of registered AVR devices
Definition at line 64 of file avrfactory.h.