AvrFactory Class Reference

Produces AVR devices. More...

#include <avrfactory.h>

Collaboration diagram for AvrFactory:
Collaboration graph
[legend]

List of all members.

Public Types

typedef AvrDevice *(* AvrDeviceCreator )()

Public Member Functions

AvrDevicemakeDevice (const char *config)

Static Public Member Functions

static AvrFactoryinstance ()
 Singleton class access.
static std::string supportedDevices ()
static void reg (const std::string name, AvrDeviceCreator create)
 Register a creation static method with the factory.

Private Member Functions

 AvrFactory ()

Private Attributes

std::map< std::string,
AvrFactory::AvrDeviceCreator
devmap
 map of registered AVR devices

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

Definition at line 42 of file avrfactory.h.


Constructor & Destructor Documentation

AvrFactory::AvrFactory (  )  [inline, private]

Definition at line 62 of file avrfactory.h.


Member Function Documentation

AvrFactory & AvrFactory::instance (  )  [static]

Singleton class access.

Definition at line 72 of file avrfactory.cpp.

Referenced by avr_create_tf(), main(), reg(), and supportedDevices().

Here is the caller graph for this function:

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 50 of file avrfactory.cpp.

References avr_error, and devmap.

Referenced by avr_create_tf(), and main().

Here is the caller graph for this function:

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

Register a creation static method with the factory.

Definition at line 37 of file avrfactory.cpp.

References avr_error, devmap, and instance().

Here is the call graph for this function:

std::string AvrFactory::supportedDevices (  )  [static]

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

Definition at line 63 of file avrfactory.cpp.

References devmap, and instance().

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

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

map of registered AVR devices

Definition at line 64 of file avrfactory.h.

Referenced by makeDevice(), reg(), and supportedDevices().


The documentation for this class was generated from the following files:
Generated on Sun Feb 12 16:50:34 2012 for Simulavr by  doxygen 1.6.3