Modem class update

* get_xxx methods declared const where appropriate
  * Simple get_xxx methods inlined for better performances and smaller code.
pull/1/head
Remi Chateauneu 2011-12-03 10:07:02 +00:00 zatwierdzone przez David Freese
rodzic 8d647fc315
commit ee1ab43ae4
2 zmienionych plików z 18 dodań i 47 usunięć

Wyświetl plik

@ -86,29 +86,31 @@ public:
virtual void searchUp() {};
void HistoryON(bool val) {historyON = val;}
bool HistoryON() { return historyON;}
bool HistoryON() const { return historyON;}
trx_mode get_mode();
const char *get_mode_name() { return mode_info[get_mode()].sname;}
/// Inlined const getters are faster and smaller.
trx_mode get_mode() const { return mode; };
const char *get_mode_name() const { return mode_info[get_mode()].sname;}
virtual void set_freq(double);
int get_freq();
/// Inlining small formulas is still faster and shorter.
int get_freq() const { return (int)( frequency + 0.5 ); }
void init_freqlock();
void set_freqlock(bool);
void set_sigsearch(int n) { sigsearch = n; freqerr = 0.0;};
bool freqlocked();
double get_txfreq();
double get_txfreq_woffset();
bool freqlocked() const { return freqlock;}
/// Getters are semantically const.
double get_txfreq() const;
double get_txfreq_woffset() const;
void set_metric(double);
void display_metric(double);
double get_metric();
double get_metric() const { return metric;}
void set_reverse(bool on);
bool get_reverse() { return reverse; }
double get_bandwidth();
bool get_reverse() const { return reverse;}
double get_bandwidth() const { return bandwidth;}
void set_bandwidth(double);
int get_samplerate();
int get_samplerate() const { return samplerate;}
void set_samplerate(int);
void init_queues();
int get_echo_char();
void ModulateXmtr(double *, int);
void ModulateStereo(double *, double *, int);
@ -117,9 +119,9 @@ public:
void pretone();
void set_stopflag(bool b) { stopflag = b;};
bool get_stopflag() { return stopflag; };
bool get_stopflag() const { return stopflag; };
unsigned get_cap(void) { return cap; }
unsigned get_cap(void) const { return cap; }
enum { CAP_AFC = 1 << 0, CAP_AFC_SR = 1 << 1, CAP_REV = 1 << 2,
CAP_IMG = 1 << 3, CAP_BW = 1 << 4, CAP_RX = 1 << 5,
CAP_TX = 1 << 6

Wyświetl plik

@ -123,11 +123,6 @@ modem *wwv_modem = 0;
modem *anal_modem = 0;
modem *ssb_modem = 0;
trx_mode modem::get_mode()
{
return mode;
}
modem::modem()
{
scptr = 0;
@ -181,12 +176,7 @@ void modem::set_freqlock(bool on)
}
bool modem::freqlocked()
{
return freqlock;
}
double modem::get_txfreq(void)
double modem::get_txfreq(void) const
{
if (unlikely(!(cap & CAP_TX)))
return 0;
@ -195,23 +185,13 @@ double modem::get_txfreq(void)
return tx_frequency;
}
double modem::get_txfreq_woffset(void)
double modem::get_txfreq_woffset(void) const
{
if (mailserver && progdefaults.PSKmailSweetSpot)
return (progdefaults.PSKsweetspot - progdefaults.TxOffset);
return (tx_frequency - progdefaults.TxOffset);
}
int modem::get_freq()
{
return (int)(frequency + 0.5);
}
double modem::get_bandwidth(void)
{
return bandwidth;
}
void modem::set_bandwidth(double bw)
{
bandwidth = bw;
@ -234,12 +214,6 @@ void modem::display_metric(double m)
::global_display_metric(m);
}
double modem::get_metric(void)
{
return metric;
}
bool modem::get_cwTrack()
{
return cwTrack;
@ -275,11 +249,6 @@ void modem::set_cwXmtWPM(double wpm)
cwXmtWPM = wpm;
}
int modem::get_samplerate(void)
{
return samplerate;
}
void modem::set_samplerate(int smprate)
{
samplerate = smprate;