]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/models/FGOutput.h
Sync. with JSBSim CVS
[flightgear.git] / src / FDM / JSBSim / models / FGOutput.h
index 7194c119b0ceb0d9894f77ee74fc3ea84f3aa31d..d03ac5981ac54aff208d950de396ed87ad2f0749 100644 (file)
@@ -4,7 +4,7 @@
  Author:       Jon Berndt
  Date started: 12/2/98
 
- ------------- Copyright (C) 1999  Jon S. Berndt (jsb@hal-pc.org) -------------
+ ------------- Copyright (C) 1999  Jon S. Berndt (jon@jsbsim.org) -------------
 
  This program is free software; you can redistribute it and/or modify it under
  the terms of the GNU Lesser General Public License as published by the Free Software
@@ -41,19 +41,17 @@ INCLUDES
 
 #include "FGModel.h"
 
-#include <iostream>
 #include <fstream>
 
-#include "input_output/FGfdmSocket.h"
 #include "input_output/FGXMLFileRead.h"
 #include "input_output/net_fdm.hxx"
-
+#include "input_output/FGfdmSocket.h"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 DEFINITIONS
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
-#define ID_OUTPUT "$Id$"
+#define ID_OUTPUT "$Id: FGOutput.h,v 1.19 2010/10/31 04:48:46 jberndt Exp $"
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 FORWARD DECLARATIONS
@@ -61,6 +59,8 @@ FORWARD DECLARATIONS
 
 namespace JSBSim {
 
+class FGfdmSocket;
+
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS DOCUMENTATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@@ -83,7 +83,7 @@ CLASS DOCUMENTATION
       FLIGHTGEAR  A socket is created for sending binary data packets to
                   an external instance of FlightGear for visuals.  Parameters
                   defining the socket are given on the \<output> line.
-      TABULAR     Columnar data. NOT IMPLEMENTED YET!
+      TABULAR     Columnar data.
       TERMINAL    Output to terminal. NOT IMPLEMENTED YET!
       NONE        Specifies to do nothing. This setting makes it easy to turn on and
                   off the data output without having to mess with anything else.
@@ -91,7 +91,7 @@ CLASS DOCUMENTATION
       Examples:
 </pre>
 @code
-       <output name="localhost" type="FLIGHTGEAR" port="5500" protocol="tcp" rate="10"></output>
+       <output name="localhost" type="FLIGHTGEAR" port="5500" protocol="tcp" rate="10"/>
 @endcode
 @code
        <output name="B737_datalog.csv" type="CSV" rate="20">
@@ -124,7 +124,7 @@ CLASS DOCUMENTATION
     propulsion       ON|OFF
 </pre>
     NOTE that Time is always output with the data.
-    @version $Id$
+    @version $Id: FGOutput.h,v 1.19 2010/10/31 04:48:46 jberndt Exp $
  */
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -140,21 +140,25 @@ public:
   bool InitModel(void);
   bool Run(void);
 
-  void DelimitedOutput(string);
+  void DelimitedOutput(const std::string&);
   void SocketOutput(void);
   void FlightGearSocketOutput(void);
-  void SocketStatusOutput(string);
+  void SocketStatusOutput(const std::string&);
   void SocketDataFill(FGNetFDM* net);
 
-
-  void SetType(string);
+  void SetType(const std::string& type);
+  void SetProtocol(const std::string& protocol);
+  void SetPort(const std::string& port);
+  void SetStartNewFile(bool tt) {StartNewFile = tt;}
   void SetSubsystems(int tt) {SubSystems = tt;}
-  inline void Enable(void) { enabled = true; }
-  inline void Disable(void) { enabled = false; }
-  inline bool Toggle(void) {enabled = !enabled; return enabled;}
+  void SetOutputFileName(const std::string& fname) {Filename = fname;}
+  void SetDirectivesFile(const std::string& fname) {DirectivesFile = fname;}
+  void SetRate(int rt);
+  void Enable(void) { enabled = true; }
+  void Disable(void) { enabled = false; }
+  bool Toggle(void) {enabled = !enabled; return enabled;}
+
   bool Load(Element* el);
-  void SetOutputFileName(string fname) {Filename = fname;}
-  void SetDirectivesFile(string fname) {DirectivesFile = fname;}
   string GetOutputFileName(void) const {return Filename;}
 
   /// Subsystem types for specifying which will be output in the FDM data logging
@@ -174,18 +178,20 @@ public:
     /** Subsystem: Propulsion (= 4096)       */ ssPropulsion      = 4096
   } subsystems;
 
-
   FGNetFDM fgSockBuf;
 
 private:
   enum {otNone, otCSV, otTab, otSocket, otTerminal, otFlightGear, otUnknown} Type;
+  FGfdmSocket::ProtocolType Protocol;
   bool sFirstPass, dFirstPass, enabled;
   int SubSystems;
-  string output_file_name, delimeter, Filename, DirectivesFile;
-  ofstream datafile;
+  int runID_postfix;
+  bool StartNewFile;
+  std::string output_file_name, delimeter, BaseFilename, Filename, DirectivesFile;
+  std::string Port;
+  std::ofstream datafile;
   FGfdmSocket* socket;
-  FGfdmSocket* flightGearSocket;
-  vector <FGPropertyManager*> OutputProperties;
+  std::vector <FGPropertyManager*> OutputProperties;
 
   void Debug(int from);
 };