skill_wrapper.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef __PLUGINS_XABSL_SKILL_WRAPPER_H_
00024 #define __PLUGINS_XABSL_SKILL_WRAPPER_H_
00025
00026 #include <XabslEngine/XabslBasicBehavior.h>
00027
00028 #include <map>
00029 #include <list>
00030 #include <utility>
00031 #include <string>
00032
00033 class XabslSkillWrapper : public xabsl::BasicBehavior
00034 {
00035 public:
00036
00037
00038
00039
00040 typedef std::list<std::pair<std::string, std::string> > ParameterList;
00041
00042 XabslSkillWrapper(const char *name, xabsl::ErrorHandler &error_handler,
00043 ParameterList ¶ms);
00044 ~XabslSkillWrapper();
00045
00046 virtual void registerParameters();
00047 virtual void execute();
00048
00049 const char * name();
00050
00051 std::string skill_string();
00052
00053 private:
00054 bool __execute;
00055
00056 class ParameterValueBase
00057 {
00058 public:
00059 virtual ~ParameterValueBase() {}
00060 };
00061
00062 template <typename T>
00063 class ParameterValue : public ParameterValueBase
00064 {
00065 public:
00066 ParameterValue()
00067 {
00068 __value = 0;
00069 }
00070
00071 T get_value() const
00072 {
00073 return __value;
00074 }
00075
00076 T * get_value_ptr()
00077 {
00078 return &__value;
00079 }
00080
00081 void set_value(T value)
00082 {
00083 __value = value;
00084 }
00085 private:
00086 T __value;
00087 };
00088
00089 std::map<std::string, ParameterValueBase *> __param_values;
00090 ParameterList __params;
00091 };
00092
00093
00094 #endif