Debian Codegraph @

src/FDM/ExternalPipe/ExternalPipe.hxx

raw symbols SCIP
1 // ExternalPipe.hxx -- a "pipe" interface to an external flight dynamics model
2 //
3 // Written by Curtis Olson, started March 2003.
4 //
5 // Copyright (C) 2003 Curtis L. Olson - http://www.flightgear.org/~curt
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 // $Id$
22
23 #ifndef _EXTERNAL_PIPE_HXX
24 #define _EXTERNAL_PIPE_HXX
25
26 #include <stdio.h> // FILE*, fopen(), fread(), fwrite(), et. al.
27
28 #include <simgear/timing/timestamp.hxx> // fine grained timing measurements
29
30 #include <Network/net_ctrls.hxx>
31 #include <Network/net_fdm.hxx>
32 #include <FDM/flight.hxx>
33
34
35 class FGExternalPipe : public FGInterface
36 {
37 private:
38 bool valid;
39
40 std::string fifo_name_1;
41 std::string fifo_name_2;
42 FILE *pd1;
43 FILE *pd2;
44 std::string _protocol;
45
46 FGNetCtrls ctrls;
47 FGNetFDM fdm;
48 char *buf;
49
50 double last_weight;
51 double last_cg_offset;
52
53 std::vector <std::string> property_names;
54 std::vector <SGPropertyNode_ptr> nodes;
55
56 // Protocol specific init routines
57 void init_binary();
58 void init_property();
59
60 // Protocol specific update routines
61 void update_binary( double dt );
62 void update_property( double dt );
63
64 void process_set_command( const string_list &tokens );
65
66 public:
67 // Constructor
68 FGExternalPipe( double dt, std::string fifo_name, std::string protocol );
69
70 // Destructor
71 ~FGExternalPipe();
72
73 // Subsystem API.
74 void init() override;
75 void update(double dt) override;
76
77 // Subsystem identification.
78 static const char* staticSubsystemClassId() { return "pipe"; }
79 };
80
81 #endif // _EXTERNAL_PIPE_HXX