From 92976b7735635e60843a688a86e75a5707f35b98 Mon Sep 17 00:00:00 2001 From: Mathias Froehlich Date: Mon, 3 Oct 2011 13:11:27 +0200 Subject: [PATCH] hla: remove the now unused HLAPropertyReference{,Set}. --- simgear/hla/HLAPropertyDataElement.cxx | 27 ++++------- simgear/hla/HLAPropertyDataElement.hxx | 64 +------------------------- 2 files changed, 10 insertions(+), 81 deletions(-) diff --git a/simgear/hla/HLAPropertyDataElement.cxx b/simgear/hla/HLAPropertyDataElement.cxx index 9b05da43..121eddda 100644 --- a/simgear/hla/HLAPropertyDataElement.cxx +++ b/simgear/hla/HLAPropertyDataElement.cxx @@ -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 diff --git a/simgear/hla/HLAPropertyDataElement.hxx b/simgear/hla/HLAPropertyDataElement.hxx index 51d1729b..076d85ba 100644 --- a/simgear/hla/HLAPropertyDataElement.hxx +++ b/simgear/hla/HLAPropertyDataElement.hxx @@ -18,77 +18,17 @@ #ifndef HLAPropertyDataElement_hxx #define HLAPropertyDataElement_hxx -#include #include #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 _propertyNode; -}; - -class HLAPropertyReferenceSet : public SGReferenced { -public: - void insert(const SGSharedPtr& propertyReference) - { - _propertyReferenceSet.insert(propertyReference); - propertyReference->setRootNode(_rootNode.get()); - } - void remove(const SGSharedPtr& 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 _rootNode; - - typedef std::set > 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 _dataType; - SGSharedPtr _propertyReference; + SGSharedPtr _propertyNode; }; } // namespace simgear -- 2.39.5