Index: /trunk/BNC/combination/bnccomb.cpp
===================================================================
--- /trunk/BNC/combination/bnccomb.cpp	(revision 2917)
+++ /trunk/BNC/combination/bnccomb.cpp	(revision 2918)
@@ -30,12 +30,15 @@
 
   QStringList combineStreams = settings.value("combineStreams").toStringList();
-  
-  _nStreams = combineStreams.size();
-  
-  if (_nStreams >= 2) {
+
+  if (combineStreams.size() >= 2) {
     QListIterator<QString> it(combineStreams);
     while (it.hasNext()) {
       QStringList hlp = it.next().split(" ");
-      cout << "combination: " << hlp[0].toAscii().data() << endl;
+      cmbAC* newAC = new cmbAC();
+      newAC->mountPoint = hlp[0];
+      newAC->name       = hlp[1];
+      newAC->weight     = hlp[2].toDouble();
+
+      _ACs[newAC->mountPoint] = newAC;
     }
   }
@@ -45,4 +48,9 @@
 ////////////////////////////////////////////////////////////////////////////
 bncComb::~bncComb() {
+  QMapIterator<QString, cmbAC*> it(_ACs);
+  while (it.hasNext()) {
+    it.next();
+    delete it.value();
+  }
 }
 
@@ -52,4 +60,13 @@
   QMutexLocker locker(&_mutex);
 
+  // Find the relevant instance of cmbAC class
+  // -----------------------------------------
+  if (_ACs.find(staID) == _ACs.end()) {
+    return;
+  }
+  cmbAC* AC = _ACs[staID];
+
+  // Read the Correction
+  // -------------------
   t_corr* newCorr = new t_corr();
   if (!newCorr->readLine(line) == success) {
@@ -58,9 +75,64 @@
   }
 
-  cout << staID.toAscii().data() << " " << newCorr->prn.toAscii().data() << " "
-       << newCorr->tt.datestr() << " " << newCorr->tt.timestr() << " "
-       << newCorr->iod << " " << newCorr->dClk << endl;
+  // Find/Create the instance of cmbEpoch class
+  // ------------------------------------------
+  cmbEpoch* newEpoch = 0;
+  QListIterator<cmbEpoch*> it(AC->epochs);
+  while (it.hasNext()) {
+    cmbEpoch* hlpEpoch = it.next();
+    if (hlpEpoch->time == newCorr->tt) {
+      newEpoch = hlpEpoch;
+      break;
+    }
+  }
+  if (newEpoch == 0) {
+    newEpoch = new cmbEpoch();
+    newEpoch->time = newCorr->tt;
+    AC->epochs.append(newEpoch);
+  }
 
-  delete newCorr;
+  if (newEpoch->corr.find(newCorr->prn) != newEpoch->corr.end()) {
+    delete newEpoch->corr[newCorr->prn];     
+  }
+  newEpoch->corr[newCorr->prn] = newCorr;
+
+  processEpochsBefore(newCorr->tt);
 }
 
+// 
+////////////////////////////////////////////////////////////////////////////
+void bncComb::processEpochsBefore(const bncTime& time) {
+
+  const double waitTime = 10.0; // wait 10 seconds
+
+  QMapIterator<QString, cmbAC*> itAC(_ACs);
+  while (itAC.hasNext()) {
+    itAC.next();
+    cmbAC* AC = itAC.value();
+
+
+    QMutableListIterator<cmbEpoch*> itEpo(AC->epochs);
+    while (itEpo.hasNext()) {
+      cmbEpoch* epoch = itEpo.next();
+      double dt = time - epoch->time;
+
+      if      (dt == waitTime) {
+        QMapIterator<QString, t_corr*> itCorr(epoch->corr);
+        while (itCorr.hasNext()) {
+          itCorr.next();
+          t_corr* corr = itCorr.value();
+          cout << AC->name.toAscii().data() << " " 
+               << AC->mountPoint.toAscii().data() << " "
+               << corr->prn.toAscii().data() << " "
+               << corr->tt.datestr() << " " << corr->tt.timestr() << " "
+               << corr->iod << " " << corr->dClk << endl;
+        }
+      }
+
+      if (dt >= waitTime) {
+        delete epoch;
+        itEpo.remove();
+      }
+    }
+  }
+}
Index: /trunk/BNC/combination/bnccomb.h
===================================================================
--- /trunk/BNC/combination/bnccomb.h	(revision 2917)
+++ /trunk/BNC/combination/bnccomb.h	(revision 2918)
@@ -12,5 +12,5 @@
   ~bncComb();
   void processCorrLine(const QString& staID, const QString& line);
-  int  nStreams() const {return _nStreams;}
+  int  nStreams() const {return _ACs.size();}
 
  signals:
@@ -18,5 +18,37 @@
 
  private:
-  int _nStreams;
+
+  class cmbEpoch {
+   public:
+    cmbEpoch() {}
+    ~cmbEpoch() {
+      QMapIterator<QString, t_corr*> it(corr);
+      while (it.hasNext()) {
+        it.next();
+        delete it.value();
+      }
+    }
+    bncTime                time;
+    QMap<QString, t_corr*> corr; // Corrections (key is PRN)
+  };
+
+  class cmbAC {
+   public:
+    cmbAC() {}
+    ~cmbAC() {
+      QListIterator<cmbEpoch*> it(epochs);
+      while (it.hasNext()) {
+        delete it.next();
+      }
+    }
+    QString           mountPoint;
+    QString           name;
+    double            weight;
+    QQueue<cmbEpoch*> epochs;  // List of Epochs with Corrections
+  };
+
+  void processEpochsBefore(const bncTime& time);
+
+  QMap<QString, cmbAC*> _ACs;   // Analytical Centers (key is mountpoint)
 };
 
