00001 00010 #ifndef __SGBINDING_HXX 00011 #define __SGBINDING_HXX 00012 00013 00014 #include <simgear/compiler.h> 00015 00016 #include <string> 00017 #include <map> 00018 #include <vector> 00019 00020 #include <simgear/props/props.hxx> 00021 #include <simgear/props/condition.hxx> 00022 00023 #include "commands.hxx" 00024 00032 class SGBinding : public SGConditional 00033 { 00034 public: 00035 00039 SGBinding (); 00040 00041 00047 SGBinding (const SGPropertyNode * node, SGPropertyNode* root); 00048 00049 00053 virtual ~SGBinding (); 00054 00055 00061 const string &getCommandName () const { return _command_name; } 00062 00063 00070 SGCommandMgr::command_t getCommand () const { return _command; } 00071 00072 00079 const SGPropertyNode * getArg () { return _arg; } 00080 00081 00087 void read (const SGPropertyNode * node, SGPropertyNode* root); 00088 00089 00093 void fire () const; 00094 00095 00099 void fire (double offset, double max) const; 00100 00101 00109 void fire (double setting) const; 00110 00111 00112 private: 00113 // just to be safe. 00114 SGBinding (const SGBinding &binding); 00115 00116 std::string _command_name; 00117 mutable SGCommandMgr::command_t _command; 00118 mutable SGPropertyNode_ptr _arg; 00119 mutable SGPropertyNode_ptr _setting; 00120 }; 00121 00122 typedef std::vector<SGSharedPtr<SGBinding> > SGBindingList; 00123 typedef std::map<unsigned,SGBindingList> SGBindingMap; 00124 00125 #endif