]> git.mxchange.org Git - flightgear.git/blob - src/Autopilot/digitalfilter.hxx
Fix build on Windows
[flightgear.git] / src / Autopilot / digitalfilter.hxx
1 // digitalfilter.hxx - a selection of digital filters
2 //
3 // Written by Torsten Dreyer
4 // Based heavily on work created by Curtis Olson, started January 2004.
5 //
6 // Copyright (C) 2004  Curtis L. Olson  - http://www.flightgear.org/~curt
7 // Copyright (C) 2010  Torsten Dreyer - Torsten (at) t3r (dot) de
8 //
9 // This program is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU General Public License as
11 // published by the Free Software Foundation; either version 2 of the
12 // License, or (at your option) any later version.
13 //
14 // This program is distributed in the hope that it will be useful, but
15 // WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 // General Public License for more details.
18 //
19 // You should have received a copy of the GNU General Public License
20 // along with this program; if not, write to the Free Software
21 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
22 //
23 #ifndef __DIGITALFILTER_HXX
24 #define __DIGITALFILTER_HXX 1
25
26 #ifdef HAVE_CONFIG_H
27 #  include <config.h>
28 #endif
29
30 #include "analogcomponent.hxx"
31
32 namespace FGXMLAutopilot {
33
34 /**
35  *
36  *
37  */
38 class DigitalFilterImplementation : public SGReferenced {
39 protected:
40   virtual bool configure( const std::string & nodeName, SGPropertyNode_ptr configNode) = 0;
41 public:
42   virtual void   initialize( double output ) {}
43   virtual double compute( double dt, double input ) = 0;
44   bool configure( SGPropertyNode_ptr configNode );
45 };
46
47 /**
48  * brief@ DigitalFilter - a selection of digital filters
49  *
50  */
51 class DigitalFilter : public AnalogComponent
52 {
53 private:
54     SGSharedPtr<DigitalFilterImplementation> _implementation;
55
56 protected:
57     bool configure( const std::string & nodeName, SGPropertyNode_ptr configNode);
58     void update( bool firstTime, double dt);
59
60     InputValueList _Tf;
61     InputValueList _samples;
62     InputValueList _rateOfChange;
63     InputValueList _gain;
64
65 public:
66     DigitalFilter();
67     ~DigitalFilter() {}
68
69 };
70
71 } // namespace FGXMLAutopilot
72 #endif