diff options
Diffstat (limited to 'src/iofactory.cc')
-rw-r--r-- | src/iofactory.cc | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/src/iofactory.cc b/src/iofactory.cc index 2fe4816..2a50ce1 100644 --- a/src/iofactory.cc +++ b/src/iofactory.cc @@ -7,29 +7,17 @@ #include "iofactory.h" -#include "iodevice.h" - using namespace Binc; -IOFactory::IOFactory() {} - -IOFactory::~IOFactory() {} - IOFactory &IOFactory::getInstance() { static IOFactory ioFactory; return ioFactory; } -void IOFactory::addDevice(IODevice *dev) +void IOFactory::addDevice(std::unique_ptr<IODevice> dev) { - IODevice *ioDevice = IOFactory::getInstance().devices[dev->service()]; - - // FIXME: Delete correct object. Now, only IODevice's destructor is - // called, and only IODevice's memory is freed. - if (ioDevice) delete ioDevice; - - IOFactory::getInstance().devices[dev->service()] = dev; + IOFactory::getInstance().devices[dev->service()] = std::move(dev); } IODevice &IOFactory::getClient() |