]> git.mxchange.org Git - simgear.git/blobdiff - simgear/props/condition.hxx
Merge branch 'fred/precip' into next
[simgear.git] / simgear / props / condition.hxx
index b314cc4ed017f3430219852d0d40ddb4b07834b7..c70e86d74d77ea356f041fb2b430df61d379d0ac 100644 (file)
@@ -13,6 +13,7 @@
 #include <simgear/debug/logstream.hxx>
 #include <simgear/props/props.hxx>
 #include <simgear/props/props_io.hxx>
+#include <simgear/structure/SGReferenced.hxx>
 
 \f
 ////////////////////////////////////////////////////////////////////////
@@ -28,7 +29,7 @@
  *
  * This class should migrate to somewhere more general.
  */
-class SGCondition
+class SGCondition : public SGReferenced
 {
 public:
   SGCondition ();
@@ -51,7 +52,7 @@ public:
   virtual ~SGPropertyCondition ();
   virtual bool test () const { return _node->getBoolValue(); }
 private:
-  const SGPropertyNode * _node;
+  SGConstPropertyNode_ptr _node;
 };
 
 
@@ -63,12 +64,11 @@ private:
 class SGNotCondition : public SGCondition
 {
 public:
-                               // transfer pointer ownership
   SGNotCondition (SGCondition * condition);
   virtual ~SGNotCondition ();
   virtual bool test () const;
 private:
-  SGCondition * _condition;
+  SGSharedPtr<SGCondition> _condition;
 };
 
 
@@ -87,7 +87,7 @@ public:
                                // transfer pointer ownership
   virtual void addCondition (SGCondition * condition);
 private:
-  vector<SGCondition *> _conditions;
+  std::vector<SGSharedPtr<SGCondition> > _conditions;
 };
 
 
@@ -106,7 +106,7 @@ public:
                                // transfer pointer ownership
   virtual void addCondition (SGCondition * condition);
 private:
-  vector<SGCondition *> _conditions;
+  std::vector<SGSharedPtr<SGCondition> > _conditions;
 };
 
 
@@ -133,9 +133,9 @@ public:
 private:
   Type _type;
   bool _reverse;
-  const SGPropertyNode * _left_property;
-  const SGPropertyNode * _right_property;
-  const SGPropertyNode * _right_value;
+  SGConstPropertyNode_ptr _left_property;
+  SGConstPropertyNode_ptr _right_property;
+  SGConstPropertyNode_ptr _right_value;
 };
 
 
@@ -146,7 +146,7 @@ private:
  * invoke the test() method whenever it needs to decide whether to
  * active itself, draw itself, and so on.
  */
-class SGConditional
+class SGConditional : public SGReferenced
 {
 public:
   SGConditional ();
@@ -156,7 +156,7 @@ public:
   virtual const SGCondition * getCondition () const { return _condition; }
   virtual bool test () const;
 private:
-  SGCondition * _condition;
+  SGSharedPtr<SGCondition> _condition;
 };