#include <BaseTypeFactory.h>
Public Methods | |
| void | registerNetDevice (BaseTypeConstructorBase *constructor) |
| bool | recognizeNetDevice (std::string base_type) |
| Queries if the factory knows about the given device. More... | |
| Input * | loadNetDevice (std::string base_type) |
| Loads the specified device. More... | |
Definition at line 84 of file BaseTypeFactory.h.
|
|
Definition at line 138 of file BaseTypeFactory.cpp.
00139 {
00140 vprASSERT(constructor != NULL);
00141 mConstructors.push_back(constructor); // Add the constructor to the list
00142 //vprDEBUG(gadgetDBG_INPUT_MGR, vprDBG_CONFIG_LVL)
00143 // << "gadget::DeviceFactory: Registered: "
00144 // << std::setiosflags(std::ios::right) << std::setw(25)
00145 // << std::setfill(' ') << constructor->getElementType()
00146 // << std::setiosflags(std::ios::right)
00147 //<< " :" << (void*)constructor
00148 // << " type: " << typeid(*constructor).name() << std::endl
00149 // << vprDEBUG_FLUSH;
00150 }
|
|
|
Queries if the factory knows about the given device.
Definition at line 154 of file BaseTypeFactory.cpp. Referenced by loadNetDevice.
00155 {
00156 if(findConstructor(base_type) == -1)
00157 return false;
00158 else
00159 return true;
00160 }
|
|
|
Loads the specified device.
Definition at line 165 of file BaseTypeFactory.cpp. References gadgetDBG_RIM, and recognizeNetDevice.
00166 {
00167 vprASSERT(recognizeNetDevice(base_type));
00168
00169 int index = findConstructor(base_type);
00170
00171 Input* new_dev;
00172 BaseTypeConstructorBase* constructor = mConstructors[index];
00173
00174 //vprDEBUG(gadgetDBG_INPUT_MGR, vprDBG_STATE_LVL)
00175 // << "gadget::BaseType::loadDevice: Loading device: "
00176 // << element->getID() << " with: " << typeid(*constructor).name()
00177 // << std::endl << vprDEBUG_FLUSH;
00178
00179 new_dev = constructor->createNetDevice(base_type);
00180 if(new_dev!=NULL)
00181 {
00182 vprDEBUG(gadgetDBG_RIM,vprDBG_VERB_LVL) << "[NetDevice Factory] Found the BaseType\n"<< vprDEBUG_FLUSH;
00183 }
00184 return new_dev;
00185 }
|
1.2.14 written by Dimitri van Heesch,
© 1997-2002