Index: /trunk/BNC/src/RTCM/GPSDecoder.cpp
===================================================================
--- /trunk/BNC/src/RTCM/GPSDecoder.cpp	(revision 4388)
+++ /trunk/BNC/src/RTCM/GPSDecoder.cpp	(revision 4389)
@@ -89,2 +89,162 @@
   }
 }
+
+// 
+//////////////////////////////////////////////////////////////////////////////
+double t_obs::c1() const {
+  if (_measdata[GNSSENTRY_C1DATA]  != 0.0) return _measdata[GNSSENTRY_C1DATA];
+  if (_measdata[GNSSENTRY_C1NDATA] != 0.0) return _measdata[GNSSENTRY_C1NDATA];
+  return 0.0;
+}
+
+double t_obs::c2() const {
+  if (_measdata[GNSSENTRY_C2DATA] != 0.0) return _measdata[GNSSENTRY_C2DATA];
+  return 0.0;
+}
+
+double t_obs::c5() const {
+  if (_measdata[GNSSENTRY_C5DATA]   != 0.0) return _measdata[GNSSENTRY_C5DATA];
+  if (_measdata[GNSSENTRY_C5BDATA]  != 0.0) return _measdata[GNSSENTRY_C5BDATA];
+  if (_measdata[GNSSENTRY_C5ABDATA] != 0.0) return _measdata[GNSSENTRY_C5ABDATA];
+  return 0.0;
+}
+
+double t_obs::p1() const {
+  if (_measdata[GNSSENTRY_P1DATA] != 0.0) return _measdata[GNSSENTRY_P1DATA];
+  return 0.0;
+}
+
+double t_obs::p2() const {
+  if (_measdata[GNSSENTRY_P2DATA] != 0.0) return _measdata[GNSSENTRY_P2DATA];
+  return 0.0;
+}
+
+double t_obs::l1() const {
+  if (_measdata[GNSSENTRY_L1CDATA] != 0.0) return _measdata[GNSSENTRY_L1CDATA];
+  if (_measdata[GNSSENTRY_L1PDATA] != 0.0) return _measdata[GNSSENTRY_L1PDATA];
+  if (_measdata[GNSSENTRY_L1NDATA] != 0.0) return _measdata[GNSSENTRY_L1NDATA];
+  return 0.0;
+}
+
+double t_obs::l2() const {
+  if (_measdata[GNSSENTRY_L2CDATA] != 0.0) return _measdata[GNSSENTRY_L2CDATA];
+  if (_measdata[GNSSENTRY_L2PDATA] != 0.0) return _measdata[GNSSENTRY_L2PDATA];
+  return 0.0;
+}
+
+double t_obs::l5() const {
+  if (_measdata[GNSSENTRY_L5DATA]   != 0.0) return _measdata[GNSSENTRY_L5DATA];
+  if (_measdata[GNSSENTRY_L5BDATA]  != 0.0) return _measdata[GNSSENTRY_L5BDATA];
+  if (_measdata[GNSSENTRY_L5ABDATA] != 0.0) return _measdata[GNSSENTRY_L5ABDATA];
+  return 0.0;
+}
+
+double t_obs::s1() const {
+  if (_measdata[GNSSENTRY_S1CDATA] != 0.0) return _measdata[GNSSENTRY_S1CDATA];
+  if (_measdata[GNSSENTRY_S1PDATA] != 0.0) return _measdata[GNSSENTRY_S1PDATA];
+  if (_measdata[GNSSENTRY_S1NDATA] != 0.0) return _measdata[GNSSENTRY_S1NDATA];
+  return 0.0;
+}
+
+double t_obs::s2() const {
+  if (_measdata[GNSSENTRY_S2CDATA] != 0.0) return _measdata[GNSSENTRY_S2CDATA];
+  if (_measdata[GNSSENTRY_S2PDATA] != 0.0) return _measdata[GNSSENTRY_S2PDATA];
+  return 0.0;
+}
+
+// 
+//////////////////////////////////////////////////////////////////////////////
+std::string t_obs::entry2str(int iEntry) const {
+  if (iEntry == GNSSENTRY_C1DATA   ) return "C1";
+  if (iEntry == GNSSENTRY_L1CDATA  ) return "L1C";
+  if (iEntry == GNSSENTRY_D1CDATA  ) return "D1C";
+  if (iEntry == GNSSENTRY_S1CDATA  ) return "S1C";
+  if (iEntry == GNSSENTRY_C2DATA   ) return "C2";
+  if (iEntry == GNSSENTRY_L2CDATA  ) return "L2C";
+  if (iEntry == GNSSENTRY_D2CDATA  ) return "D2C";
+  if (iEntry == GNSSENTRY_S2CDATA  ) return "S2C";
+  if (iEntry == GNSSENTRY_P1DATA   ) return "P1";
+  if (iEntry == GNSSENTRY_L1PDATA  ) return "L1P";
+  if (iEntry == GNSSENTRY_D1PDATA  ) return "D1P";
+  if (iEntry == GNSSENTRY_S1PDATA  ) return "S1P";
+  if (iEntry == GNSSENTRY_P2DATA   ) return "P2";
+  if (iEntry == GNSSENTRY_L2PDATA  ) return "L2P";
+  if (iEntry == GNSSENTRY_D2PDATA  ) return "D2P";
+  if (iEntry == GNSSENTRY_S2PDATA  ) return "S2P";
+  if (iEntry == GNSSENTRY_C5DATA   ) return "C5";
+  if (iEntry == GNSSENTRY_L5DATA   ) return "L5";
+  if (iEntry == GNSSENTRY_D5DATA   ) return "D5";
+  if (iEntry == GNSSENTRY_S5DATA   ) return "S5";
+  if (iEntry == GNSSENTRY_C6DATA   ) return "C6";
+  if (iEntry == GNSSENTRY_L6DATA   ) return "L6";
+  if (iEntry == GNSSENTRY_D6DATA   ) return "D6";
+  if (iEntry == GNSSENTRY_S6DATA   ) return "S6";
+  if (iEntry == GNSSENTRY_C5BDATA  ) return "C5B";
+  if (iEntry == GNSSENTRY_L5BDATA  ) return "L5B";
+  if (iEntry == GNSSENTRY_D5BDATA  ) return "D5B";
+  if (iEntry == GNSSENTRY_S5BDATA  ) return "S5B";
+  if (iEntry == GNSSENTRY_C5ABDATA ) return "C5AB";
+  if (iEntry == GNSSENTRY_L5ABDATA ) return "L5AB";
+  if (iEntry == GNSSENTRY_D5ABDATA ) return "D5AB";
+  if (iEntry == GNSSENTRY_S5ABDATA ) return "S5AB";
+  if (iEntry == GNSSENTRY_CSAIFDATA) return "CSAIF";
+  if (iEntry == GNSSENTRY_LSAIFDATA) return "LSAIF";
+  if (iEntry == GNSSENTRY_DSAIFDATA) return "DSAIF";
+  if (iEntry == GNSSENTRY_SSAIFDATA) return "SSAIF";
+  if (iEntry == GNSSENTRY_C1NDATA  ) return "C1N";
+  if (iEntry == GNSSENTRY_L1NDATA  ) return "L1N";
+  if (iEntry == GNSSENTRY_D1NDATA  ) return "D1N";
+  if (iEntry == GNSSENTRY_S1NDATA  ) return "S1N";
+
+  throw "Error in t_obs::entry2str";
+}
+
+// 
+//////////////////////////////////////////////////////////////////////////////
+int t_obs::str2entry(const char* strIn) const {
+
+  string str(strIn);
+
+  if (str == "C1"   ) return GNSSENTRY_C1DATA;
+  if (str == "L1C"  ) return GNSSENTRY_L1CDATA;
+  if (str == "D1C"  ) return GNSSENTRY_D1CDATA;
+  if (str == "S1C"  ) return GNSSENTRY_S1CDATA;
+  if (str == "C2"   ) return GNSSENTRY_C2DATA;
+  if (str == "L2C"  ) return GNSSENTRY_L2CDATA;
+  if (str == "D2C"  ) return GNSSENTRY_D2CDATA;
+  if (str == "S2C"  ) return GNSSENTRY_S2CDATA;
+  if (str == "P1"   ) return GNSSENTRY_P1DATA;
+  if (str == "L1P"  ) return GNSSENTRY_L1PDATA;
+  if (str == "D1P"  ) return GNSSENTRY_D1PDATA;
+  if (str == "S1P"  ) return GNSSENTRY_S1PDATA;
+  if (str == "P2"   ) return GNSSENTRY_P2DATA;
+  if (str == "L2P"  ) return GNSSENTRY_L2PDATA;
+  if (str == "D2P"  ) return GNSSENTRY_D2PDATA;
+  if (str == "S2P"  ) return GNSSENTRY_S2PDATA;
+  if (str == "C5"   ) return GNSSENTRY_C5DATA;
+  if (str == "L5"   ) return GNSSENTRY_L5DATA;
+  if (str == "D5"   ) return GNSSENTRY_D5DATA;
+  if (str == "S5"   ) return GNSSENTRY_S5DATA;
+  if (str == "C6"   ) return GNSSENTRY_C6DATA;
+  if (str == "L6"   ) return GNSSENTRY_L6DATA;
+  if (str == "D6"   ) return GNSSENTRY_D6DATA;
+  if (str == "S6"   ) return GNSSENTRY_S6DATA;
+  if (str == "C5B"  ) return GNSSENTRY_C5BDATA;
+  if (str == "L5B"  ) return GNSSENTRY_L5BDATA;
+  if (str == "D5B"  ) return GNSSENTRY_D5BDATA;
+  if (str == "S5B"  ) return GNSSENTRY_S5BDATA;
+  if (str == "C5AB" ) return GNSSENTRY_C5ABDATA;
+  if (str == "L5AB" ) return GNSSENTRY_L5ABDATA;
+  if (str == "D5AB" ) return GNSSENTRY_D5ABDATA;
+  if (str == "S5AB" ) return GNSSENTRY_S5ABDATA;
+  if (str == "CSAIF") return GNSSENTRY_CSAIFDATA;
+  if (str == "LSAIF") return GNSSENTRY_LSAIFDATA;
+  if (str == "DSAIF") return GNSSENTRY_DSAIFDATA;
+  if (str == "SSAIF") return GNSSENTRY_SSAIFDATA;
+  if (str == "C1N"  ) return GNSSENTRY_C1NDATA;
+  if (str == "L1N"  ) return GNSSENTRY_L1NDATA;
+  if (str == "D1N"  ) return GNSSENTRY_D1NDATA;
+  if (str == "S1N"  ) return GNSSENTRY_S1NDATA;
+
+  throw "Error in t_obs::str2entry";
+}
Index: /trunk/BNC/src/RTCM/GPSDecoder.h
===================================================================
--- /trunk/BNC/src/RTCM/GPSDecoder.h	(revision 4388)
+++ /trunk/BNC/src/RTCM/GPSDecoder.h	(revision 4389)
@@ -35,4 +35,8 @@
 #include "bncrinex.h"
 
