Debian Codegraph @

src/FDM/JSBSim/input_output/FGOutputSocket.h

raw symbols SCIP
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
3 Header: FGOutputSocket.h
4 Author: Bertrand Coconnier
5 Date started: 09/10/11
6
7 ------------- Copyright (C) 2011 Bertrand Coconnier -------------
8
9 This program is free software; you can redistribute it and/or modify it under
10 the terms of the GNU Lesser General Public License as published by the Free Software
11 Foundation; either version 2 of the License, or (at your option) any later
12 version.
13
14 This program is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
17 details.
18
19 You should have received a copy of the GNU Lesser General Public License along with
20 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21 Place - Suite 330, Boston, MA 02111-1307, USA.
22
23 Further information about the GNU Lesser General Public License can also be found on
24 the world wide web at http://www.gnu.org.
25
26 HISTORY
27 --------------------------------------------------------------------------------
28 09/10/11 BC Created
29
30 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
31 SENTRY
32 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
33
34 #ifndef FGOUTPUTSOCKET_H
35 #define FGOUTPUTSOCKET_H
36
37 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
38 INCLUDES
39 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
40
41 #include "FGOutputType.h"
42 #include "input_output/net_fdm.hxx"
43 #include "input_output/FGfdmSocket.h"
44
45 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
46 FORWARD DECLARATIONS
47 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
48
49 namespace JSBSim {
50
51 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
52 CLASS DOCUMENTATION
53 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
54
55 /** Implements the output to a socket. This class outputs data to a socket
56 according to the JSBSim format. It can be inherited as a generic class that
57 provides services for socket outputs. For instance FGOutputFG inherits
58 FGOutputSocket for the socket management but outputs data with a format
59 different than FGOutputSocket.
60 */
61
62 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
63 CLASS DECLARATION
64 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
65
66 class FGOutputSocket : public FGOutputType
67 {
68 public:
69 /** Constructor. */
70 FGOutputSocket(FGFDMExec* fdmex);
71
72 /** Destructor. */
73 ~FGOutputSocket() override;
74
75 /** Overwrites the name identifier under which the output will be logged.
76 This method is taken into account if it is called before
77 FGFDMExec::RunIC() otherwise it is ignored until the next call to
78 SetStartNewOutput().
79 @param name new name in the form "hostname:port/proto"
80 hostname could be an ip, port a numerical value and
81 proto should be UDP or TCP (the default if omitted)
82 */
83 void SetOutputName(const std::string& name) override;
84
85 /** Init the output directives from an XML file.
86 @param element XML Element that is pointing to the output directives
87 */
88 bool Load(Element* el) override;
89
90 /** Initializes the instance. This method basically opens the socket to which
91 outputs will be directed.
92 @result true if the execution succeeded.
93 */
94 bool InitModel(void) override;
95 /// Generates the output.
96 void Print(void) override;
97
98 /** Outputs a status thru the socket. This method issues a message prepended
99 by the string "<STATUS>" to the socket.
100 @param out_str status message
101 */
102 void SocketStatusOutput(const std::string& out_str);
103
104 protected:
105 virtual void PrintHeaders(void);
106
107 std::string SockName;
108 unsigned int SockPort;
109 FGfdmSocket::ProtocolType SockProtocol;
110 FGfdmSocket* socket;
111 int precision;
112 };
113 }
114 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
115 #endif