36 typedef map<std::string, AvrFactory::AvrDeviceCreator>
AVRDeviceMap;
39 AvrDeviceCreator create) {
41 for(
unsigned int i = 0; i < devname.size(); i++)
42 devname[i] = tolower(devname[i]);
44 AVRDeviceMap::iterator i = devmap.find(devname);
46 devmap[devname] = create;
48 avr_error(
"Duplicate device specification: %s", devname.c_str());
53 for(
unsigned int i = 0; i < devname.size(); i++)
54 devname[i] = tolower(devname[i]);
55 if(devname ==
"unknown")
56 avr_error(
"Device type not specified, use -d | --device TYPE or insert '#include <avr/signature.h>' into your source to specify device signature");
57 AVRDeviceMap::iterator i = devmap.find(devname);
59 avr_error(
"Invalid device specification: %s", in);
61 return devmap[devname]();
65 static std::vector<std::string> ret;
68 for(AVRDeviceMap::iterator i = devmap.begin(); i != devmap.end(); i++)
69 ret.push_back(i->first);
Basic AVR device, contains the core functionality.
map< std::string, AvrFactory::AvrDeviceCreator > AVRDeviceMap
static std::vector< std::string > & supportedDevices()
static AvrFactory & instance()
Singleton class access.
static void reg(const std::string name, AvrDeviceCreator create)
Register a creation static method with the factory.
AvrDevice * makeDevice(const char *config)