00001 #pragma ident "$Id: RequireObservables.cpp 1460 2008-11-18 15:41:23Z ckiesch $"
00002
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #include "RequireObservables.hpp"
00032
00033
00034 namespace gpstk
00035 {
00036
00037
00038 int RequireObservables::classIndex = 1200000;
00039
00040
00041
00042 int RequireObservables::getIndex() const
00043 { return index; }
00044
00045
00046
00047 std::string RequireObservables::getClassName() const
00048 { return "RequireObservables"; }
00049
00050
00051
00052
00053
00054
00055
00056 RequireObservables& RequireObservables::addRequiredType(TypeIDSet& typeSet)
00057 {
00058
00059 requiredTypeSet.insert( typeSet.begin(),
00060 typeSet.end() );
00061
00062 return (*this);
00063
00064 }
00065
00066
00067
00068
00069
00070
00071
00072 satTypeValueMap& RequireObservables::Process(satTypeValueMap& gData)
00073 throw(ProcessingException)
00074 {
00075
00076 try
00077 {
00078
00079 SatIDSet satRejectedSet;
00080
00081
00082 for ( satTypeValueMap::iterator satIt = gData.begin();
00083 satIt != gData.end();
00084 ++satIt )
00085 {
00086
00087
00088
00089 for ( TypeIDSet::const_iterator typeIt = requiredTypeSet.begin();
00090 typeIt != requiredTypeSet.end();
00091 ++typeIt )
00092 {
00093
00094
00095
00096 typeValueMap::iterator it( (*satIt).second.find(*typeIt) );
00097
00098
00099 if ( it == (*satIt).second.end() )
00100 {
00101
00102
00103 satRejectedSet.insert( (*satIt).first );
00104
00105
00106 typeIt = requiredTypeSet.end();
00107 --typeIt;
00108 }
00109
00110 }
00111
00112 }
00113
00114
00115 gData.removeSatID(satRejectedSet);
00116
00117 return gData;
00118
00119 }
00120 catch(Exception& u)
00121 {
00122
00123 ProcessingException e( getClassName() + ":"
00124 + StringUtils::asString( getIndex() ) + ":"
00125 + u.what() );
00126
00127 GPSTK_THROW(e);
00128
00129 }
00130
00131 }
00132
00133
00134 }