- for(int i = 0; i<llen; i++)
- retlist.push_back( (Cpu*)(lmm_constraint_id( lmm_get_cnst_from_var(sys, getVariable(), i) )) );
+void CpuAction::resume(){
+ Action::State previous = get_state();
+ on_state_change(this, previous);
+ Action::resume();
+}
+
+void CpuAction::set_state(Action::State state)
+{
+ Action::State previous = get_state();
+ Action::set_state(state);
+ on_state_change(this, previous);
+}
+
+/** @brief returns a list of all CPUs that this action is using */
+std::list<Cpu*> CpuAction::cpus() const
+{
+ std::list<Cpu*> retlist;
+ int llen = get_variable()->get_number_of_constraint();
+
+ for (int i = 0; i < llen; i++) {
+ /* Beware of composite actions: ptasks put links and cpus together */
+ // extra pb: we cannot dynamic_cast from void*...
+ kernel::resource::Resource* resource =
+ static_cast<kernel::resource::Resource*>(get_variable()->get_constraint(i)->get_id());
+ Cpu* cpu = dynamic_cast<Cpu*>(resource);
+ if (cpu != nullptr)
+ retlist.push_back(cpu);
+ }