hla: remove the now unused HLAPropertyReference{,Set}.
This commit is contained in:
parent
2e13c1fa4b
commit
92976b7735
@ -198,17 +198,6 @@ protected:
|
||||
const SGPropertyNode& _propertyNode;
|
||||
};
|
||||
|
||||
HLAPropertyDataElement::HLAPropertyDataElement(HLAPropertyReference* propertyReference) :
|
||||
_propertyReference(propertyReference)
|
||||
{
|
||||
}
|
||||
|
||||
HLAPropertyDataElement::HLAPropertyDataElement(const HLADataType* dataType, HLAPropertyReference* propertyReference) :
|
||||
_dataType(dataType),
|
||||
_propertyReference(propertyReference)
|
||||
{
|
||||
}
|
||||
|
||||
HLAPropertyDataElement::HLAPropertyDataElement()
|
||||
{
|
||||
}
|
||||
@ -224,6 +213,11 @@ HLAPropertyDataElement::HLAPropertyDataElement(const HLADataType* dataType, SGPr
|
||||
setPropertyNode(propertyNode);
|
||||
}
|
||||
|
||||
HLAPropertyDataElement::HLAPropertyDataElement(const HLADataType* dataType) :
|
||||
_dataType(dataType)
|
||||
{
|
||||
}
|
||||
|
||||
HLAPropertyDataElement::~HLAPropertyDataElement()
|
||||
{
|
||||
}
|
||||
@ -284,24 +278,19 @@ HLAPropertyDataElement::setDataType(const HLADataType* dataType)
|
||||
void
|
||||
HLAPropertyDataElement::setPropertyNode(SGPropertyNode* propertyNode)
|
||||
{
|
||||
_propertyReference = new HLAPropertyReference;
|
||||
_propertyReference->setRootNode(propertyNode);
|
||||
_propertyNode = propertyNode;
|
||||
}
|
||||
|
||||
SGPropertyNode*
|
||||
HLAPropertyDataElement::getPropertyNode()
|
||||
{
|
||||
if (!_propertyReference.valid())
|
||||
return 0;
|
||||
return _propertyReference->getPropertyNode();
|
||||
return _propertyNode.get();
|
||||
}
|
||||
|
||||
const SGPropertyNode*
|
||||
HLAPropertyDataElement::getPropertyNode() const
|
||||
{
|
||||
if (!_propertyReference.valid())
|
||||
return 0;
|
||||
return _propertyReference->getPropertyNode();
|
||||
return _propertyNode.get();
|
||||
}
|
||||
|
||||
} // namespace simgear
|
||||
|
@ -18,77 +18,17 @@
|
||||
#ifndef HLAPropertyDataElement_hxx
|
||||
#define HLAPropertyDataElement_hxx
|
||||
|
||||
#include <set>
|
||||
#include <simgear/props/props.hxx>
|
||||
#include "HLADataElement.hxx"
|
||||
|
||||
namespace simgear {
|
||||
|
||||
class HLAPropertyReference : public SGReferenced {
|
||||
public:
|
||||
HLAPropertyReference()
|
||||
{ }
|
||||
HLAPropertyReference(const std::string& relativePath) :
|
||||
_relativePath(relativePath)
|
||||
{ }
|
||||
|
||||
SGPropertyNode* getPropertyNode()
|
||||
{ return _propertyNode.get(); }
|
||||
|
||||
void setRootNode(SGPropertyNode* rootNode)
|
||||
{
|
||||
if (!rootNode)
|
||||
_propertyNode.clear();
|
||||
else
|
||||
_propertyNode = rootNode->getNode(_relativePath, true);
|
||||
}
|
||||
|
||||
private:
|
||||
std::string _relativePath;
|
||||
SGSharedPtr<SGPropertyNode> _propertyNode;
|
||||
};
|
||||
|
||||
class HLAPropertyReferenceSet : public SGReferenced {
|
||||
public:
|
||||
void insert(const SGSharedPtr<HLAPropertyReference>& propertyReference)
|
||||
{
|
||||
_propertyReferenceSet.insert(propertyReference);
|
||||
propertyReference->setRootNode(_rootNode.get());
|
||||
}
|
||||
void remove(const SGSharedPtr<HLAPropertyReference>& propertyReference)
|
||||
{
|
||||
PropertyReferenceSet::iterator i = _propertyReferenceSet.find(propertyReference);
|
||||
if (i == _propertyReferenceSet.end())
|
||||
return;
|
||||
_propertyReferenceSet.erase(i);
|
||||
propertyReference->setRootNode(0);
|
||||
}
|
||||
|
||||
void setRootNode(SGPropertyNode* rootNode)
|
||||
{
|
||||
_rootNode = rootNode;
|
||||
for (PropertyReferenceSet::iterator i = _propertyReferenceSet.begin();
|
||||
i != _propertyReferenceSet.end(); ++i) {
|
||||
(*i)->setRootNode(_rootNode.get());
|
||||
}
|
||||
}
|
||||
SGPropertyNode* getRootNode()
|
||||
{ return _rootNode.get(); }
|
||||
|
||||
private:
|
||||
SGSharedPtr<SGPropertyNode> _rootNode;
|
||||
|
||||
typedef std::set<SGSharedPtr<HLAPropertyReference> > PropertyReferenceSet;
|
||||
PropertyReferenceSet _propertyReferenceSet;
|
||||
};
|
||||
|
||||
class HLAPropertyDataElement : public HLADataElement {
|
||||
public:
|
||||
HLAPropertyDataElement(HLAPropertyReference* propertyReference);
|
||||
HLAPropertyDataElement(const HLADataType* dataType, HLAPropertyReference* propertyReference);
|
||||
HLAPropertyDataElement();
|
||||
HLAPropertyDataElement(SGPropertyNode* propertyNode);
|
||||
HLAPropertyDataElement(const HLADataType* dataType, SGPropertyNode* propertyNode);
|
||||
HLAPropertyDataElement(const HLADataType* dataType);
|
||||
virtual ~HLAPropertyDataElement();
|
||||
|
||||
virtual bool encode(HLAEncodeStream& stream) const;
|
||||
@ -106,7 +46,7 @@ private:
|
||||
class EncodeVisitor;
|
||||
|
||||
SGSharedPtr<const HLADataType> _dataType;
|
||||
SGSharedPtr<HLAPropertyReference> _propertyReference;
|
||||
SGSharedPtr<SGPropertyNode> _propertyNode;
|
||||
};
|
||||
|
||||
} // namespace simgear
|
||||
|
Loading…
Reference in New Issue
Block a user