FlightGear next
flipflop.hxx
Go to the documentation of this file.
1// flipflop.hxx - implementation of multiple flip flop types
2//
3// Written by Torsten Dreyer
4//
5// Copyright (C) 2010 Torsten Dreyer - Torsten (at) t3r (dot) de
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 __FLIPFLOPCOMPONENT_HXX
22#define __FLIPFLOPCOMPONENT_HXX 1
23
24#include "logic.hxx"
25
26namespace FGXMLAutopilot {
27
32class FlipFlopImplementation : public SGReferenced {
33protected:
39 virtual bool configure( SGPropertyNode& cfg_node,
40 const std::string& cfg_name,
41 SGPropertyNode& prop_root )
42 { return false; }
43public:
52 virtual bool getState( double dt, DigitalComponent::InputMap input, bool & q ) { return false; }
53
59 bool configure( SGPropertyNode& prop_root,
60 SGPropertyNode& cfg );
61
62 virtual bool isConfigProperty(const std::string& cfg_name) const { return false; }
63};
64
68class FlipFlop : public Logic
69{
70public:
71 // Subsystem identification.
72 static const char* staticSubsystemClassId() { return "flipflop"; }
73
74protected:
82 virtual bool configure( SGPropertyNode& cfg_node,
83 const std::string& cfg_name,
84 SGPropertyNode& prop_root );
85
94 void update( bool firstTime, double dt );
95
96private:
100 SGSharedPtr<FlipFlopImplementation> _implementation;
101};
102
103}
104#endif // FLIPFLOPCOMPONENT_HXX
Interface for a flip flop implementation.
Definition flipflop.hxx:32
virtual bool isConfigProperty(const std::string &cfg_name) const
Definition flipflop.hxx:62
virtual bool getState(double dt, DigitalComponent::InputMap input, bool &q)
evaluates the output state from the input lines
Definition flipflop.hxx:52
virtual bool configure(SGPropertyNode &cfg_node, const std::string &cfg_name, SGPropertyNode &prop_root)
configure this component from a property node.
Definition flipflop.hxx:39
A simple flipflop implementation.
Definition flipflop.hxx:69
virtual bool configure(SGPropertyNode &cfg_node, const std::string &cfg_name, SGPropertyNode &prop_root)
Over-rideable hook method to allow derived classes to refine top-level node parsing.
Definition flipflop.cxx:405
static const char * staticSubsystemClassId()
Definition flipflop.hxx:72
void update(bool firstTime, double dt)
Implementation of the pure virtual function of the Component class.
Definition flipflop.cxx:475
A simple logic class writing <condition> to a property.
Definition logic.hxx:36