+extern "C" {
+#include "rtcm3torinex.h"
+}
+
 class t_obs {
  public:
@@ -44,24 +48,10 @@
     GPSWeek     = 0;
     GPSWeeks    = 0.0;
-    C1          = 0.0;
-    P1          = 0.0;
-    L1C         = 0.0;
-    D1C         = 0.0;
-    S1C         = 0.0;
-    L1P         = 0.0;
-    D1P         = 0.0;
-    S1P         = 0.0;
-    C2          = 0.0;
-    P2          = 0.0;
-    L2C         = 0.0;
-    D2C         = 0.0;
-    S2C         = 0.0;
-    L2P         = 0.0;
-    D2P         = 0.0;
-    S2P         = 0.0;
-    C5          = 0.0;
-    L5          = 0.0;
-    D5          = 0.0;
-    S5          = 0.0;
+    _dataflags  = 0;
+    _dataflags2 = 0;
+    for (int iEntry = 0; iEntry < GNSSENTRY_NUMBER; iEntry++) {
+      _measdata[iEntry] = 0.0;
+      _codetype[iEntry] = 0;
+    }
     slip_cnt_L1 = -1;
     slip_cnt_L2 = -1;
@@ -71,10 +61,16 @@
   ~t_obs() {}
 
-  double p1() const {return (P1  != 0.0 ? P1  : C1);}
-  double p2() const {return (P2  != 0.0 ? P2  : C2);}
-  double l1() const {return (L1P != 0.0 ? L1P : L1C);}
-  double l2() const {return (L2P != 0.0 ? L2P : L2C);}
-  double s1() const {return (L1P != 0.0 ? S1P : S1C);}
-  double s2() const {return (L2P != 0.0 ? S2P : S2C);}
+  double c1() const;
+  double c2() const;
+  double c5() const;
+  double p1() const;
+  double p2() const;
+  double l1() const;
+  double l2() const;
+  double l5() const;
+  double s1() const;
+  double s2() const;
+  std::string entry2str(int iEntry) const;
+  int str2entry(const char* str) const;
 
   char   StatID[20+1]; // Station ID
@@ -85,37 +81,12 @@
   double GPSWeeks;     // Second of Week (GPS-Time)
 
-  double C1;           // CA-code pseudorange (meters)
-  double L1C;          // L1 carrier phase (cycles)
-  double D1C;          // Doppler L1
-  double S1C;          // raw L1 signal strength
-  bool has1C() const {return C1 != 0.0 || L1C != 0.0 || D1C != 0.0 || S1C != 0.0;}
-
-  double P1;           // P1-code pseudorange (meters)
-  double L1P;          // L1 carrier phase (cycles)
-  double D1P;          // Doppler L1
-  double S1P;          // raw L1 signal strength
-  bool has1P() const {return P1 != 0.0 || L1P != 0.0 || D1P != 0.0 || S1P != 0.0;}
-
-  double C2;           // CA-code pseudorange (meters)
-  double L2C;          // L2 carrier phase (cycles)
-  double D2C;          // Doppler L2
-  double S2C;          // raw L2 signal strength
-  bool has2C() const {return C2 != 0.0 || L2C != 0.0 || D2C != 0.0 || S2C != 0.0;}
-
-  double P2;           // P2-code pseudorange (meters)
-  double L2P;          // L2 carrier phase (cycles)
-  double D2P;          // Doppler L2
-  double S2P;          // raw L2 signal strength
-  bool has2P() const {return P2 != 0.0 || L2P != 0.0 || D2P != 0.0 || S2P != 0.0;}
-
-  double C5;           // Pseudorange (meters)
-  double L5;           // L5 carrier phase (cycles)
-  double D5;           // Doppler L5
-  double S5;           // raw L5 signal strength
-  bool has5C() const {return C5 != 0.0 || L5 != 0.0 || D5 != 0.0 || S5 != 0.0;}
-
   int    slip_cnt_L1;  // L1 cumulative loss of continuity indicator (negative value = undefined)
   int    slip_cnt_L2;  // L2 cumulative loss of continuity indicator (negative value = undefined)
   int    slip_cnt_L5;  // L5 cumulative loss of continuity indicator (negative value = undefined)
+  
+  double             _measdata[GNSSENTRY_NUMBER];  // data fields */ 
+  unsigned long long _dataflags;                   // GNSSDF_xxx */
+  unsigned int       _dataflags2;                  // GNSSDF2_xxx */
+  const char*        _codetype[GNSSENTRY_NUMBER];
 };
 
Index: /trunk/BNC/src/RTCM/RTCM2Decoder.cpp
===================================================================
--- /trunk/BNC/src/RTCM/RTCM2Decoder.cpp	(revision 4388)
+++ /trunk/BNC/src/RTCM/RTCM2Decoder.cpp	(revision 4389)
@@ -148,9 +148,9 @@
           obs.GPSWeek       = epochWeek;
           obs.GPSWeeks      = epochSecs;
-          obs.C1            = _ObsBlock.rng_C1[iSat];
-          obs.P1            = _ObsBlock.rng_P1[iSat];
-          obs.P2            = _ObsBlock.rng_P2[iSat];
-          obs.L1P           = _ObsBlock.resolvedPhase_L1(iSat);
-          obs.L2P           = _ObsBlock.resolvedPhase_L2(iSat);
+          obs._measdata[obs.str2entry("C1")] = _ObsBlock.rng_C1[iSat];
+          obs._measdata[obs.str2entry("P1")] = _ObsBlock.rng_P1[iSat];
+          obs._measdata[obs.str2entry("P2")] = _ObsBlock.rng_P2[iSat];
+          obs._measdata[obs.str2entry("L1")] = _ObsBlock.resolvedPhase_L1(iSat);
+          obs._measdata[obs.str2entry("L2")] = _ObsBlock.resolvedPhase_L2(iSat);
 	  obs.slip_cnt_L1   = _ObsBlock.slip_L1[iSat];
 	  obs.slip_cnt_L2   = _ObsBlock.slip_L2[iSat];
