#include <DeviceFactory.h>
Public Methods | |
| void | registerDevice (DeviceConstructorBase *constructor) |
| bool | recognizeDevice (jccl::ConfigElementPtr element) |
| Queries if the factory knows about the given device. More... | |
| Input * | loadDevice (jccl::ConfigElementPtr element) |
| Loads the specified device. More... | |
Definition at line 53 of file DeviceFactory.h.
|
|
Definition at line 152 of file DeviceFactory.cpp. References gadgetDBG_INPUT_MGR.
00153 {
00154 vprASSERT(constructor != NULL);
00155 mConstructors.push_back(constructor); // Add the constructor to the list
00156 vprDEBUG(gadgetDBG_INPUT_MGR, vprDBG_STATE_LVL)
00157 << "gadget::DeviceFactory: Registered: "
00158 << std::setiosflags(std::ios::right) << std::setw(25)
00159 << std::setfill(' ') << constructor->getElementType()
00160 << std::setiosflags(std::ios::right)
00161 //<< " :" << (void*)constructor
00162 << " type: " << typeid(*constructor).name() << std::endl
00163 << vprDEBUG_FLUSH;
00164 }
|
|
|
Queries if the factory knows about the given device.
Definition at line 168 of file DeviceFactory.cpp. Referenced by loadDevice.
00169 {
00170 return ! (findConstructor(element) == -1);
00171 }
|
|
|
Loads the specified device.
Definition at line 176 of file DeviceFactory.cpp. References gadgetDBG_INPUT_MGR, and recognizeDevice.
00177 {
00178 vprASSERT(recognizeDevice(element));
00179
00180 int index(findConstructor(element));
00181
00182 Input* new_dev;
00183 DeviceConstructorBase* constructor = mConstructors[index];
00184
00185 vprDEBUG(gadgetDBG_INPUT_MGR, vprDBG_STATE_LVL)
00186 << "gadget::DeviceFactory::loadDevice: Loading device: "
00187 << element->getID() << " with: " << typeid(*constructor).name()
00188 << std::endl << vprDEBUG_FLUSH;
00189
00190 new_dev = constructor->createDevice(element);
00191 return new_dev;
00192 }
|
1.2.14 written by Dimitri van Heesch,
© 1997-2002