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
28
namespace
flightgear
{
29
namespace
http
{
30
31
struct
PropertyChangeObserverEntry
:
public
SGReferenced {
32
PropertyChangeObserverEntry
()
33
:
_changed
(true)
34
{
35
}
36
SGPropertyNode_ptr
_node
;
37
std::string
_prevValue
;
38
bool
_changed
;
39
};
40
41
typedef
SGSharedPtr<PropertyChangeObserverEntry>
PropertyChangeObserverEntryRef
;
42
43
class
PropertyChangeObserver
{
44
public
:
45
PropertyChangeObserver
();
46
virtual
~PropertyChangeObserver
();
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
56
private
:
57
typedef
std::vector<PropertyChangeObserverEntryRef> Entries_t;
58
Entries_t _entries;
59
60
};
61
}
// namespace http
62
}
// namespace flightgear
63
64
#endif
/* PROPERTYCHANGEOBSERVER_HXX_ */
flightgear::http::PropertyChangeObserver::check
void check()
Definition
PropertyChangeObserver.cxx:39
flightgear::http::PropertyChangeObserver::clear
void clear()
Definition
PropertyChangeObserver.hxx:54
flightgear::http::PropertyChangeObserver::~PropertyChangeObserver
virtual ~PropertyChangeObserver()
Definition
PropertyChangeObserver.cxx:34
flightgear::http::PropertyChangeObserver::isChangedValue
bool isChangedValue(const SGPropertyNode_ptr node)
Definition
PropertyChangeObserver.cxx:91
flightgear::http::PropertyChangeObserver::addObservation
const SGPropertyNode_ptr addObservation(const std::string propertyName)
Definition
PropertyChangeObserver.cxx:65
flightgear::http::PropertyChangeObserver::PropertyChangeObserver
PropertyChangeObserver()
Definition
PropertyChangeObserver.cxx:30
flightgear::http::PropertyChangeObserver::uncheck
void uncheck()
Definition
PropertyChangeObserver.cxx:58
flightgear::http
Definition
FlightHistoryUriHandler.cxx:33
flightgear::http::PropertyChangeObserverEntryRef
SGSharedPtr< PropertyChangeObserverEntry > PropertyChangeObserverEntryRef
Definition
PropertyChangeObserver.hxx:41
flightgear
FlightPlan.hxx - defines a full flight-plan object, including departure, cruise, arrival information ...
Definition
Addon.cxx:53
flightgear::http::PropertyChangeObserverEntry::PropertyChangeObserverEntry
PropertyChangeObserverEntry()
Definition
PropertyChangeObserver.hxx:32
flightgear::http::PropertyChangeObserverEntry::_changed
bool _changed
Definition
PropertyChangeObserver.hxx:38
flightgear::http::PropertyChangeObserverEntry::_node
SGPropertyNode_ptr _node
Definition
PropertyChangeObserver.hxx:36
flightgear::http::PropertyChangeObserverEntry::_prevValue
std::string _prevValue
Definition
PropertyChangeObserver.hxx:37
src
Network
http
PropertyChangeObserver.hxx
Generated on Tue Jun 3 2025 12:58:41 for FlightGear by
1.13.2