#include <gadget/Type/DeviceFactory.h>
Public Member Functions | |
| void | registerDevice (DeviceConstructorBase *constructor) |
| bool | recognizeDevice (jccl::ConfigElementPtr element) |
| Queries if the factory knows about the given device. | |
| Input * | loadDevice (jccl::ConfigElementPtr element) |
| Loads the specified device. | |
Definition at line 54 of file DeviceFactory.h.
| void gadget::DeviceFactory::registerDevice | ( | DeviceConstructorBase * | constructor | ) |
Definition at line 161 of file DeviceFactory.cpp.
References gadgetDBG_INPUT_MGR(), and gadget::DeviceConstructorBase::getElementType().
Referenced by gadget::DeviceConstructor< DEV >::DeviceConstructor().
00162 { 00163 vprASSERT(constructor != NULL); 00164 mConstructors.push_back(constructor); // Add the constructor to the list 00165 vprDEBUG(gadgetDBG_INPUT_MGR, vprDBG_STATE_LVL) 00166 << "gadget::DeviceFactory: Registered: " 00167 << std::setiosflags(std::ios::right) << std::setw(25) 00168 << std::setfill(' ') << constructor->getElementType() 00169 << std::setiosflags(std::ios::right) 00170 //<< " :" << (void*)constructor 00171 << " type: " << typeid(*constructor).name() << std::endl 00172 << vprDEBUG_FLUSH; 00173 }
| bool gadget::DeviceFactory::recognizeDevice | ( | jccl::ConfigElementPtr | element | ) |
Queries if the factory knows about the given device.
| element | The element we are requesting about knowledge to create. |
Definition at line 177 of file DeviceFactory.cpp.
Referenced by loadDevice().
| Input * gadget::DeviceFactory::loadDevice | ( | jccl::ConfigElementPtr | element | ) |
Loads the specified device.
| element | The specification of the device to load. |
Definition at line 185 of file DeviceFactory.cpp.
References gadget::DeviceConstructorBase::createDevice(), gadgetDBG_INPUT_MGR(), and recognizeDevice().
00186 { 00187 vprASSERT(recognizeDevice(element)); 00188 00189 int index(findConstructor(element)); 00190 00191 Input* new_dev; 00192 DeviceConstructorBase* constructor = mConstructors[index]; 00193 00194 vprDEBUG(gadgetDBG_INPUT_MGR, vprDBG_STATE_LVL) 00195 << "gadget::DeviceFactory::loadDevice: Loading device: " 00196 << element->getID() << " with: " << typeid(*constructor).name() 00197 << std::endl << vprDEBUG_FLUSH; 00198 00199 new_dev = constructor->createDevice(element); 00200 return new_dev; 00201 }
1.5.1