vrecko
virtual reality framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Ability.h
Go to the documentation of this file.
1 
12 #ifndef ABILITY_H
13 #define ABILITY_H
14 
15 #include <osg/Vec3>
16 
17 #include <vector>
18 
19 #include <vrecko/BaseClass.h>
20 
21 #include <vrecko/Message.h>
22 #include <vrecko/Scheduler.h>
23 
24 #include <vrecko/MTLock.h>
25 
26 
27 //#include <xercesc/parsers/AbstractDOMParser.hpp>
28 //--------------------
29 
30 namespace vrecko {
31 
32 
33 class VRECKO_EXPORT EnvironmentObject;
34 class VRECKO_EXPORT World;
35 
37 class VRECKO_EXPORT Ability: public BaseClass {
38  protected:
39 // Ability() { pOwner = NULL; }; // no default constructor -> force to create Ability with a name
40 
58  Ability(const char* theAbilityName);
59 
60  //Ability(const char* abName, const char *plName) {abilityName = abName; pluginName = plName;}
62  public:
63  virtual ~Ability();
64 
70  const std::string &getName() const {return abilityName;}
79  void setPluginName(const char *pName);
80 
82  const std::string &getPluginName(void) const {return pluginName;}
83 
94  const std::string &getID(void) const {return abilityID;}
95 
112  void setID(const char *pID);
113 
114  virtual void clean(void) {};
115 
125  void setOwner(BaseClass *owner) { pOwner = owner;}
126 
135  BaseClass *getOwner(void) {return pOwner;}
136 
138 // virtual std::string getAcceptableMessages(void) {return std::string("");}
139 
140  // VYHODIT -----------------------------------
142  typedef struct {
143  std::string name;
144  std::string description;
145 // IO_Type type;
146  std::string range;
147  } ParameterStruct;
148 
150  typedef std::vector<ParameterStruct> ParameterVector;
151 
153  virtual ParameterVector *getParameterVector(void) {return NULL;}
154  // VYHODIT -----------------------------------
155 
157 // void setUpdateFlag(bool state) {updated = state;}
158 
160 
165  bool isUpdated(void);
166 
167 
168 
176  virtual const std::string &getSenderString(void);
177 
178  protected:
181 
184  std::vector<std::string> parameterString;
186 
188  bool updated;
189 
190  private:
192  std::string pluginName;
193 
196  std::string abilityName;
197 
201  std::string abilityID;
202 
203  // last parent's senderString
204  std::string lastParentSenderString;
205 };
206 
207 
222  public:
225 
228  void addAbility(Ability *pAbility);
230  void removeAbility(Ability *pAbility);
231  void removeAllAbilities();
233  Ability *getAbility(const std::string &ab_id);
235  typedef std::map<std::string, Ability*> AbilityMap;
237 
238 // Ability *getAppropriateAbility(const std::string &message_ID);
239  Ability *getAbilityWithInput(const std::string &input_name);
240  Ability *getAbilityWithOutput(const std::string &output_name);
241 
242  protected:
243 
245  std::map<std::string, Ability*> ability_map;
248 
250 };
251 
252 }
253 
254 
255 #endif