]> git.mxchange.org Git - simgear.git/commitdiff
hla: remove the now unused HLAPropertyReference{,Set}.
authorMathias Froehlich <Mathias.Froehlich@web.de>
Mon, 3 Oct 2011 11:11:27 +0000 (13:11 +0200)
committerMathias Froehlich <Mathias.Froehlich@web.de>
Mon, 3 Oct 2011 11:11:52 +0000 (13:11 +0200)
simgear/hla/HLAPropertyDataElement.cxx
simgear/hla/HLAPropertyDataElement.hxx

index 9b05da434e605b1102dfbade45f3fbbddbb1ea04..121edddab952eab6db7e047764487e816267b6ba 100644 (file)
@@ -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
index 51d1729b19b85f4a45b3bc0760d3b2e88e6783c8..076d85ba5ce5e5c0aad1c39e365583bbc8dc297f 100644 (file)
 #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