Skip to content

Commit

Permalink
SGPropertyNode::getName() has been removed from official SimGear.
Browse files Browse the repository at this point in the history
The SimGear project advises to use `SGPropertyNode::getNameString()` instead. JSBSim uses a simplified version of `SGPropertyNode` so the method `getName` has been removed to mimick the new official SimGear API.
  • Loading branch information
bcoconni committed Feb 1, 2022
1 parent 05c0b17 commit 8852bf5
Show file tree
Hide file tree
Showing 13 changed files with 16 additions and 29 deletions.
2 changes: 1 addition & 1 deletion src/FGFDMExec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,7 @@ void FGFDMExec::BuildPropertyCatalog(struct PropertyCatalogStructure* pcs)

for (int i=0; i<pcs->node->nChildren(); i++) {
string access="";
pcsNew->base_string = pcs->base_string + "/" + pcs->node->getChild(i)->getName();
pcsNew->base_string = pcs->base_string + "/" + pcs->node->getChild(i)->getNameString();
int node_idx = pcs->node->getChild(i)->getIndex();
if (node_idx != 0) {
pcsNew->base_string = CreateIndexedPropertyName(pcsNew->base_string, node_idx);
Expand Down
11 changes: 2 additions & 9 deletions src/input_output/FGPropertyManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,16 +111,9 @@ bool FGPropertyNode::HasNode (const string &path)

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

string FGPropertyNode::GetName( void ) const
{
return string( getName() );
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

string FGPropertyNode::GetPrintableName( void ) const
{
string temp_string(getName());
string temp_string(getNameString());
size_t initial_location=0;
size_t found_location;

Expand Down Expand Up @@ -317,7 +310,7 @@ void FGPropertyManager::Untie(const string &name)

void FGPropertyManager::Untie(SGPropertyNode *property)
{
const char *name = property->getName();
const string& name = property->getNameString();

assert(property->isTied());

Expand Down
2 changes: 1 addition & 1 deletion src/input_output/FGPropertyManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class FGPropertyNode : public SGPropertyNode
/**
* Get the name of a node
*/
std::string GetName( void ) const;
const std::string& GetName( void ) const { return getNameString(); }

/**
* Get the name of a node without underscores, etc.
Expand Down
2 changes: 1 addition & 1 deletion src/models/flight_control/FGDeadBand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ void FGDeadBand::Debug(int from)
cout << " GAIN: " << gain << endl;

for (auto node: OutputNodes)
cout << " OUTPUT: " << node->getName() << endl;
cout << " OUTPUT: " << node->getNameString() << endl;
}
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
Expand Down
2 changes: 1 addition & 1 deletion src/models/flight_control/FGFCSFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ void FGFCSFunction::Debug(int from)
if (!InputNodes.empty())
cout << " INPUT: " << InputNodes[0]->GetName() << endl;
for (auto node: OutputNodes)
cout << " OUTPUT: " << node->getName() << endl;
cout << " OUTPUT: " << node->getNameString() << endl;
}
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
Expand Down
2 changes: 1 addition & 1 deletion src/models/flight_control/FGFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ void FGFilter::Debug(int from)
}

for (auto node: OutputNodes)
cout << " OUTPUT: " << node->getName() << endl;
cout << " OUTPUT: " << node->getNameString() << endl;
}
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
Expand Down
2 changes: 1 addition & 1 deletion src/models/flight_control/FGGain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ void FGGain::Debug(int from)
cout << " GAIN: " << Gain->GetName() << endl;

for (auto node: OutputNodes)
cout << " OUTPUT: " << node->getName() << endl;
cout << " OUTPUT: " << node->getNameString() << endl;

if (Type == "AEROSURFACE_SCALE") {
cout << " In/Out Mapping:" << endl;
Expand Down
2 changes: 1 addition & 1 deletion src/models/flight_control/FGKinemat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ void FGKinemat::Debug(int from)
cout << " " << Detents[i] << " " << TransitionTimes[i] << endl;
}
for (auto node: OutputNodes)
cout << " OUTPUT: " << node->getName() << endl;
cout << " OUTPUT: " << node->getNameString() << endl;
if (!DoScale) cout << " NOSCALE" << endl;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/models/flight_control/FGPID.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ void FGPID::Debug(int from)
cout << " INPUT: " << InputNodes[0]->GetNameWithSign() << endl;

for (auto node: OutputNodes)
cout << " OUTPUT: " << node->getName() << endl;
cout << " OUTPUT: " << node->getNameString() << endl;
}
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
Expand Down
2 changes: 1 addition & 1 deletion src/models/flight_control/FGSensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ void FGSensor::Debug(int from)
}
}
for (auto node: OutputNodes)
cout << " OUTPUT: " << node->getName() << endl;
cout << " OUTPUT: " << node->getNameString() << endl;
}
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
Expand Down
2 changes: 1 addition & 1 deletion src/models/flight_control/FGSwitch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ void FGSwitch::Debug(int from)
++i;
}
for (auto node: OutputNodes)
cout << " OUTPUT: " << node->getName() << endl;
cout << " OUTPUT: " << node->getNameString() << endl;
}
}
if (debug_lvl & 2 ) { // Instantiation/Destruction notification
Expand Down
8 changes: 4 additions & 4 deletions src/simgear/props/props.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ find_child (Itr begin, Itr end, int index, const PropertyList& nodes)
#if PROPS_STANDALONE
for (size_t i = 0; i < nNodes; i++) {
SGPropertyNode * node = nodes[i];
if (node->getIndex() == index && compare_strings(node->getName(), begin))
if (node->getIndex() == index && compare_strings(node->getNameString().c_str(), begin))
return i;
}
#else
Expand Down Expand Up @@ -356,7 +356,7 @@ find_last_child (const char * name, const PropertyList& nodes)

for (size_t i = 0; i < nNodes; i++) {
SGPropertyNode * node = nodes[i];
if (compare_strings(node->getName(), name))
if (compare_strings(node->getNameString().c_str(), name))
{
int idx = node->getIndex();
if (idx > index) index = idx;
Expand Down Expand Up @@ -1186,7 +1186,7 @@ SGPropertyNode::getChildren (const char * name) const
size_t max = _children.size();

for (size_t i = 0; i < max; i++)
if (compare_strings(_children[i]->getName(), name))
if (compare_strings(_children[i]->getNameString().c_str(), name))
children.push_back(_children[i]);

sort(children.begin(), children.end(), CompareIndices());
Expand Down Expand Up @@ -1241,7 +1241,7 @@ SGPropertyNode::removeChildren(const char * name)
PropertyList children;

for (int pos = static_cast<int>(_children.size() - 1); pos >= 0; pos--)
if (compare_strings(_children[pos]->getName(), name))
if (compare_strings(_children[pos]->getNameString().c_str(), name))
children.push_back(removeChild(pos));

sort(children.begin(), children.end(), CompareIndices());
Expand Down
6 changes: 0 additions & 6 deletions src/simgear/props/props.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -817,12 +817,6 @@ public:
*/
bool hasValue () const { return (_type != simgear::props::NONE); }


/**
* Get the node's simple (XML) name.
*/
const char * getName () const { return _name.c_str(); }

/**
* Get the node's simple name as a string.
*/
Expand Down

0 comments on commit 8852bf5

Please sign in to comment.