]> git.mxchange.org Git - simgear.git/blobdiff - simgear/structure/SGBinding.hxx
Fix #1783: repeated error message on console
[simgear.git] / simgear / structure / SGBinding.hxx
index 026da27078ac6af765c7105109fba62ef130fa3a..ef573a014b01e36b9732ed72b6a0900a29bdd558 100644 (file)
@@ -41,7 +41,7 @@ public:
     /**
      * Convenience constructor.
      *
-     * @param node The binding will be built from this node.
+     * @param commandName TODO
      */
     SGBinding(const std::string& commandName);
 
@@ -49,8 +49,10 @@ public:
    * Convenience constructor.
    *
    * @param node The binding will be built from this node.
+   * @param root Property root used while building binding.
    */
-  SGBinding (const SGPropertyNode * node, SGPropertyNode* root);
+  SGBinding( const SGPropertyNode *node,
+             SGPropertyNode *root );
 
 
   /**
@@ -58,6 +60,14 @@ public:
    */
   virtual ~SGBinding ();
 
+  
+  /**
+   * clear internal state of the binding back to empty. This is useful
+   * if you don't want the 'remove on delete' behaviour of the 
+   * destructor.
+   */
+  void clear();
+
 
   /**
    * Get the command name.
@@ -73,7 +83,7 @@ public:
    * @return The command associated with this binding, or 0 if none
    * is present.
    */
-  SGCommandMgr::command_t getCommand () const { return _command; }
+  SGCommandMgr::Command* getCommand () const { return _command; }
 
 
   /**
@@ -89,6 +99,8 @@ public:
    * Read a binding from a property node.
    *
    * @param node The property node containing the binding.
+   * @param root The property root node used while building the binding from
+   *             \a node.
    */
   void read (const SGPropertyNode * node, SGPropertyNode* root);
 
@@ -114,13 +126,20 @@ public:
    */
   void fire (double setting) const;
 
-
+  /**
+   * Fire a binding with a number of additional parameters
+   * 
+   * The children of params will be merged with the fixed arguments.
+   */
+  void fire (SGPropertyNode* params) const;
+  
 private:
+  void innerFire() const;
                                 // just to be safe.
   SGBinding (const SGBinding &binding);
 
   std::string _command_name;
-  mutable SGCommandMgr::command_t _command;
+  mutable SGCommandMgr::Command* _command;
   mutable SGPropertyNode_ptr _arg;
   mutable SGPropertyNode_ptr _setting;
 };
@@ -134,7 +153,7 @@ typedef std::map<unsigned,SGBindingList> SGBindingMap;
  * fire every binding in a list, in sequence
  
  */
-void fireBindingList(const SGBindingList& aBindings);
+void fireBindingList(const SGBindingList& aBindings, SGPropertyNode* params = NULL);
 
 /**
  * fire every binding in a list with a setting value
@@ -147,4 +166,9 @@ void fireBindingListWithOffset(const SGBindingList& aBindings, double offset, do
  */
 SGBindingList readBindingList(const simgear::PropertyList& aNodes, SGPropertyNode* aRoot);
 
+/**
+ * call clear() on every binding in a list
+ */
+void clearBindingList(const SGBindingList& aBindings);
+
 #endif