00001 00025 #ifndef _PREDICATE_H_ 00026 #define _PREDICATE_H_ 00027 00028 #include <string> 00029 #include <map> 00030 00031 #include <boost/shared_ptr.hpp> 00032 #include <boost/function.hpp> 00033 00034 #include <predicate_manager/common_defs.h> 00035 #include <predicate_manager/predicate_dependent_entity.h> 00036 00037 #define MAX_CYCLIC_UPDATES 100 00038 00039 namespace predicate_manager 00040 { 00047 class Predicate : public PredicateDependentEntity 00048 { 00049 public: 00057 Predicate ( const std::string& name, 00058 const Dependencies& deps, 00059 bool initial_value = false ); 00060 00066 Predicate ( const std::string& name, 00067 bool initial_value = false ); 00068 00070 std::string getName(); 00071 00073 bool getValue(); 00074 00076 std::string setName ( const std::string& new_name ); 00077 00082 void setTrigger ( const boost::function<void ( bool ) > trigger ); 00083 00084 protected: 00086 void setValue ( bool val ); 00087 00088 private: 00089 std::string name_; 00090 bool value_; 00091 00096 uint8_t requested_updates_; 00101 boost::function<void ( bool ) > trigger_; 00102 }; 00103 } 00104 00105 #endif