simulavr  1.1.0
AvrFactory Class Reference

Produces AVR devices. More...

#include <avrfactory.h>

Public Types

typedef AvrDevice *(* AvrDeviceCreator) ()
 

Public Member Functions

AvrDevicemakeDevice (const char *config)
 

Static Public Member Functions

static AvrFactoryinstance ()
 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::AvrDeviceCreatordevmap
 map of registered AVR devices More...
 

Detailed Description

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.

Member Typedef Documentation

◆ AvrDeviceCreator

typedef AvrDevice*(* AvrFactory::AvrDeviceCreator) ()

Definition at line 42 of file avrfactory.h.

Constructor & Destructor Documentation

◆ AvrFactory()

AvrFactory::AvrFactory ( )
inlineprivate

Definition at line 62 of file avrfactory.h.

Member Function Documentation

◆ instance()

AvrFactory & AvrFactory::instance ( )
static

Singleton class access.

Definition at line 73 of file avrfactory.cpp.

Referenced by avr_create_tf().

◆ makeDevice()

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().

◆ reg()

void AvrFactory::reg ( const std::string  name,
AvrDeviceCreator  create 
)
static

Register a creation static method with the factory.

Definition at line 38 of file avrfactory.cpp.

References avr_error.

◆ supportedDevices()

std::vector< std::string > & AvrFactory::supportedDevices ( )
static

Gives a list of all supported devices, which can be supplied to makeDevice() as is.

Definition at line 64 of file avrfactory.cpp.

Member Data Documentation

◆ devmap

std::map<std::string, AvrFactory::AvrDeviceCreator> AvrFactory::devmap
private

map of registered AVR devices

Definition at line 64 of file avrfactory.h.


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