|
Revision 19729, 2.2 kB
(checked in by patrick, 2 years ago)
|
Copyright update.
|
- Property svn:eol-style set to
native
- Property svn:keywords set to
Author Date Id Revision
|
| Line | |
|---|
| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
#ifndef _GADGET_DEVICE_CONSTRUCTOR_H_ |
|---|
| 28 |
#define _GADGET_DEVICE_CONSTRUCTOR_H_ |
|---|
| 29 |
|
|---|
| 30 |
#include <gadget/gadgetConfig.h> |
|---|
| 31 |
|
|---|
| 32 |
#include <string> |
|---|
| 33 |
#include <vpr/Util/Assert.h> |
|---|
| 34 |
#include <jccl/Config/ConfigElement.h> |
|---|
| 35 |
|
|---|
| 36 |
#include <gadget/InputManager.h> |
|---|
| 37 |
#include <gadget/Type/DeviceFactory.h> |
|---|
| 38 |
#include <gadget/Type/DeviceConstructorBase.h> |
|---|
| 39 |
|
|---|
| 40 |
|
|---|
| 41 |
namespace gadget |
|---|
| 42 |
{ |
|---|
| 43 |
|
|---|
| 44 |
|
|---|
| 45 |
|
|---|
| 46 |
|
|---|
| 47 |
|
|---|
| 48 |
template <class DEV> |
|---|
| 49 |
class DeviceConstructor : public DeviceConstructorBase |
|---|
| 50 |
{ |
|---|
| 51 |
public: |
|---|
| 52 |
DeviceConstructor(gadget::InputManager* inputMgr) |
|---|
| 53 |
{ |
|---|
| 54 |
vprASSERT(DeviceFactory::instance() != NULL); |
|---|
| 55 |
vprASSERT(inputMgr != NULL); |
|---|
| 56 |
inputMgr->getDeviceFactory()->registerDevice(this); |
|---|
| 57 |
} |
|---|
| 58 |
|
|---|
| 59 |
Input* createDevice(jccl::ConfigElementPtr element) |
|---|
| 60 |
{ |
|---|
| 61 |
DEV* new_dev = new DEV; |
|---|
| 62 |
bool success = new_dev->config(element); |
|---|
| 63 |
if(success) |
|---|
| 64 |
{ |
|---|
| 65 |
return new_dev; |
|---|
| 66 |
} |
|---|
| 67 |
else |
|---|
| 68 |
{ |
|---|
| 69 |
delete new_dev; |
|---|
| 70 |
return NULL; |
|---|
| 71 |
} |
|---|
| 72 |
} |
|---|
| 73 |
|
|---|
| 74 |
virtual std::string getElementType() |
|---|
| 75 |
{ |
|---|
| 76 |
return DEV::getElementType(); |
|---|
| 77 |
} |
|---|
| 78 |
}; |
|---|
| 79 |
|
|---|
| 80 |
} |
|---|
| 81 |
|
|---|
| 82 |
|
|---|
| 83 |
#endif |
|---|