Index: trunk/BNC/rinex/rnxobsfile.cpp
===================================================================
--- trunk/BNC/rinex/rnxobsfile.cpp	(revision 4052)
+++ trunk/BNC/rinex/rnxobsfile.cpp	(revision 4053)
@@ -167,5 +167,5 @@
         QString hlp;
         *in >> hlp;
-        _obsTypesV2.push_back(hlp);
+        _obsTypesV2.append(hlp);
       }
     }
@@ -210,7 +210,6 @@
   }
   else {
-    map<char, vector<QString> >::const_iterator it = _obsTypesV3.find(sys);
-    if (it != _obsTypesV3.end()) {
-      return it->second.size();
+    if (_obsTypesV3.contains(sys)) {
+      return _obsTypesV3[sys].size();
     }
     else {
@@ -227,7 +226,6 @@
   }
   else {
-    map<char, vector<QString> >::const_iterator it = _obsTypesV3.find(sys);
-    if (it != _obsTypesV3.end()) {
-      return it->second.at(index);
+    if (_obsTypesV3.contains(sys)) {
+      return _obsTypesV3[sys].at(index);
     }
     else {
@@ -575,15 +573,19 @@
   static const string systems = "GRES";
 
+  _header._obsTypesV2.clear();
+  _header._obsTypesV3.clear();
+
   // Copy Observation Types
   // ----------------------
   if      (_trafo == trafoNone) {
-    for (unsigned ii = 0; ii < header._obsTypesV2.size(); ii++) {
-      _header._obsTypesV2.push_back(header._obsTypesV2[ii]);
-    }
-    map<char, vector<QString> >::const_iterator it;
-    for (it = header._obsTypesV3.begin(); it != header._obsTypesV3.end(); it++) {
-      char                   sys     = it->first;
-      const vector<QString>& typesV3 = it->second;
-      for (unsigned ii = 0; ii < typesV3.size(); ii++) {
+    for (int ii = 0; ii < header._obsTypesV2.size(); ii++) {
+      _header._obsTypesV2.append(header._obsTypesV2[ii]);
+    }
+    QMapIterator<char, QVector<QString> > it(header._obsTypesV3);
+    while (it.hasNext()) {
+      it.next();
+      char                    sys     = it.key();
+      const QVector<QString>& typesV3 = it.value();
+      for (int ii = 0; ii < typesV3.size(); ii++) {
         _header._obsTypesV3[sys].push_back(typesV3[ii]);
       }
@@ -594,5 +596,5 @@
   // -------------------------------------
   else if (_trafo == trafo2to3) {
-    for (unsigned i2 = 0; i2 < header._obsTypesV2.size(); i2++) {
+    for (int i2 = 0; i2 < header._obsTypesV2.size(); i2++) {
       const QString& typeV2 = header._obsTypesV2[i2];
       for (unsigned iSys = 0; iSys < systems.length(); iSys++) {
@@ -613,13 +615,12 @@
     for (unsigned iSys = 0; iSys < systems.length(); iSys++) {
       char sys = systems[iSys];
-      map<char, vector<QString> >::const_iterator it = header._obsTypesV3.find(sys);
-      if (it != header._obsTypesV3.end()) {
-        const vector<QString>& typesV3 = it->second;
-        for (unsigned i3 = 0; i3 < typesV3.size(); i3++) {
+      if (header._obsTypesV3.contains(sys)) {
+        const QVector<QString>& typesV3 = header._obsTypesV3[sys];
+        for (int i3 = 0; i3 < typesV3.size(); i3++) {
           const QString& typeV3 = typesV3[i3];
           QString        typeV2 = type3to2(typeV3);
           if (!typeV2.isEmpty()) {
             bool found = false;
-            for (unsigned i2 = 0; i2 < _header._obsTypesV2.size(); i2++) {
+            for (int i2 = 0; i2 < _header._obsTypesV2.size(); i2++) {
               if (_header._obsTypesV2[i2] == typeV2) {
                 found = true;
@@ -631,5 +632,5 @@
             }
             if (!found) {
-              _header._obsTypesV2.push_back(typeV2);
+              _header._obsTypesV2.append(typeV2);
               int i2 = _header._obsTypesV2.size() - 1;
               _indexMap2to3[sys][i2] = i3; 
@@ -718,5 +719,5 @@
     QString hlp;
     QTextStream(&hlp) << QString("%1").arg(_header._obsTypesV2.size(), 6);
-    for (unsigned ii = 0; ii < _header._obsTypesV2.size(); ii++) {
+    for (int ii = 0; ii < _header._obsTypesV2.size(); ii++) {
       QTextStream(&hlp) << QString("%1").arg(_header._obsTypesV2[ii], 6);   
       if (ii > 0 && (ii % 8 == 0 || ii == _header._obsTypesV2.size()-1)) {
@@ -727,11 +728,12 @@
   }
   else {
-    map<char, vector<QString> >::const_iterator it;
-    for (it = _header._obsTypesV3.begin(); it != _header._obsTypesV3.end(); it++) {
-      char sys                     = it->first;
-      const vector<QString>& types = it->second;
+    QMapIterator<char, QVector<QString> > it(_header._obsTypesV3);
+    while (it.hasNext()) {
+      it.next();
+      char sys                      = it.key();
+      const QVector<QString>& types = it.value();
       QString hlp;
       QTextStream(&hlp) << QString("%1  %2").arg(sys).arg(types.size(), 3);
-      for (unsigned ii = 0; ii < types.size(); ii++) {
+      for (int ii = 0; ii < types.size(); ii++) {
         QTextStream(&hlp) << QString(" %1").arg(types[ii], -3);   
         if (ii > 0 && (ii % 12 == 0 || ii == types.size()-1)) {
@@ -1001,2 +1003,16 @@
   return "";
 }
+
+// Check for Changes in Header
+////////////////////////////////////////////////////////////////////////////
+void t_rnxObsFile::checkNewHeader(const t_rnxObsHeader& header) {
+
+  t_rnxObsHeader oldHeader(_header);
+  setHeader(header, oldHeader._version);
+
+  if (header._obsTypesV2 != oldHeader._obsTypesV2 ||
+      header._obsTypesV3 != oldHeader._obsTypesV3) {
+
+    writeHeader();
+  }
+}
Index: trunk/BNC/rinex/rnxobsfile.h
===================================================================
--- trunk/BNC/rinex/rnxobsfile.h	(revision 4052)
+++ trunk/BNC/rinex/rnxobsfile.h	(revision 4053)
@@ -114,25 +114,25 @@
     const QString&  obsType(char sys, int index) const;
  
-    static const QString                  _emptyStr;
-    float                                 _version;
-    double                                _interval;
-    QString                               _antennaNumber;
-    QString                               _antennaName;
-    QString                               _markerName;
-    QString                               _markerNumber;
-    QString                               _observer;
-    QString                               _agency;
-    QString                               _receiverNumber;
-    QString                               _receiverType;
-    QString                               _receiverVersion;
-    ColumnVector                          _antNEU;
-    ColumnVector                          _antXYZ;
-    ColumnVector                          _antBSG;
-    ColumnVector                          _xyz;
-    std::vector<QString>                  _obsTypesV2;
-    std::map<char, std::vector<QString> > _obsTypesV3;
-    int                                   _wlFactorsL1[MAXPRN_GPS+1];
-    int                                   _wlFactorsL2[MAXPRN_GPS+1];
-    bncTime                               _startTime;
+    static const QString          _emptyStr;
+    float                         _version;
+    double                        _interval;
+    QString                       _antennaNumber;
+    QString                       _antennaName;
+    QString                       _markerName;
+    QString                       _markerNumber;
+    QString                       _observer;
+    QString                       _agency;
+    QString                       _receiverNumber;
+    QString                       _receiverType;
+    QString                       _receiverVersion;
+    ColumnVector                  _antNEU;
+    ColumnVector                  _antXYZ;
+    ColumnVector                  _antBSG;
+    ColumnVector                  _xyz;
+    QVector<QString>              _obsTypesV2;
+    QMap<char, QVector<QString> > _obsTypesV3;
+    int                           _wlFactorsL1[MAXPRN_GPS+1];
+    int                           _wlFactorsL2[MAXPRN_GPS+1];
+    bncTime                       _startTime;
   };
 
@@ -140,4 +140,5 @@
   const t_rnxObsHeader& header() const {return _header;}
   void setHeader(const t_rnxObsHeader& header, double version);
+  void checkNewHeader(const t_rnxObsHeader& header);
   void writeHeader();
   void writeEpoch(const t_rnxEpo* epo);
@@ -155,6 +156,6 @@
   QString type3to2(const QString& typeV3);
 
-  std::map<char, std::map<int, int> > _indexMap2to3;
-  std::map<char, std::map<int, int> > _indexMap3to2;
+  QMap<char, QMap<int, int> > _indexMap2to3;
+  QMap<char, QMap<int, int> > _indexMap3to2;
 
   e_inpOut       _inpOut;
