File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,33 @@ namespace dynamicgraph { namespace sot {
56
56
return Value ();
57
57
}
58
58
}; // class AddFeature
59
+
60
+ // Command ListFeatures
61
+ class ListFeatures : public Command
62
+ {
63
+ public:
64
+ virtual ~ListFeatures () {}
65
+ // / Create command and store it in Entity
66
+ // / \param entity instance of Entity owning this command
67
+ // / \param docstring documentation of the command
68
+ ListFeatures (Task& entity, const std::string& docstring) :
69
+ Command (entity, std::vector<Value::Type> (), docstring)
70
+ {
71
+ }
72
+ virtual Value doExecute ()
73
+ {
74
+ typedef Task::FeatureList_t FeatureList_t;
75
+ Task& task = static_cast <Task&>(owner ());
76
+ const FeatureList_t& fl = task.getFeatureList ();
77
+ std::string result (" [" );
78
+ for (FeatureList_t::const_iterator it = fl.begin ();
79
+ it != fl.end (); it++) {
80
+ result += " '" + (*it)->getName () + " '," ;
81
+ }
82
+ result += " ]" ;
83
+ return Value (result);
84
+ }
85
+ }; // class ListFeatures
59
86
} // namespace task
60
87
} // namespace command
61
88
} /* namespace sot */ } /* namespace dynamicgraph */
Original file line number Diff line number Diff line change @@ -106,6 +106,13 @@ void Task::initCommands( void )
106
106
107
107
addCommand (" clear" ,
108
108
makeCommandVoid0 (*this ,&Task::clearFeatureList, docstring));
109
+ // List features
110
+ docstring = " \n "
111
+ " Returns the list of features of the task\n "
112
+ " \n " ;
113
+
114
+ addCommand (" list" ,
115
+ new command::task::ListFeatures (*this , docstring));
109
116
}
110
117
111
118
You can’t perform that action at this time.
0 commit comments