FlightGear next
PropertyChangeObserver.hxx
Go to the documentation of this file.
1// PropertyChangeObserver.hxx -- Watch properties for changes
2//
3// Written by Torsten Dreyer, started April 2014.
4//
5// Copyright (C) 2014 Torsten Dreyer
6//
7// This program is free software; you can redistribute it and/or
8// modify it under the terms of the GNU General Public License as
9// published by the Free Software Foundation; either version 2 of the
10// License, or (at your option) any later version.
11//
12// This program is distributed in the hope that it will be useful, but
13// WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15// General Public License for more details.
16//
17// You should have received a copy of the GNU General Public License
18// along with this program; if not, write to the Free Software
19// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20
21#ifndef PROPERTYCHANGEOBSERVER_HXX_
22#define PROPERTYCHANGEOBSERVER_HXX_
23
24#include <simgear/props/props.hxx>
25#include <string>
26#include <vector>
27
28namespace flightgear {
29namespace http {
30
31struct PropertyChangeObserverEntry : public SGReferenced {
33 : _changed(true)
34 {
35 }
36 SGPropertyNode_ptr _node;
37 std::string _prevValue;
39};
40
41typedef SGSharedPtr<PropertyChangeObserverEntry> PropertyChangeObserverEntryRef;
42
44public:
47
48 const SGPropertyNode_ptr addObservation( const std::string propertyName);
49 bool isChangedValue(const SGPropertyNode_ptr node);
50
51 void check();
52 void uncheck();
53
54 void clear() { _entries.clear(); }
55
56private:
57 typedef std::vector<PropertyChangeObserverEntryRef> Entries_t;
58 Entries_t _entries;
59
60};
61} // namespace http
62} // namespace flightgear
63
64#endif /* PROPERTYCHANGEOBSERVER_HXX_ */
bool isChangedValue(const SGPropertyNode_ptr node)
const SGPropertyNode_ptr addObservation(const std::string propertyName)
SGSharedPtr< PropertyChangeObserverEntry > PropertyChangeObserverEntryRef
FlightPlan.hxx - defines a full flight-plan object, including departure, cruise, arrival information ...
Definition Addon.cxx:53