00001 #pragma ident "$Id: RequireObservables.cpp 3140 2012-06-18 15:03:02Z susancummins $" 00002 00008 //============================================================================ 00009 // 00010 // This file is part of GPSTk, the GPS Toolkit. 00011 // 00012 // The GPSTk is free software; you can redistribute it and/or modify 00013 // it under the terms of the GNU Lesser General Public License as published 00014 // by the Free Software Foundation; either version 2.1 of the License, or 00015 // any later version. 00016 // 00017 // The GPSTk is distributed in the hope that it will be useful, 00018 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 // GNU Lesser General Public License for more details. 00021 // 00022 // You should have received a copy of the GNU Lesser General Public 00023 // License along with GPSTk; if not, write to the Free Software Foundation, 00024 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA 00025 // 00026 // Dagoberto Salazar - gAGE ( http://www.gage.es ). 2007, 2008, 2011 00027 // 00028 //============================================================================ 00029 00030 00031 #include "RequireObservables.hpp" 00032 00033 00034 namespace gpstk 00035 { 00036 00037 // Returns a string identifying this object. 00038 std::string RequireObservables::getClassName() const 00039 { return "RequireObservables"; } 00040 00041 00042 00043 /* Method to add a set of TypeID's to be required. 00044 * 00045 * @param typeSet Set of TypeID's to be required. 00046 */ 00047 RequireObservables& RequireObservables::addRequiredType(TypeIDSet& typeSet) 00048 { 00049 00050 requiredTypeSet.insert( typeSet.begin(), 00051 typeSet.end() ); 00052 00053 return (*this); 00054 00055 } // End of method 'RequireObservables::addRequiredType()' 00056 00057 00058 00059 // Returns a satTypeValueMap object, filtering the target observables. 00060 // 00061 // @param gData Data object holding the data. 00062 // 00063 satTypeValueMap& RequireObservables::Process(satTypeValueMap& gData) 00064 throw(ProcessingException) 00065 { 00066 00067 try 00068 { 00069 00070 SatIDSet satRejectedSet; 00071 00072 // Loop through all the satellites 00073 for ( satTypeValueMap::iterator satIt = gData.begin(); 00074 satIt != gData.end(); 00075 ++satIt ) 00076 { 00077 00078 00079 // Check all the indicated TypeID's 00080 for ( TypeIDSet::const_iterator typeIt = requiredTypeSet.begin(); 00081 typeIt != requiredTypeSet.end(); 00082 ++typeIt ) 00083 { 00084 00085 00086 // Try to find required type 00087 typeValueMap::iterator it( (*satIt).second.find(*typeIt) ); 00088 00089 // Now, check if this TypeID exists in this data structure 00090 if ( it == (*satIt).second.end() ) 00091 { 00092 // If we couldn't find type, then schedule this 00093 // satellite for removal 00094 satRejectedSet.insert( (*satIt).first ); 00095 00096 // It is not necessary to keep looking 00097 typeIt = requiredTypeSet.end(); 00098 --typeIt; 00099 } 00100 00101 } 00102 00103 } 00104 00105 // Let's remove satellites without all TypeID's 00106 gData.removeSatID(satRejectedSet); 00107 00108 return gData; 00109 00110 } 00111 catch(Exception& u) 00112 { 00113 // Throw an exception if something unexpected happens 00114 ProcessingException e( getClassName() + ":" 00115 + u.what() ); 00116 00117 GPSTK_THROW(e); 00118 00119 } 00120 00121 } // End of 'RequireObservables::Process()' 00122 00123 00124 } // End of namespace gpstk
1.3.9.1