@@ -32,30 +32,32 @@ namespace dynamicgraph { namespace sot {
32
32
using ::dynamicgraph::command::Command;
33
33
using ::dynamicgraph::command::Value;
34
34
35
- // Command AddFeature
36
- class AddFeature : public Command
35
+ // Command ListFeatures
36
+ class ListFeatures : public Command
37
37
{
38
38
public:
39
- virtual ~AddFeature () {}
39
+ virtual ~ListFeatures () {}
40
40
// / Create command and store it in Entity
41
41
// / \param entity instance of Entity owning this command
42
42
// / \param docstring documentation of the command
43
- AddFeature (Task& entity, const std::string& docstring) :
44
- Command (entity, boost::assign::list_of( Value::STRING ), docstring)
43
+ ListFeatures (Task& entity, const std::string& docstring) :
44
+ Command (entity, std::vector< Value::Type> ( ), docstring)
45
45
{
46
46
}
47
47
virtual Value doExecute ()
48
48
{
49
- Task& task = static_cast <Task&>(owner ());
50
- std::vector<Value> values = getParameterValues ();
51
- std::string featureName = values[0 ].value ();
52
- FeatureAbstract& feature =
53
- PoolStorage::getInstance ()->getFeature (featureName);
54
- task.addFeature (feature);
55
- // return void
56
- return Value ();
49
+ typedef Task::FeatureList_t FeatureList_t;
50
+ Task& task = static_cast <Task&>(owner ());
51
+ const FeatureList_t& fl = task.getFeatureList ();
52
+ std::string result (" [" );
53
+ for (FeatureList_t::const_iterator it = fl.begin ();
54
+ it != fl.end (); it++) {
55
+ result += " '" + (*it)->getName () + " '," ;
56
+ }
57
+ result += " ]" ;
58
+ return Value (result);
57
59
}
58
- }; // class AddFeature
60
+ }; // class ListFeatures
59
61
} // namespace task
60
62
} // namespace command
61
63
} /* namespace sot */ } /* namespace dynamicgraph */
0 commit comments