40#include "FGUDPInputSocket.h"
42#include "FGXMLElement.h"
43#include "string_utilities.h"
58 SockProtocol = FGfdmSocket::ptUDP;
73 while (property_element) {
74 string property_str = property_element->
GetDataLine();
78 log << LogFormat::RED << LogFormat::BOLD <<
"\n No property by the name "
79 << property_str <<
" can be found.\n" << LogFormat::RESET;
81 InputProperties.push_back(node);
93 if (socket == 0)
return;
99 vector<string> tokens;
100 stringstream ss(data);
102 while (getline(ss, temp,
',')) {
103 tokens.push_back(temp);
106 vector<double> values;
109 for (
string& token : tokens)
110 values.push_back(atof_locale_c(token));
113 log << e.what() <<
"\n";
117 if (values[0] < oldTimeStamp) {
120 oldTimeStamp = values[0];
124 if ((values.size() - 1) != InputProperties.size()) {
126 log <<
"\nMismatch between UDP input property and value counts.\n";
130 for (
unsigned int i=1; i<values.size(); i++) {
131 InputProperties[i-1]->setDoubleValue(values[i]);
Element * FindElement(const std::string &el="")
Searches for a specified element.
std::string GetAttributeValue(const std::string &key)
Retrieves an attribute.
std::string GetDataLine(unsigned int i=0)
Gets a line of data belonging to an element.
Element * FindNextElement(const std::string &el="")
Searches for the next element as specified.
Encapsulates the JSBSim simulation executive.
double GetDeltaT(void) const
Returns the simulation delta T.
void SetRate(unsigned int tt)
Set the ouput rate for the model in frames.
std::string Receive(void)
Receive data from the socket connection.
A node in a property tree.
Main namespace for the JSBSim Flight Dynamics Model.