/* -------------------------------------------------------------------------------- */
-class MetarDataHandler {
-public:
- virtual void handleMetarData( const std::string & data ) = 0;
- virtual void handleMetarFailure() = 0;
-};
-
-class MetarRequester {
-public:
- virtual void requestMetar( MetarDataHandler * metarDataHandler, const std::string & id ) = 0;
-};
+class MetarRequester;
/* -------------------------------------------------------------------------------- */
-class LiveMetarProperties : public MetarProperties, MetarDataHandler {
+class LiveMetarProperties : public MetarProperties {
public:
LiveMetarProperties( SGPropertyNode_ptr rootNode, MetarRequester * metarRequester, int maxAge );
virtual ~LiveMetarProperties();
typedef SGSharedPtr<LiveMetarProperties> LiveMetarProperties_ptr;
+class MetarRequester {
+public:
+ virtual void requestMetar( LiveMetarProperties_ptr metarDataHandler, const std::string & id ) = 0;
+};
+
+
LiveMetarProperties::LiveMetarProperties( SGPropertyNode_ptr rootNode, MetarRequester * metarRequester, int maxAge ) :
MetarProperties( rootNode ),
_timeToLive(0.0),
MetarPropertiesList::iterator it = findMetarAtPath( propPath );
if( it != _metarProperties.end() ) {
SG_LOG(SG_ENVIRONMENT, SG_INFO, "removing metar properties at " << propPath);
- LiveMetarProperties_ptr p(*it); // delay deletion until this goes out of scope when we return; no longer needed?
+// LiveMetarProperties_ptr p(*it); // delay deletion until this goes out of scope when we return; no longer needed?
// TODO: this doesn't actually delete it, because doing so invalidates the
// BasicRealWxController::update iterator, causing a crash on Go To Airport
- // _metarProperties.erase(it);
+ _metarProperties.erase(it);
} else {
SG_LOG(SG_ENVIRONMENT, SG_WARN, "no metar properties at " << propPath);
}
NoaaMetarRealWxController( SGPropertyNode_ptr rootNode );
// implementation of MetarRequester
- virtual void requestMetar( MetarDataHandler * metarDataHandler, const std::string & id );
+ virtual void requestMetar( LiveMetarProperties_ptr metarDataHandler, const std::string & id );
virtual ~NoaaMetarRealWxController()
{
void NoaaMetarRealWxController::requestMetar
(
- MetarDataHandler* metarDataHandler,
+ LiveMetarProperties_ptr metarDataHandler,
const std::string& id
)
{
public simgear::HTTP::MemoryRequest
{
public:
- NoaaMetarGetRequest( MetarDataHandler* metarDataHandler,
+ NoaaMetarGetRequest( LiveMetarProperties_ptr metarDataHandler,
const std::string& stationId ):
MemoryRequest(NOAA_BASE_URL + stationId + ".TXT"),
_metarDataHandler(metarDataHandler)
}
private:
- MetarDataHandler * _metarDataHandler;
+ LiveMetarProperties_ptr _metarDataHandler;
};
string upperId = boost::to_upper_copy(id);