FlightGear next
FGXMLAutopilot::Component Class Referenceabstract

Base class for other autopilot components. More...

#include <component.hxx>

Inherits SGSubsystem.

Inherited by FGXMLAutopilot::AnalogComponent, FGXMLAutopilot::DigitalComponent, and StateMachineComponent.

Public Member Functions

 Component ()
 A constructor for an empty Component.
 
virtual ~Component ()
 virtual destructor to clean up resources
 
void update (double dt) override
 
virtual bool configure (SGPropertyNode &prop_root, SGPropertyNode &cfg)
 configure this component from a property node.
 
bool isPropertyEnabled ()
 check if this component is enabled as configured in the <enable> section
 

Protected Member Functions

virtual bool configure (SGPropertyNode &cfg_node, const std::string &cfg_name, SGPropertyNode &prop_root)
 
virtual void update (bool firstTime, double dt)=0
 pure virtual function to be implemented by the derived classes.
 
virtual void disabled (double dt)
 overideable method being called from the update() method if this component is disabled.
 

Protected Attributes

bool _debug
 debug flag, true if this component should generate some useful output on every iteration
 
bool _honor_passive
 a (historic) flag signalling the derived class that it should compute it's internal state but shall not set the output properties if /autopilot/locks/passive-mode is true.
 

Detailed Description

Base class for other autopilot components.

Definition at line 33 of file component.hxx.

Constructor & Destructor Documentation

◆ Component()

Component::Component ( )

A constructor for an empty Component.

Definition at line 30 of file component.cxx.

◆ ~Component()

Component::~Component ( )
virtual

virtual destructor to clean up resources

Definition at line 38 of file component.cxx.

Member Function Documentation

◆ configure() [1/2]

bool Component::configure ( SGPropertyNode & cfg_node,
const std::string & cfg_name,
SGPropertyNode & prop_root )
protectedvirtual

◆ configure() [2/2]

bool Component::configure ( SGPropertyNode & prop_root,
SGPropertyNode & cfg )
virtual

configure this component from a property node.

Iterates through all nodes found as children under configNode and calls configure of the derived class for each child.

Parameters
prop_rootProperty root for all relative paths
cfgProperty node containing the configuration

Reimplemented in FGXMLAutopilot::DigitalFilter.

Definition at line 44 of file component.cxx.

◆ disabled()

virtual void FGXMLAutopilot::Component::disabled ( double dt)
inlineprotectedvirtual

overideable method being called from the update() method if this component is disabled.

It's a noop by default.

Reimplemented in FGXMLAutopilot::AnalogComponent.

Definition at line 60 of file component.hxx.

◆ isPropertyEnabled()

bool Component::isPropertyEnabled ( )

check if this component is enabled as configured in the <enable> section

Returns
true if the enable-condition is true.

If a <condition> is defined, this condition is evaluated, <prop> and <value> tags are ignored.

If a <prop> is defined and no <value> is defined, the property named in the <prop><prop> tags is evaluated as boolean.

If a <prop> is defined and a <value> is defined, the property named in <prop></prop> is compared (as a string) to the value defined in <value></value>

Returns true, if neither <condition> nor <prop> exists

Definition at line 119 of file component.cxx.

◆ update() [1/2]

virtual void FGXMLAutopilot::Component::update ( bool firstTime,
double dt )
protectedpure virtual

pure virtual function to be implemented by the derived classes.

Gets called from the update method if it's not disabled with the firstTime parameter set to true if this is the first call after being enabled

Parameters
firstTimeset to true if this is the first update call since this component has been enabled. Set to false for every subsequent call.
dtthe elapsed time since the last call

Implemented in FGXMLAutopilot::DigitalFilter, FGXMLAutopilot::FlipFlop, FGXMLAutopilot::Logic, FGXMLAutopilot::PIDController, FGXMLAutopilot::PISimpleController, FGXMLAutopilot::Predictor, and StateMachineComponent.

◆ update() [2/2]

void Component::update ( double dt)
override

Definition at line 134 of file component.cxx.

Member Data Documentation

◆ _debug

bool FGXMLAutopilot::Component::_debug
protected

debug flag, true if this component should generate some useful output on every iteration

Definition at line 66 of file component.hxx.

◆ _honor_passive

bool FGXMLAutopilot::Component::_honor_passive
protected

a (historic) flag signalling the derived class that it should compute it's internal state but shall not set the output properties if /autopilot/locks/passive-mode is true.

Definition at line 73 of file component.hxx.


The documentation for this class was generated from the following files: