Index: /trunk/BNC/combination/bnccomb.cpp
===================================================================
--- /trunk/BNC/combination/bnccomb.cpp	(revision 2926)
+++ /trunk/BNC/combination/bnccomb.cpp	(revision 2927)
@@ -19,4 +19,5 @@
 #include "bnccomb.h"
 #include "bncapp.h"
+#include "cmbcaster.h"
 #include "bncsettings.h"
 
@@ -43,4 +44,6 @@
     }
   }
+
+  _caster = new cmbCaster();
 }
 
@@ -53,4 +56,5 @@
     delete it.value();
   }
+  delete _caster;
 }
 
@@ -86,5 +90,25 @@
   const double waitTime = 5.0; // wait 5 sec
   _processedBeforeTime = newCorr->tt - waitTime;
-  processEpochs();
+
+  QList<cmbEpoch*> epochsToProcess;
+
+  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();
+      if (epoch->time < _processedBeforeTime) {
+        epochsToProcess.append(epoch);
+        itEpo.remove();
+      }
+    }
+  }
+
+  if (epochsToProcess.size()) {
+    processEpochs(epochsToProcess);
+  }
 
   // Check Modulo Time
@@ -108,5 +132,5 @@
   }
   if (newEpoch == 0) {
-    newEpoch = new cmbEpoch();
+    newEpoch = new cmbEpoch(AC->name);
     newEpoch->time = newCorr->tt;
     AC->epochs.append(newEpoch);
@@ -125,41 +149,25 @@
 // 
 ////////////////////////////////////////////////////////////////////////////
-void bncComb::processEpochs() {
-
-  bool corrProcessed = false;
-
-  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();
-      if (epoch->time < _processedBeforeTime) {
-        QMapIterator<QString, t_corr*> itCorr(epoch->corr);
-        while (itCorr.hasNext()) {
-          itCorr.next();
-          t_corr* corr = itCorr.value();
-          processSingleCorr(AC, corr);
-          corrProcessed = true;
-        }
-        delete epoch;
-        itEpo.remove();
-      }
-    }
-  }
-
-  if (corrProcessed) {
-    printResults();
-  }
-}
-
-// 
-////////////////////////////////////////////////////////////////////////////
-void bncComb::processSingleCorr(const cmbAC* AC, const t_corr* corr) {
+void bncComb::processEpochs(const QList<cmbEpoch*>& epochs) {
+
+  QListIterator<cmbEpoch*> itEpo(epochs);
+  while (itEpo.hasNext()) {
+    cmbEpoch* epo = itEpo.next();
+    QMapIterator<QString, t_corr*> itCorr(epo->corr);
+    while (itCorr.hasNext()) {
+      itCorr.next();
+      t_corr* corr = itCorr.value();
+      printSingleCorr(epo->acName, corr);
+    }
+  }
+
+  cout << "Corrections processed" << endl << endl;
+}
+
+// 
+////////////////////////////////////////////////////////////////////////////
+void bncComb::printSingleCorr(const QString& acName, const t_corr* corr) {
   cout.setf(ios::fixed);
-  cout << AC->name.toAscii().data()                           << " " 
-       << AC->mountPoint.toAscii().data()                     << " "
+  cout << acName.toAscii().data()                             << " " 
        << corr->prn.toAscii().data()                          << " "
        << corr->tt.timestr()                                  << " "
@@ -171,9 +179,61 @@
 }
 
-// 
-////////////////////////////////////////////////////////////////////////////
-void bncComb::printResults() const {
-
-  cout << "Corrections processed" << endl << endl;
-
-}
+// // 
+// ////////////////////////////////////////////////////////////////////////////
+// void bncComb::printResults() const {
+// 
+// //  _caster->open();      
+// //
+// //  //// beg test
+// //  cmbEpoch* resEpoch = 0;
+// //  if (_ACs->find("CLK10") != _ACs->end()) {
+// //    cmbAC* AC = _ACs["CLK10"];
+// //    QMutableListIterator<cmbEpoch*> itEpo(AC->epochs);
+// //    while (itEpo.hasNext()) {
+// //      
+// //
+// //  }
+// //  //// end test
+// 
+// struct ClockOrbit co;
+// 
+// //  memset(&co, 0, sizeof(co));
+// //  co.GPSEpochTime      = (int)_GPSweeks;
+// //  co.GLONASSEpochTime  = (int)fmod(_GPSweeks, 86400.0) 
+// //                       + 3 * 3600 - gnumleap(_year, _month, _day);
+// //  co.ClockDataSupplied = 1;
+// //  co.OrbitDataSupplied = 1;
+// //  co.SatRefDatum       = DATUM_ITRF;
+// //
+// //  // struct ClockOrbit::SatData* sd = 0;
+//   // if      (prn[0] == 'G') {
+//   //   sd = co.Sat + co.NumberOfGPSSat;
+//   //   ++co.NumberOfGPSSat;
+//   // }
+//   // else if (prn[0] == 'R') {
+//   //   sd = co.Sat + CLOCKORBIT_NUMGPS + co.NumberOfGLONASSSat;
+//   //   ++co.NumberOfGLONASSSat;
+//   // }
+// 
+//   // sd->ID                    = prn.mid(1).toInt();
+//   // sd->IOD                   = ep->IOD();
+//   // sd->Clock.DeltaA0         = dClk;
+//   // sd->Orbit.DeltaRadial     = rsw(1);
+//   // sd->Orbit.DeltaAlongTrack = rsw(2);
+//   // sd->Orbit.DeltaCrossTrack = rsw(3);
+//   // sd->Orbit.DotDeltaRadial     = (rsw2(1) - rsw(1)) / xx(11);
+//   // sd->Orbit.DotDeltaAlongTrack = (rsw2(2) - rsw(2)) / xx(11);
+//   // sd->Orbit.DotDeltaCrossTrack = (rsw2(3) - rsw(3)) / xx(11);
+// 
+//   if ( _caster->usedSocket() && 
+//        (co.NumberOfGPSSat > 0 || co.NumberOfGLONASSSat > 0) ) {
+//     char obuffer[CLOCKORBIT_BUFFERSIZE];
+//     int len = MakeClockOrbit(&co, COTYPE_AUTO, 0, obuffer, sizeof(obuffer));
+//     if (len > 0) {
+//       _caster->write(obuffer, len);
+//     }
+//   }
+// 
+//   cout << "Corrections processed" << endl << endl;
+// 
+// }
Index: /trunk/BNC/combination/bnccomb.h
===================================================================
--- /trunk/BNC/combination/bnccomb.h	(revision 2926)
+++ /trunk/BNC/combination/bnccomb.h	(revision 2927)
@@ -4,4 +4,6 @@
 
 #include "bncephuser.h"
+
+class cmbCaster;
 
 class bncComb : public bncEphUser  {
@@ -21,5 +23,5 @@
   class cmbEpoch {
    public:
-    cmbEpoch() {}
+    cmbEpoch(const QString& name) {acName = name;}
     ~cmbEpoch() {
       QMapIterator<QString, t_corr*> it(corr);
@@ -29,4 +31,5 @@
       }
     }
+    QString                acName;
     bncTime                time;
     QMap<QString, t_corr*> corr; // Corrections (key is PRN)
@@ -48,10 +51,10 @@
   };
 
-  void processEpochs();
-  void processSingleCorr(const cmbAC* AC, const t_corr* corr);
-  void printResults() const;
+  void processEpochs(const QList<cmbEpoch*>& epochs);
+  void printSingleCorr(const QString& acName, const t_corr* corr);
 
   QMap<QString, cmbAC*> _ACs;   // Analytical Centers (key is mountpoint)
   bncTime               _processedBeforeTime;
+  cmbCaster*            _caster;
 };
 
