00001 /* 00002 * BehaviorContainer.hpp 00003 * 00004 * Created on: Nov 3, 2011 00005 * Author: mriedel 00006 */ 00007 00008 #ifndef BEHAVIORCONTAINER_HPP_ 00009 #define BEHAVIORCONTAINER_HPP_ 00010 00011 #include <telekyb_defines/telekyb_defines.hpp> 00012 00013 #include <tk_behavior/Behavior.hpp> 00014 #include <pluginlib/class_loader.h> 00015 00016 //#include <tk_behavior/BehaviorContainerOptions.hpp> 00017 00018 // stl 00019 #include <set> 00020 #include <string> 00021 00022 00023 namespace TELEKYB_NAMESPACE { 00024 00025 class BehaviorContainer { 00026 protected: 00027 // Options 00028 //BehaviorContainerOptions options; 00029 00030 // static ClassLoader, available to all Containers 00031 pluginlib::ClassLoader<Behavior> behaviorLoader; 00032 // Behaviorset. Contains all loaded Behaviors from all Containers! 00033 static std::set<Behavior*> globalBehaviorInstances; 00034 00035 std::set<Behavior*> behaviorInstances; // beware there can be several Instances of the same behavior 00036 00037 public: 00038 BehaviorContainer(); 00039 virtual ~BehaviorContainer(); 00040 00041 // should be const, but getDeclaredClasses is declared wrongly. 00042 void getAvailableBehaviors(std::vector<std::string>& behaviorClassNames); 00043 00044 // returns 0 if fails 00045 Behavior* loadBehavior(const std::string& behaviorClassName); 00046 bool unloadBehavior(Behavior* b); 00047 00048 static bool behaviorInstanceExists(Behavior* instance); 00049 }; 00050 00051 } 00052 00053 #endif /* BEHAVIORCONTAINER_HPP_ */