summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaksym Telychko <maksym.telychko@globallogic.com>2019-06-07 13:56:26 +0300
committerMaksym Telychko <maksym.telychko@globallogic.com>2019-06-07 13:56:26 +0300
commit402354f2410917888a7d4b04a2cbc3a76a321549 (patch)
treeeb9aec5ce4ec7f571c5a6fd2f2d3b884893b5d7e
parent55c18e47596b6be9f19b33deb6c5cd0e798decd8 (diff)
downloadlibmts-io-402354f2410917888a7d4b04a2cbc3a76a321549.tar.gz
libmts-io-402354f2410917888a7d4b04a2cbc3a76a321549.tar.bz2
libmts-io-402354f2410917888a7d4b04a2cbc3a76a321549.zip
[MTS-MTQ] refactoring: factory interface
-rw-r--r--include/mts/MTS_IO_CellularRadioFactory.h51
-rw-r--r--src/MTS_IO_CellularRadioFactory.cpp38
2 files changed, 42 insertions, 47 deletions
diff --git a/include/mts/MTS_IO_CellularRadioFactory.h b/include/mts/MTS_IO_CellularRadioFactory.h
index 540ed29..c26e642 100644
--- a/include/mts/MTS_IO_CellularRadioFactory.h
+++ b/include/mts/MTS_IO_CellularRadioFactory.h
@@ -21,18 +21,13 @@
#ifndef MTS_IO_CELLULARRADIOFACTORY_H_
#define MTS_IO_CELLULARRADIOFACTORY_H_
-#include <mts/MTS_IO_CellularRadio.h>
-#include <mts/MTS_IO_TelitRadio.h>
#include <string>
#include <map>
+#include <mts/MTS_IO_ICellularRadio.h>
+
namespace MTS {
namespace IO {
-
- class HE910Radio;
- class GE910Radio;
- class DE910Radio;
- class CE910Radio;
class EXPORT CellularRadioFactory {
public:
@@ -40,29 +35,29 @@ namespace MTS {
CellularRadioFactory();
virtual ~CellularRadioFactory() {};
- virtual CellularRadio* create(const std::string& sModel, const std::string& sPort = TelitRadio::DEFAULT_RADIO_PORT);
-
- virtual CellularRadio* createHE910D(const std::string& sPort = TelitRadio::DEFAULT_RADIO_PORT);
- virtual CellularRadio* createHE910EUD(const std::string& sPort = TelitRadio::DEFAULT_RADIO_PORT);
- virtual CellularRadio* createLE910NAG(const std::string& sPort = TelitRadio::DEFAULT_RADIO_PORT);
- virtual CellularRadio* createLE910C4NF(const std::string& sPort = TelitRadio::DEFAULT_RADIO_PORT);
- virtual CellularRadio* createLE910NA1(const std::string& sPort = TelitRadio::DEFAULT_RADIO_PORT);
- virtual CellularRadio* createLE910SVG(const std::string& sPort = TelitRadio::DEFAULT_RADIO_PORT);
- virtual CellularRadio* createLE910EUG(const std::string& sPort = TelitRadio::DEFAULT_RADIO_PORT);
- virtual CellularRadio* createLE910C4EU(const std::string& sPort = TelitRadio::DEFAULT_RADIO_PORT);
- virtual CellularRadio* createLE910EU1(const std::string& sPort = TelitRadio::DEFAULT_RADIO_PORT);
- virtual CellularRadio* createLE910C1NS(const std::string& sPort = TelitRadio::DEFAULT_RADIO_PORT);
- virtual CellularRadio* createLE910C1AP(const std::string& sPort = TelitRadio::DEFAULT_RADIO_PORT);
- virtual CellularRadio* createME910C1NA(const std::string& sPort = TelitRadio::DEFAULT_RADIO_PORT);
- virtual CellularRadio* createME910C1NV(const std::string& sPort = TelitRadio::DEFAULT_RADIO_PORT);
- virtual CellularRadio* createME910C1WW(const std::string& sPort = TelitRadio::DEFAULT_RADIO_PORT);
- virtual CellularRadio* createGE910(const std::string& sPort = TelitRadio::DEFAULT_RADIO_PORT);
- virtual CellularRadio* createDE910(const std::string& sPort = TelitRadio::DEFAULT_RADIO_PORT);
- virtual CellularRadio* createCE910(const std::string& sPort = TelitRadio::DEFAULT_RADIO_PORT);
- virtual CellularRadio* createLE866A1JS(const std::string& sPort = TelitRadio::DEFAULT_RADIO_PORT);
+ virtual ICellularRadio* create(const std::string& sModel, const std::string& sPort = ICellularRadio::DEFAULT_RADIO_PORT);
+
+ virtual ICellularRadio* createHE910D(const std::string& sPort = ICellularRadio::DEFAULT_RADIO_PORT);
+ virtual ICellularRadio* createHE910EUD(const std::string& sPort = ICellularRadio::DEFAULT_RADIO_PORT);
+ virtual ICellularRadio* createLE910NAG(const std::string& sPort = ICellularRadio::DEFAULT_RADIO_PORT);
+ virtual ICellularRadio* createLE910C4NF(const std::string& sPort = ICellularRadio::DEFAULT_RADIO_PORT);
+ virtual ICellularRadio* createLE910NA1(const std::string& sPort = ICellularRadio::DEFAULT_RADIO_PORT);
+ virtual ICellularRadio* createLE910SVG(const std::string& sPort = ICellularRadio::DEFAULT_RADIO_PORT);
+ virtual ICellularRadio* createLE910EUG(const std::string& sPort = ICellularRadio::DEFAULT_RADIO_PORT);
+ virtual ICellularRadio* createLE910C4EU(const std::string& sPort = ICellularRadio::DEFAULT_RADIO_PORT);
+ virtual ICellularRadio* createLE910EU1(const std::string& sPort = ICellularRadio::DEFAULT_RADIO_PORT);
+ virtual ICellularRadio* createLE910C1NS(const std::string& sPort = ICellularRadio::DEFAULT_RADIO_PORT);
+ virtual ICellularRadio* createLE910C1AP(const std::string& sPort = ICellularRadio::DEFAULT_RADIO_PORT);
+ virtual ICellularRadio* createME910C1NA(const std::string& sPort = ICellularRadio::DEFAULT_RADIO_PORT);
+ virtual ICellularRadio* createME910C1NV(const std::string& sPort = ICellularRadio::DEFAULT_RADIO_PORT);
+ virtual ICellularRadio* createME910C1WW(const std::string& sPort = ICellularRadio::DEFAULT_RADIO_PORT);
+ virtual ICellularRadio* createGE910(const std::string& sPort = ICellularRadio::DEFAULT_RADIO_PORT);
+ virtual ICellularRadio* createDE910(const std::string& sPort = ICellularRadio::DEFAULT_RADIO_PORT);
+ virtual ICellularRadio* createCE910(const std::string& sPort = ICellularRadio::DEFAULT_RADIO_PORT);
+ virtual ICellularRadio* createLE866A1JS(const std::string& sPort = ICellularRadio::DEFAULT_RADIO_PORT);
protected:
- typedef MTS::IO::CellularRadio* (CellularRadioFactory::*CREATEFUNCPTR)(const std::string& sPort);
+ typedef MTS::IO::ICellularRadio* (CellularRadioFactory::*CREATEFUNCPTR)(const std::string& sPort);
std::map< std::string, CREATEFUNCPTR > m_mCreationMap;
virtual std::string identifyRadio(const std::string& sPort);
diff --git a/src/MTS_IO_CellularRadioFactory.cpp b/src/MTS_IO_CellularRadioFactory.cpp
index 17cbd05..130d3ed 100644
--- a/src/MTS_IO_CellularRadioFactory.cpp
+++ b/src/MTS_IO_CellularRadioFactory.cpp
@@ -62,7 +62,7 @@ CellularRadioFactory::CellularRadioFactory() {
m_mCreationMap[LE866A1JSRadio::MODEL_NAME] = &CellularRadioFactory::createLE866A1JS;
}
-MTS::IO::CellularRadio* CellularRadioFactory::create(const std::string& sModel, const std::string& sPort) {
+ICellularRadio* CellularRadioFactory::create(const std::string& sModel, const std::string& sPort) {
std::string model(sModel);
@@ -123,74 +123,74 @@ std::string CellularRadioFactory::identifyRadio(const std::string& sPort) {
return sModel;
}
-CellularRadio* CellularRadioFactory::createHE910D(const std::string& sPort) {
+ICellularRadio* CellularRadioFactory::createHE910D(const std::string& sPort) {
return new HE910DRadio(sPort);
}
-CellularRadio* CellularRadioFactory::createHE910EUD(const std::string& sPort) {
+ICellularRadio* CellularRadioFactory::createHE910EUD(const std::string& sPort) {
return new HE910EUDRadio(sPort);
}
-CellularRadio* CellularRadioFactory::createLE910NAG(const std::string& sPort) {
+ICellularRadio* CellularRadioFactory::createLE910NAG(const std::string& sPort) {
return new LE910NAGRadio(sPort);
}
-CellularRadio* CellularRadioFactory::createLE910C4NF(const std::string& sPort) {
+ICellularRadio* CellularRadioFactory::createLE910C4NF(const std::string& sPort) {
return new LE910C4NFRadio(sPort);
}
-CellularRadio* CellularRadioFactory::createLE910NA1(const std::string& sPort) {
+ICellularRadio* CellularRadioFactory::createLE910NA1(const std::string& sPort) {
return new LE910NA1Radio(sPort);
}
-CellularRadio* CellularRadioFactory::createLE910SVG(const std::string& sPort) {
+ICellularRadio* CellularRadioFactory::createLE910SVG(const std::string& sPort) {
return new LE910SVGRadio(sPort);
}
-CellularRadio* CellularRadioFactory::createLE910EUG(const std::string& sPort) {
+ICellularRadio* CellularRadioFactory::createLE910EUG(const std::string& sPort) {
return new LE910EUGRadio(sPort);
}
-CellularRadio* CellularRadioFactory::createLE910C4EU(const std::string& sPort) {
+ICellularRadio* CellularRadioFactory::createLE910C4EU(const std::string& sPort) {
return new LE910C4EURadio(sPort);
}
-CellularRadio* CellularRadioFactory::createLE910EU1(const std::string& sPort) {
+ICellularRadio* CellularRadioFactory::createLE910EU1(const std::string& sPort) {
return new LE910EU1Radio(sPort);
}
-CellularRadio* CellularRadioFactory::createLE910C1NS(const std::string& sPort) {
+ICellularRadio* CellularRadioFactory::createLE910C1NS(const std::string& sPort) {
return new LE910C1NSRadio(sPort);
}
-CellularRadio* CellularRadioFactory::createLE910C1AP(const std::string& sPort) {
+ICellularRadio* CellularRadioFactory::createLE910C1AP(const std::string& sPort) {
return new LE910C1APRadio(sPort);
}
-CellularRadio* CellularRadioFactory::createME910C1NA(const std::string& sPort) {
+ICellularRadio* CellularRadioFactory::createME910C1NA(const std::string& sPort) {
return new ME910C1NARadio(sPort);
}
-CellularRadio* CellularRadioFactory::createME910C1NV(const std::string& sPort) {
+ICellularRadio* CellularRadioFactory::createME910C1NV(const std::string& sPort) {
return new ME910C1NVRadio(sPort);
}
-CellularRadio* CellularRadioFactory::createME910C1WW(const std::string& sPort) {
+ICellularRadio* CellularRadioFactory::createME910C1WW(const std::string& sPort) {
return new ME910C1WWRadio(sPort);
}
-CellularRadio* CellularRadioFactory::createGE910(const std::string& sPort) {
+ICellularRadio* CellularRadioFactory::createGE910(const std::string& sPort) {
return new GE910Radio(sPort);
}
-CellularRadio* CellularRadioFactory::createDE910(const std::string& sPort) {
+ICellularRadio* CellularRadioFactory::createDE910(const std::string& sPort) {
return new DE910Radio(sPort);
}
-CellularRadio* CellularRadioFactory::createCE910(const std::string& sPort) {
+ICellularRadio* CellularRadioFactory::createCE910(const std::string& sPort) {
return new CE910Radio(sPort);
}
-CellularRadio* CellularRadioFactory::createLE866A1JS(const std::string &sPort) {
+ICellularRadio* CellularRadioFactory::createLE866A1JS(const std::string &sPort) {
return new LE866A1JSRadio(sPort);
}