@@ -368,22 +368,22 @@
 	switch (ii) {
 	case 0: // --- L1 ---
-	  new_obs->L1P = *obsVal / LAMBDA_1;
+          new_obs->_measdata[new_obs->str2entry("L1")] = *obsVal / LAMBDA_1;
 	  new_obs->slip_cnt_L1   = corr->lock1;
 	  break;
 	case 1: // --- L2 ---
-	  new_obs->L2P = *obsVal / LAMBDA_2;
+          new_obs->_measdata[new_obs->str2entry("L2")] = *obsVal / LAMBDA_2;
 	  new_obs->slip_cnt_L2   = corr->lock2;
 	  break;
 	case 2: // --- C1 / P1 ---
 	  if ( corr->Pind1 )
-	    new_obs->P1 = *obsVal;
+            new_obs->_measdata[new_obs->str2entry("P1")] = *obsVal;
 	  else
-	    new_obs->C1 = *obsVal;
+            new_obs->_measdata[new_obs->str2entry("C1")] = *obsVal;
 	  break;
 	case 3: // --- C2 / P2 ---
 	  if ( corr->Pind2 )
-	    new_obs->P2 = *obsVal;
+            new_obs->_measdata[new_obs->str2entry("P2")] = *obsVal;
 	  else
-	    new_obs->C2 = *obsVal;
+            new_obs->_measdata[new_obs->str2entry("C2")] = *obsVal;
 	  break;
 	default:
Index: /trunk/BNC/src/RTCM3/RTCM3Decoder.cpp
===================================================================
--- /trunk/BNC/src/RTCM3/RTCM3Decoder.cpp	(revision 4388)
+++ /trunk/BNC/src/RTCM3/RTCM3Decoder.cpp	(revision 4389)
@@ -336,79 +336,12 @@
               }
 
+              obs._dataflags  = gnssData.dataflags[iSat];
+              obs._dataflags2 = gnssData.dataflags2[iSat];
+
               // Loop over all data types
               // ------------------------
               for (int iEntry = 0; iEntry < GNSSENTRY_NUMBER; ++iEntry) {
- 
-                unsigned df = (1 << iEntry);
-
-                if (df & gnssData.dataflags[iSat]) {
-
-                  // TODO: codetype[1] is e.g. 'W' or 'C' or 'P'
-                  const char* codetype = gnssData.codetype[iSat][iEntry];
-                  if (codetype) {
-                    // cout << prn.toAscii().data() << " " << codetype << endl;
-                  }
-
-                  if      (iEntry == GNSSENTRY_C1DATA) {
-                    obs.C1  = gnssData.measdata[iSat][iEntry];
-                  }
-                  else if (iEntry == GNSSENTRY_C2DATA) {
-                    obs.C2  = gnssData.measdata[iSat][iEntry];
-                  }
-                  else if (iEntry == GNSSENTRY_P1DATA) {
-                    obs.P1  = gnssData.measdata[iSat][iEntry];
-                  }
-                  else if (iEntry == GNSSENTRY_P2DATA) {
-                    obs.P2  = gnssData.measdata[iSat][iEntry];
-                  }
-                  else if (iEntry == GNSSENTRY_L1CDATA) {
-                    obs.L1C = gnssData.measdata[iSat][iEntry];
-                  }
-                  else if (iEntry == GNSSENTRY_L1PDATA) {
-                    obs.L1P = gnssData.measdata[iSat][iEntry];
-                  }
-                  else if (iEntry == GNSSENTRY_L2CDATA) {
-                    obs.L2C = gnssData.measdata[iSat][iEntry];
-                  }
-                  else if (iEntry == GNSSENTRY_L2PDATA) {
-                    obs.L2P = gnssData.measdata[iSat][iEntry];
-                  }
-                  else if (iEntry == GNSSENTRY_D1CDATA) {
-                    obs.D1C = gnssData.measdata[iSat][iEntry];
-                  }
-                  else if (iEntry == GNSSENTRY_D1PDATA) {
-                    obs.D1P = gnssData.measdata[iSat][iEntry];
-                  }
-                  else if (iEntry == GNSSENTRY_S1CDATA) {
-                    obs.S1C = gnssData.measdata[iSat][iEntry];
-                  }
-                  else if (iEntry == GNSSENTRY_S1PDATA) {
-                    obs.S1P = gnssData.measdata[iSat][iEntry];
-                  }
-                  else if (iEntry == GNSSENTRY_D2CDATA) {
-                    obs.D2C = gnssData.measdata[iSat][iEntry];
-                  }
-                  else if (iEntry == GNSSENTRY_D2PDATA) {
-                    obs.D2P = gnssData.measdata[iSat][iEntry];
-                  }
-                  else if (iEntry == GNSSENTRY_S2CDATA) {
-                    obs.S2C = gnssData.measdata[iSat][iEntry];
-                  }
-                  else if (iEntry == GNSSENTRY_S2PDATA) {
-                    obs.S2P = gnssData.measdata[iSat][iEntry];
-                  }
-                  else if (iEntry == GNSSENTRY_C5DATA) {
-                    obs.C5  = gnssData.measdata[iSat][iEntry];
-                  }
-                  else if (iEntry == GNSSENTRY_L5DATA) {
-                    obs.L5  = gnssData.measdata[iSat][iEntry];
-                  }
-                  else if (iEntry == GNSSENTRY_D5DATA) {
-                    obs.D5  = gnssData.measdata[iSat][iEntry];
-                  }
-                  else if (iEntry == GNSSENTRY_S5DATA) {
-                    obs.S5  = gnssData.measdata[iSat][iEntry];
-                  }
-                }
+                obs._measdata[iEntry] = gnssData.measdata[iSat][iEntry];
+                obs._codetype[iEntry] = gnssData.codetype[iSat][iEntry];
               }
               _obsList.push_back(obs);
