Modem factory init

This commit is contained in:
Charles J. Cliffe 2015-11-17 00:21:17 -05:00
parent a1a6a467e8
commit e33b8952d4
4 changed files with 20 additions and 5 deletions

View File

@ -164,6 +164,14 @@ bool CubicSDR::OnInit() {
wxApp::SetAppName("CubicSDR");
Modem::addModemFactory("FM", new ModemFM);
Modem::addModemFactory("WBFM", new ModemFMStereo);
Modem::addModemFactory("AM", new ModemAM);
Modem::addModemFactory("LSB", new ModemLSB);
Modem::addModemFactory("USB", new ModemUSB);
Modem::addModemFactory("DSB", new ModemDSB);
Modem::addModemFactory("I/Q", new ModemIQ);
frequency = wxGetApp().getConfig()->getCenterFreq();
offset = 0;
ppm = 0;

View File

@ -27,6 +27,14 @@
#include "SpectrumVisualProcessor.h"
#include "SpectrumVisualDataThread.h"
#include "SDRDevices.h"
#include "Modem.h"
#include "ModemFM.h"
#include "ModemFMStereo.h"
#include "ModemAM.h"
#include "ModemUSB.h"
#include "ModemLSB.h"
#include "ModemDSB.h"
#include "ModemIQ.h"
#include <wx/cmdline.h>

View File

@ -2,8 +2,8 @@
ModemFactoryList Modem::modemFactories;
void Modem::addModemFactory(std::string modemName, ModemFactoryFunc *factoryFunc) {
modemFactories[modemName] = factoryFunc;
void Modem::addModemFactory(std::string modemName, Modem *factorySingle) {
modemFactories[modemName] = factorySingle;
}
ModemFactoryList Modem::getFactories() {

View File

@ -30,12 +30,11 @@ public:
};
class Modem;
typedef Modem *(Modem::*ModemFactoryFunc)();
typedef std::map<std::string,ModemFactoryFunc *> ModemFactoryList;
typedef std::map<std::string,Modem *> ModemFactoryList;
class Modem {
public:
static void addModemFactory(std::string modemName, ModemFactoryFunc *factoryFunc);
static void addModemFactory(std::string modemName, Modem *factorySingle);
static ModemFactoryList getFactories();
virtual Modem *factory();