ComputeCombination.cpp

Go to the documentation of this file.
00001 #pragma ident "$Id: ComputeCombination.cpp 1325 2008-07-29 14:33:43Z architest $"
00002 
00009 //============================================================================
00010 //
00011 //  This file is part of GPSTk, the GPS Toolkit.
00012 //
00013 //  The GPSTk is free software; you can redistribute it and/or modify
00014 //  it under the terms of the GNU Lesser General Public License as published
00015 //  by the Free Software Foundation; either version 2.1 of the License, or
00016 //  any later version.
00017 //
00018 //  The GPSTk is distributed in the hope that it will be useful,
00019 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00020 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021 //  GNU Lesser General Public License for more details.
00022 //
00023 //  You should have received a copy of the GNU Lesser General Public
00024 //  License along with GPSTk; if not, write to the Free Software Foundation,
00025 //  Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00026 //
00027 //  Dagoberto Salazar - gAGE ( http://www.gage.es ). 2007, 2008
00028 //
00029 //============================================================================
00030 
00031 
00032 #include "ComputeCombination.hpp"
00033 
00034 
00035 namespace gpstk
00036 {
00037 
00038       // Index initially assigned to this class
00039    int ComputeCombination::classIndex = 2000000;
00040 
00041 
00042       // Returns an index identifying this object.
00043    int ComputeCombination::getIndex() const
00044    { return index; }
00045 
00046 
00047       // Returns a string identifying this object.
00048    std::string ComputeCombination::getClassName() const
00049    { return "ComputeCombination"; }
00050 
00051 
00052 
00053       /* Returns a satTypeValueMap object, adding the new data generated
00054        * when calling this object.
00055        *
00056        * @param gData     Data object holding the data.
00057        */
00058    satTypeValueMap& ComputeCombination::Process(satTypeValueMap& gData)
00059       throw(ProcessingException)
00060    {
00061 
00062       try
00063       {
00064 
00065          double value1(0.0);
00066          double value2(0.0);
00067 
00068          SatIDSet satRejectedSet;
00069 
00070             // Loop through all the satellites
00071          satTypeValueMap::iterator it;
00072          for( it = gData.begin(); it != gData.end(); ++it ) 
00073          {
00074 
00075             try
00076             {
00077                   // Try to extract the values
00078                value1 = (*it).second(type1);
00079                value2 = (*it).second(type2);
00080             }
00081             catch(...)
00082             {
00083                   // If some value is missing, schedule this satellite
00084                   // for removal
00085                satRejectedSet.insert( (*it).first );
00086                continue;
00087             }
00088 
00089                // If everything is OK, then get the new value inside
00090                // the structure
00091             (*it).second[resultType] = getCombination(value1, value2);
00092 
00093          }
00094 
00095             // Remove satellites with missing data
00096          gData.removeSatID(satRejectedSet);
00097 
00098          return gData;
00099 
00100       }
00101       catch(Exception& u)
00102       {
00103             // Throw an exception if something unexpected happens
00104          ProcessingException e( getClassName() + ":"
00105                                 + StringUtils::asString( getIndex() ) + ":"
00106                                 + u.what() );
00107 
00108          GPSTK_THROW(e);
00109 
00110       }
00111 
00112    }  // End of method 'ComputeCombination::Process()'
00113 
00114 
00115 } // End of namespace gpstk

Generated on Tue May 22 03:30:56 2012 for GPS ToolKit Software Library by  doxygen 1.3.9.1