Changeset 10040 in ntrip


Ignore:
Timestamp:
May 11, 2023, 2:23:16 PM (13 months ago)
Author:
stuerze
Message:

minor changes

Location:
trunk/BNC/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/bnccore.cpp

    r10039 r10040  
    7373  _rawFile     = 0;
    7474  _caster      = 0;
    75   _bncComb     = 0;
    7675
    7776  // Eph file(s)
     
    143142  }
    144143
    145   if (_bncComb) {
    146     delete _bncComb;
    147     _bncComb = 0;
    148   }
     144  bncComb::destruct();
     145
    149146  delete _pppMain;
    150147}
     
    758755//
    759756////////////////////////////////////////////////////////////////////////////
    760 void t_bncCore::initCombination() {//cout << "initCombination" << endl;
    761   _bncComb = new bncComb();
    762   if (_bncComb->nStreams() < 1) {
    763     delete _bncComb;
    764     _bncComb = 0;
     757void t_bncCore::initCombination() {
     758  bncComb::getInstance();
     759  if (BNC_CMB->nStreams() < 1) {
     760    bncComb::destruct();
    765761  }
    766762}
     
    769765////////////////////////////////////////////////////////////////////////////
    770766void t_bncCore::stopCombination() {
    771   delete _bncComb;
    772   _bncComb = 0;
     767  bncComb::destruct();
    773768}
    774769
  • trunk/BNC/src/bnccore.h

    r9760 r10040  
    150150  QDate                  _fileDate;
    151151  bncRawFile*            _rawFile;
    152   bncComb*               _bncComb;
    153152  e_mode                 _mode;
    154153  QWidget*               _mainWindow;
  • trunk/BNC/src/combination/bnccomb.cpp

    r10039 r10040  
    114114}
    115115
    116 
    117 // Singleton
    118 ////////////////////////////////////////////////////////////////////////////
    119 bncComb* bncComb::instance() {//cout << "bncComb::instance()" << endl;
    120   static bncComb _bncComb;
    121   return &_bncComb;
    122 }
     116// Singleton: definition class variable
     117////////////////////////////////////////////////////////////////////////////
     118bncComb* bncComb::instance = nullptr;
     119
    123120
    124121// Constructor
    125122////////////////////////////////////////////////////////////////////////////
    126 bncComb::bncComb() : _ephUser(true) {//cout << "bncComb::bncComb()" << endl;
     123bncComb::bncComb() : _ephUser(true) {
    127124
    128125  bncSettings settings;
  • trunk/BNC/src/combination/bnccomb.h

    r10039 r10040  
    2222 Q_OBJECT
    2323 public:
    24   bncComb();
    25   virtual ~bncComb();
    26   static bncComb* instance();
     24  static bncComb* getInstance() {
     25    if (instance == 0) {
     26      instance = new bncComb;
     27    }
     28    return instance;
     29  }
     30  bncComb(const bncComb&) = delete;
     31  bncComb& operator=(const bncComb&) = delete;
     32  static void destruct() {
     33    delete instance;
     34    instance = nullptr;
     35  }
    2736  int  nStreams() const {return _ACs.size();}
    2837
     
    3342  void slotNewCodeBiases(QList<t_satCodeBias> satCodeBiases);
    3443
    35 
    3644 private slots:
    3745  void slotReadBiasSnxFile();
     
    4452
    4553 private:
    46   //bncComb();                  // private constructor
    47   bncComb(const bncComb&);
    48   bncComb& operator=(const bncComb&);
    49 
     54  bncComb();                // no public constructor
     55  ~bncComb();               // no public destructor
     56  static bncComb* instance; // declaration class variable
    5057  enum e_method{singleEpoch, filter};
    5158
     
    267274};
    268275
    269 #define BNC_CMB (bncComb::instance())
     276#define BNC_CMB (bncComb::getInstance())
    270277
    271278#endif
Note: See TracChangeset for help on using the changeset viewer.