2000-11-03 23:02:47 +00:00
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
1999-12-20 20:25:13 +00:00
|
|
|
|
2006-01-12 15:04:22 +00:00
|
|
|
Header: FGInput.h
|
|
|
|
Author: Jon Berndt
|
|
|
|
Date started: 12/2/98
|
1999-12-20 20:25:13 +00:00
|
|
|
|
|
|
|
------------- Copyright (C) 1999 Jon S. Berndt (jsb@hal-pc.org) -------------
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it under
|
|
|
|
the terms of the GNU General Public License as published by the Free Software
|
|
|
|
Foundation; either version 2 of the License, or (at your option) any later
|
|
|
|
version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
|
|
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
|
|
details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License along with
|
|
|
|
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
|
|
|
Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
|
|
|
Further information about the GNU General Public License can also be found on
|
|
|
|
the world wide web at http://www.gnu.org.
|
|
|
|
|
|
|
|
HISTORY
|
|
|
|
--------------------------------------------------------------------------------
|
2006-01-12 15:04:22 +00:00
|
|
|
12/02/98 JSB Created
|
1999-12-20 20:25:13 +00:00
|
|
|
|
2000-11-03 23:02:47 +00:00
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
1999-12-20 20:25:13 +00:00
|
|
|
SENTRY
|
2000-11-03 23:02:47 +00:00
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
1999-12-20 20:25:13 +00:00
|
|
|
|
2006-01-12 15:04:22 +00:00
|
|
|
#ifndef FGINPUT_H
|
|
|
|
#define FGINPUT_H
|
1999-12-20 20:25:13 +00:00
|
|
|
|
2000-11-03 23:02:47 +00:00
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
1999-12-20 20:25:13 +00:00
|
|
|
INCLUDES
|
2000-11-03 23:02:47 +00:00
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
1999-12-20 20:25:13 +00:00
|
|
|
|
2006-01-12 15:04:22 +00:00
|
|
|
#include "FGModel.h"
|
1999-12-20 20:25:13 +00:00
|
|
|
|
|
|
|
#ifdef FGFS
|
2000-02-15 03:30:01 +00:00
|
|
|
# include <simgear/compiler.h>
|
2001-06-05 20:58:48 +00:00
|
|
|
# include STL_IOSTREAM
|
|
|
|
# include STL_FSTREAM
|
1999-12-20 20:25:13 +00:00
|
|
|
#else
|
2004-01-14 22:09:39 +00:00
|
|
|
# if defined(sgi) && !defined(__GNUC__) && (_COMPILER_VERSION < 740)
|
2001-10-05 20:19:59 +00:00
|
|
|
# include <iostream.h>
|
|
|
|
# include <fstream.h>
|
|
|
|
# else
|
|
|
|
# include <iostream>
|
|
|
|
# include <fstream>
|
|
|
|
# endif
|
1999-12-20 20:25:13 +00:00
|
|
|
#endif
|
|
|
|
|
2006-01-12 15:04:22 +00:00
|
|
|
#include <input_output/FGfdmSocket.h>
|
|
|
|
#include <input_output/FGXMLElement.h>
|
1999-12-20 20:25:13 +00:00
|
|
|
|
2000-11-03 23:02:47 +00:00
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
1999-12-20 20:25:13 +00:00
|
|
|
DEFINITIONS
|
2000-11-03 23:02:47 +00:00
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
1999-12-20 20:25:13 +00:00
|
|
|
|
2006-01-12 15:04:22 +00:00
|
|
|
#define ID_INPUT "$Id$"
|
2000-10-14 02:10:10 +00:00
|
|
|
|
2004-01-14 22:09:39 +00:00
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
FORWARD DECLARATIONS
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
|
|
|
|
2003-06-03 08:46:15 +00:00
|
|
|
namespace JSBSim {
|
|
|
|
|
2004-01-14 22:09:39 +00:00
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
CLASS DOCUMENTATION
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
|
|
|
|
2006-01-12 15:04:22 +00:00
|
|
|
/** Handles simulation input.
|
|
|
|
*/
|
2004-01-14 22:09:39 +00:00
|
|
|
|
2000-11-03 23:02:47 +00:00
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
1999-12-20 20:25:13 +00:00
|
|
|
CLASS DECLARATION
|
2000-11-03 23:02:47 +00:00
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
1999-12-20 20:25:13 +00:00
|
|
|
|
2006-01-12 15:04:22 +00:00
|
|
|
class FGInput : public FGModel
|
2001-10-05 20:19:59 +00:00
|
|
|
{
|
1999-12-20 20:25:13 +00:00
|
|
|
public:
|
2006-01-12 15:04:22 +00:00
|
|
|
FGInput(FGFDMExec*);
|
|
|
|
~FGInput();
|
|
|
|
|
|
|
|
bool Run(void);
|
|
|
|
|
|
|
|
void SetType(string);
|
|
|
|
inline void Enable(void) { enabled = true; }
|
|
|
|
inline void Disable(void) { enabled = false; }
|
|
|
|
inline bool Toggle(void) {enabled = !enabled; return enabled;}
|
|
|
|
bool Load(Element* el);
|
1999-12-20 20:25:13 +00:00
|
|
|
|
|
|
|
private:
|
2006-01-12 15:04:22 +00:00
|
|
|
bool sFirstPass, dFirstPass, enabled;
|
|
|
|
unsigned int port;
|
|
|
|
FGfdmSocket* socket;
|
|
|
|
string data;
|
2001-12-24 13:54:55 +00:00
|
|
|
void Debug(int from);
|
1999-12-20 20:25:13 +00:00
|
|
|
};
|
2003-01-24 12:55:28 +00:00
|
|
|
}
|
2006-01-12 15:04:22 +00:00
|
|
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
2000-02-15 03:30:01 +00:00
|
|
|
#endif
|
2006-01-12 15:04:22 +00:00
|
|
|
|