- Timestamp:
- May 11, 2023, 2:23:16 PM (18 months ago)
- Location:
- trunk/BNC/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/bnccore.cpp
r10039 r10040 73 73 _rawFile = 0; 74 74 _caster = 0; 75 _bncComb = 0;76 75 77 76 // Eph file(s) … … 143 142 } 144 143 145 if (_bncComb) { 146 delete _bncComb; 147 _bncComb = 0; 148 } 144 bncComb::destruct(); 145 149 146 delete _pppMain; 150 147 } … … 758 755 // 759 756 //////////////////////////////////////////////////////////////////////////// 760 void t_bncCore::initCombination() {//cout << "initCombination" << endl; 761 _bncComb = new bncComb(); 762 if (_bncComb->nStreams() < 1) { 763 delete _bncComb; 764 _bncComb = 0; 757 void t_bncCore::initCombination() { 758 bncComb::getInstance(); 759 if (BNC_CMB->nStreams() < 1) { 760 bncComb::destruct(); 765 761 } 766 762 } … … 769 765 //////////////////////////////////////////////////////////////////////////// 770 766 void t_bncCore::stopCombination() { 771 delete _bncComb; 772 _bncComb = 0; 767 bncComb::destruct(); 773 768 } 774 769 -
trunk/BNC/src/bnccore.h
r9760 r10040 150 150 QDate _fileDate; 151 151 bncRawFile* _rawFile; 152 bncComb* _bncComb;153 152 e_mode _mode; 154 153 QWidget* _mainWindow; -
trunk/BNC/src/combination/bnccomb.cpp
r10039 r10040 114 114 } 115 115 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 //////////////////////////////////////////////////////////////////////////// 118 bncComb* bncComb::instance = nullptr; 119 123 120 124 121 // Constructor 125 122 //////////////////////////////////////////////////////////////////////////// 126 bncComb::bncComb() : _ephUser(true) { //cout << "bncComb::bncComb()" << endl;123 bncComb::bncComb() : _ephUser(true) { 127 124 128 125 bncSettings settings; -
trunk/BNC/src/combination/bnccomb.h
r10039 r10040 22 22 Q_OBJECT 23 23 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 } 27 36 int nStreams() const {return _ACs.size();} 28 37 … … 33 42 void slotNewCodeBiases(QList<t_satCodeBias> satCodeBiases); 34 43 35 36 44 private slots: 37 45 void slotReadBiasSnxFile(); … … 44 52 45 53 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 50 57 enum e_method{singleEpoch, filter}; 51 58 … … 267 274 }; 268 275 269 #define BNC_CMB (bncComb:: instance())276 #define BNC_CMB (bncComb::getInstance()) 270 277 271 278 #endif
Note:
See TracChangeset
for help on using the changeset viewer.