Index: /trunk/BNC/src/bncpppclient.cpp
===================================================================
--- /trunk/BNC/src/bncpppclient.cpp	(revision 4388)
+++ /trunk/BNC/src/bncpppclient.cpp	(revision 4389)
@@ -160,20 +160,20 @@
   // --------------------
   if      (obs.satSys == 'G') {
-    if ( (obs.P1 || obs.C1) && (obs.P2 || obs.C2) && obs.l1() && obs.l2() ) {
+    if ( (obs.p1() || obs.c1()) && (obs.p2() || obs.c2()) && obs.l1() && obs.l2() ) {
       double f1 = t_CST::freq1;
       double f2 = t_CST::freq2;
       double c1 =   f1 * f1 / (f1 * f1 - f2 * f2);
       double c2 = - f2 * f2 / (f1 * f1 - f2 * f2);
-      if (obs.P1) {
-        satData->P1 = obs.P1 + (bb ? bb->p1 : 0.0);
+      if (obs.p1()) {
+        satData->P1 = obs.p1() + (bb ? bb->p1 : 0.0);
       }
       else {
-        satData->P1 = obs.C1 + (bb ? bb->c1 : 0.0);
-      }
-      if (obs.P2) {
-        satData->P2 = obs.P2 + (bb ? bb->p2 : 0.0);
+        satData->P1 = obs.c1() + (bb ? bb->c1 : 0.0);
+      }
+      if (obs.p2()) {
+        satData->P2 = obs.p2() + (bb ? bb->p2 : 0.0);
       }
       else {
-        satData->P2 = obs.C2;
+        satData->P2 = obs.c2();
       }
       satData->L1      = obs.l1() * t_CST::c / f1;
@@ -193,20 +193,20 @@
   // ------------------------
   else if (obs.satSys == 'R') {
-    if ( (obs.P1 || obs.C1) && (obs.P2 || obs.C2) && obs.l1() && obs.l2() ) {
+    if ( (obs.p1() || obs.c1()) && (obs.p2() || obs.c2()) && obs.l1() && obs.l2() ) {
       double f1 = t_CST::f1(obs.satSys, obs.slotNum); 
       double f2 = t_CST::f2(obs.satSys, obs.slotNum); 
       double c1 =   f1 * f1 / (f1 * f1 - f2 * f2);
       double c2 = - f2 * f2 / (f1 * f1 - f2 * f2);
-      if (obs.P1) {
-        satData->P1 = obs.P1 + (bb ? bb->p1 : 0.0);
+      if (obs.p1()) {
+        satData->P1 = obs.p1() + (bb ? bb->p1 : 0.0);
       }
       else {
-        satData->P1 = obs.C1 + (bb ? bb->c1 : 0.0);
-      }
-      if (obs.P2) {
-        satData->P2 = obs.P2 + (bb ? bb->p2 : 0.0);
+        satData->P1 = obs.c1() + (bb ? bb->c1 : 0.0);
+      }
+      if (obs.p2()) {
+        satData->P2 = obs.p2() + (bb ? bb->p2 : 0.0);
       }
       else {
-        satData->P2 = obs.C2;
+        satData->P2 = obs.c2();
       }
       satData->L1      = obs.l1() * t_CST::c / f1;
@@ -226,5 +226,5 @@
   // ------------------------
   else if (obs.satSys == 'E') {
-    if ( obs.C1 && obs.C5 && obs.l1() && obs.L5) {
+    if ( obs.c1() && obs.c5() && obs.l1() && obs.l5()) {
       double f1 = t_CST::freq1;
       double f5 = t_CST::freq5;
@@ -232,8 +232,8 @@
       double c5 = - f5 * f5 / (f1 * f1 - f5 * f5);
 
-      satData->P1      = obs.C1;
-      satData->P5      = obs.C5;
+      satData->P1      = obs.c1();
+      satData->P5      = obs.c5();
       satData->L1      = obs.l1() * t_CST::c / f1;
-      satData->L5      = obs.L5 * t_CST::c / f5;
+      satData->L5      = obs.l5() * t_CST::c / f5;
       satData->P3      = c1 * satData->P1 + c5 * satData->P5;
       satData->L3      = c1 * satData->L1 + c5 * satData->L5;
Index: /trunk/BNC/src/bncrinex.cpp
===================================================================
--- /trunk/BNC/src/bncrinex.cpp	(revision 4388)
+++ /trunk/BNC/src/bncrinex.cpp	(revision 4389)
@@ -659,10 +659,10 @@
     // ---------------
     else {
-      _out << setw(14) << setprecision(3) << obs.C1    << ' '  << ' '
-           << setw(14) << setprecision(3) << obs.P1    << ' '  << ' '
+      _out << setw(14) << setprecision(3) << obs.c1()  << ' '  << ' '
+           << setw(14) << setprecision(3) << obs.p1()  << ' '  << ' '
            << setw(14) << setprecision(3) << obs.l1()  << lli1 << ' '
            << setw(14) << setprecision(3) << obs.s1()  << ' '  << ' '
-           << setw(14) << setprecision(3) << obs.C2    << ' '  << ' ' << endl
-           << setw(14) << setprecision(3) << obs.P2    << ' '  << ' ' 
+           << setw(14) << setprecision(3) << obs.c2()  << ' '  << ' ' << endl
+           << setw(14) << setprecision(3) << obs.p2()  << ' '  << ' ' 
            << setw(14) << setprecision(3) << obs.l2()  << lli2 << ' '
            << setw(14) << setprecision(3) << obs.s2()  << endl;
@@ -702,88 +702,12 @@
       << setw(2) << setfill('0') << obs.satNum << setfill(' ');
 
-  if      (obs.satSys == 'G') { // GPS
-    str << setw(14) << setprecision(3) << obs.C1  << ' '  << ' '  // C1C
-        << setw(14) << setprecision(3) << obs.L1C << lli1 << ' '  // L1C
-        << setw(14) << setprecision(3) << obs.D1C << ' '  << ' '  // D1C
-        << setw(14) << setprecision(3) << obs.S1C << ' '  << ' '  // S1C
-        << setw(14) << setprecision(3) << obs.P1  << ' '  << ' '  // C1W
-        << setw(14) << setprecision(3) << obs.L1P << lli1 << ' '  // L1W
-        << setw(14) << setprecision(3) << obs.D1P << ' '  << ' '  // D1W
-        << setw(14) << setprecision(3) << obs.S1P << ' '  << ' '  // S1W
-        << setw(14) << setprecision(3) << obs.P2  << ' '  << ' '  // C2P
-        << setw(14) << setprecision(3) << obs.L2P << lli2 << ' '  // L2P
-        << setw(14) << setprecision(3) << obs.D2P << ' '  << ' '  // D2P
-        << setw(14) << setprecision(3) << obs.S2P << ' '  << ' '  // S2P
-        << setw(14) << setprecision(3) << obs.C2  << ' '  << ' '  // C2X
-        << setw(14) << setprecision(3) << obs.L2C << lli2 << ' '  // L2X
-        << setw(14) << setprecision(3) << obs.D2C << ' '  << ' '  // D2X
-        << setw(14) << setprecision(3) << obs.S2C << ' '  << ' '  // S2X
-        << setw(14) << setprecision(3) << obs.C5  << ' '  << ' '  // C5 
-        << setw(14) << setprecision(3) << obs.L5  << lli5 << ' '  // L5 
-        << setw(14) << setprecision(3) << obs.D5  << ' '  << ' '  // D5 
-        << setw(14) << setprecision(3) << obs.S5;                 // S5 
-  }
-  else if (obs.satSys == 'R') { // Glonass
-    str << setw(14) << setprecision(3) << obs.C1  << ' '  << ' '  // C1C
-        << setw(14) << setprecision(3) << obs.L1C << lli1 << ' '  // L1C
-        << setw(14) << setprecision(3) << obs.D1C << ' '  << ' '  // D1C
-        << setw(14) << setprecision(3) << obs.S1C << ' '  << ' '  // S1C
-        << setw(14) << setprecision(3) << obs.P1  << ' '  << ' '  // C1P
-        << setw(14) << setprecision(3) << obs.L1P << lli1 << ' '  // L1P
-        << setw(14) << setprecision(3) << obs.D1P << ' '  << ' '  // D1P
-        << setw(14) << setprecision(3) << obs.S1P << ' '  << ' '  // S1P
-        << setw(14) << setprecision(3) << obs.P2  << ' '  << ' '  // C2P
-        << setw(14) << setprecision(3) << obs.L2P << lli2 << ' '  // L2P
-        << setw(14) << setprecision(3) << obs.D2P << ' '  << ' '  // D2P
-        << setw(14) << setprecision(3) << obs.S2P << ' '  << ' '  // S2P
-        << setw(14) << setprecision(3) << obs.C2  << ' '  << ' '  // C2C
-        << setw(14) << setprecision(3) << obs.L2C << lli2 << ' '  // L2C
-        << setw(14) << setprecision(3) << obs.D2C << ' '  << ' '  // D2C
-        << setw(14) << setprecision(3) << obs.S2C;                // S2C
-  }
-  else if (obs.satSys == 'S') { // SBAS
-    str << setw(14) << setprecision(3) << obs.C1  << ' '  << ' '  // C1C
-        << setw(14) << setprecision(3) << obs.L1C << lli1 << ' '  // L1C
-        << setw(14) << setprecision(3) << obs.D1C << ' '  << ' '  // D1C
-        << setw(14) << setprecision(3) << obs.S1C << ' '  << ' '  // S1C
-        << setw(14) << setprecision(3) << obs.P1  << ' '  << ' '  // C1W
-        << setw(14) << setprecision(3) << obs.L1P << lli1 << ' '  // L1W
-        << setw(14) << setprecision(3) << obs.D1P << ' '  << ' '  // D1W
-        << setw(14) << setprecision(3) << obs.S1P;                // S1W
-  }
-  else if (obs.satSys == 'E') { // Galileo
-    str << setw(14) << setprecision(3) << obs.C1  << ' '  << ' '  // C1
-        << setw(14) << setprecision(3) << obs.L1C << lli1 << ' '  // L1
-        << setw(14) << setprecision(3) << obs.D1C << ' '  << ' '  // D1
-        << setw(14) << setprecision(3) << obs.S1C << ' '  << ' '  // S1
-        << setw(14) << setprecision(3) << obs.C5  << ' '  << ' '  // C5
-        << setw(14) << setprecision(3) << obs.L5  << lli5 << ' '  // L5
-        << setw(14) << setprecision(3) << obs.D5  << ' '  << ' '  // D5
-        << setw(14) << setprecision(3) << obs.S5;                 // S5
-  }
-  else if (obs.satSys == 'J') { // QZSS
-    str << setw(14) << setprecision(3) << obs.C1  << ' '  << ' '  // C1C
-        << setw(14) << setprecision(3) << obs.L1C << lli1 << ' '  // L1C
-        << setw(14) << setprecision(3) << obs.D1C << ' '  << ' '  // D1C
-        << setw(14) << setprecision(3) << obs.S1C << ' '  << ' '  // S1C
-        << setw(14) << setprecision(3) << obs.P1  << ' '  << ' '  // C1X
-        << setw(14) << setprecision(3) << obs.L1P << lli1 << ' '  // L1X
-        << setw(14) << setprecision(3) << obs.D1P << ' '  << ' '  // D1X
-        << setw(14) << setprecision(3) << obs.S1P << ' '  << ' '  // S1X
-        << setw(14) << setprecision(3) << obs.C2  << ' '  << ' '  // C2X
-        << setw(14) << setprecision(3) << obs.L2C << lli2 << ' '  // L2X
-        << setw(14) << setprecision(3) << obs.D2C << ' '  << ' '  // D2X
-        << setw(14) << setprecision(3) << obs.S2C << ' '  << ' '  // S2X
-        << setw(14) << setprecision(3) << obs.C5  << ' '  << ' '  // C5 
-        << setw(14) << setprecision(3) << obs.L5  << lli5 << ' '  // L5 
-        << setw(14) << setprecision(3) << obs.D5  << ' '  << ' '  // D5 
-        << setw(14) << setprecision(3) << obs.S5;                 // S5 
-  }
-  else if (obs.satSys == 'C') { // Compass
-    str << setw(14) << setprecision(3) << obs.C2  << ' '  << ' '  // C2I
-        << setw(14) << setprecision(3) << obs.L2C << lli2 << ' '  // L2I
-        << setw(14) << setprecision(3) << obs.D2C << ' '  << ' '  // D2I
-        << setw(14) << setprecision(3) << obs.S2C;                // S2I
-  }
+  for (int iEntry = 0; iEntry < GNSSENTRY_NUMBER; iEntry++) {
+    unsigned df = (1 << iEntry);
+    if (df & obs._dataflags) {
+      str << obs.entry2str(iEntry) << ' '
+          << setw(14) << setprecision(3) << obs._measdata[iEntry]  << ' ';
+    }
+  }
+
   return str.str();
 }
@@ -819,116 +743,13 @@
   }
 
-  if      (obs.satSys == 'G') { // GPS
-    if (obs.has1C()) {
-      str << "  1C " 
-          << obsToStr(obs.C1)  << ' '  
-          << obsToStr(obs.L1C) << ' '
-          << obsToStr(obs.D1C) << ' '
-          << obsToStr(obs.S1C, 8, 3) << ' '
-          << setw(2)  << obs.slip_cnt_L1;
-    }
-    if (obs.has1P()) {
-      str << "  1W "
-          << obsToStr(obs.P1)  << ' '  
-          << obsToStr(obs.L1P) << ' '
-          << obsToStr(obs.D1P) << ' '
-          << obsToStr(obs.S1P, 8, 3) << ' '
-          << setw(2)  << obs.slip_cnt_L1;
-    }
-    if (obs.has2P()) {
-      str << "  2P "
-          << obsToStr(obs.P2)  << ' '
-          << obsToStr(obs.L2P) << ' '
-          << obsToStr(obs.D2P) << ' '
-          << obsToStr(obs.S2P, 8, 3) << ' '
-          << setw(2)  << obs.slip_cnt_L2;
-    }
-    if (obs.has2C()) {
-      str << "  2X "
-          << obsToStr(obs.C2)  << ' '  
-          << obsToStr(obs.L2C) << ' '
-          << obsToStr(obs.D2C) << ' ' 
-          << obsToStr(obs.S2C, 8, 3) << ' '
-          << setw(2)  << obs.slip_cnt_L2;
-    }
-    if (obs.has5C()) {
-      str << "  5C "
-          << obsToStr(obs.C5)  << ' '
-          << obsToStr(obs.L5)  << ' '
-          << obsToStr(obs.D5)  << ' '
-          << obsToStr(obs.S5, 8, 3)  << ' '
-          << setw(2)  << obs.slip_cnt_L5;
-    }
-  }
-  else if (obs.satSys == 'R') { // Glonass
-    if (obs.has1C()) {
-      str << "  1C "
-          << obsToStr(obs.C1)  << ' '  
-          << obsToStr(obs.L1C) << ' '
-          << obsToStr(obs.D1C) << ' '
-          << obsToStr(obs.S1C, 8, 3) << ' '
-          << setw(2)  << obs.slip_cnt_L1;
-    }
-    if (obs.has1P()) {
-      str << "  1P "
-          << obsToStr(obs.P1)  << ' '  
-          << obsToStr(obs.L1P) << ' '
-          << obsToStr(obs.D1P) << ' '
-          << obsToStr(obs.S1P, 8, 3) << ' '
-          << setw(2)  << obs.slip_cnt_L1;
-    }
-    if (obs.has2P()) {
-      str << "  2P "
-          << obsToStr(obs.P2)  << ' '
-          << obsToStr(obs.L2P) << ' '
-          << obsToStr(obs.D2P) << ' '
-          << obsToStr(obs.S2P, 8, 3) << ' '
-          << setw(2)  << obs.slip_cnt_L2;
-    }
-    if (obs.has2C()) {
-      str << "  2C "
-          << obsToStr(obs.C2)  << ' '  
-          << obsToStr(obs.L2C) << ' '
-          << obsToStr(obs.D2C) << ' ' 
-          << obsToStr(obs.S2C, 8, 3) << ' '
-          << setw(2)  << obs.slip_cnt_L2;
-    }
-  }
-  else if (obs.satSys == 'S') { // SBAS
-    if (obs.has1C()) {
-      str << "  1C "
-          << obsToStr(obs.C1)  << ' '  
-          << obsToStr(obs.L1C) << ' '
-          << obsToStr(obs.D1C) << ' '
-          << obsToStr(obs.S1C, 8, 3) << ' '
-          << setw(2)  << obs.slip_cnt_L1;
-    }
-    if (obs.has1P()) {
-      str << "  1W "
-          << obsToStr(obs.P1)  << ' '  
-          << obsToStr(obs.L1P) << ' '
-          << obsToStr(obs.D1P) << ' '
-          << obsToStr(obs.S1P, 8, 3) << ' '
-          << setw(2)  << obs.slip_cnt_L1;
-    }
-  }
-  else if (obs.satSys == 'E') { // Galileo
-    if (obs.has1C()) {
-      str << " 1C "
-          << obsToStr(obs.C1)  << ' '  
-          << obsToStr(obs.L1C) << ' '
-          << obsToStr(obs.D1C) << ' '
-          << obsToStr(obs.S1C, 8, 3) << ' '
-          << setw(2)  << obs.slip_cnt_L1;
-    }
-    if (obs.has5C()) {
-      str << "  5C "
-          << obsToStr(obs.C5)  << ' '
-          << obsToStr(obs.L5)  << ' '
-          << obsToStr(obs.D5)  << ' '
-          << obsToStr(obs.S5, 8, 3)  << ' '
-          << setw(2)  << obs.slip_cnt_L5;
-    }
-  }
+  for (int iEntry = 0; iEntry < GNSSENTRY_NUMBER; iEntry++) {
+    unsigned df = (1 << iEntry);
+    if (df & obs._dataflags) {
+      str << obs.entry2str(iEntry) << ' '
+          << setw(14) << setprecision(3) << obs._measdata[iEntry]  << ' ';
+      // TODO: handle slip counters
+    }
+  }
+
   return str.str();
 }
Index: /trunk/BNC/src/rinex/bncpostprocess.cpp
===================================================================
--- /trunk/BNC/src/rinex/bncpostprocess.cpp	(revision 4388)
+++ /trunk/BNC/src/rinex/bncpostprocess.cpp	(revision 4389)
@@ -111,41 +111,15 @@
   strncpy(obs.StatID, rnxObsFile->markerName().toAscii().constData(),
           sizeof(obs.StatID));
+
   obs.satSys   = rnxSat.satSys;
   obs.satNum   = rnxSat.satNum;
   obs.GPSWeek  = epo->tt.gpsw();
   obs.GPSWeeks = epo->tt.gpssec();
-  //// TODO: check RINEX Version 3 types
+
   for (int iType = 0; iType < rnxObsFile->nTypes(obs.satSys); iType++) {
     QByteArray type = rnxObsFile->obsType(obs.satSys,iType).toAscii();
-    if      (type.indexOf("C1") == 0 && obs.C1  == 0.0) {
-      obs.C1 = rnxSat.obs[iType];
-    }
-    else if (type.indexOf("P1") == 0 && obs.P1  == 0.0) {
-      obs.P1 = rnxSat.obs[iType];
-    }
-    else if (type.indexOf("L1") == 0 && obs.L1C == 0.0) {
-      obs.L1C = rnxSat.obs[iType];
-      if      (obs.slip_cnt_L1 < 0) {  // undefined value
-        obs.slip_cnt_L1 = 0;
-      }
-      else if (rnxSat.lli[iType] & 1) {
-        ++obs.slip_cnt_L1;
-      }
-    }
-    else if (type.indexOf("C2") == 0 && obs.C2  == 0.0) {
-      obs.C2 = rnxSat.obs[iType];
-    }
-    else if (type.indexOf("P2") == 0 && obs.P2  == 0.0) {
-      obs.P2 = rnxSat.obs[iType];
-    }
-    else if (type.indexOf("L2") == 0 && obs.L2C == 0.0) {
-      obs.L2C = rnxSat.obs[iType];
-      if      (obs.slip_cnt_L2 < 0) {  // undefined value
-        obs.slip_cnt_L2 = 0;
-      }
-      else if (rnxSat.lli[iType] & 1) {
-        ++obs.slip_cnt_L2;
-      }
-    }
+    int iEntry = obs.str2entry(type.data());
+    obs._measdata[iEntry] = rnxSat.obs[iType];
+    // TOOD: handle slip flags
   }
 }
