Пример #1
0
//do all the tasks from a file
void Executor::ExecuteFile(std::string name)
{
   ResourceManager resources; //init resource manager
   TaskManager tasks; //init task manager
   tasks.FromFile(name); //parsem file
   tasks.SortTasks(); //do topological sort
   Task* temp;
   while((temp=tasks.GetTask())!=NULL)
   {
   	//find and execute appropriate action
   	std::map<std::string,executive>::iterator found=functions.find(temp->type);
   	if(found==functions.end())
   		Log::AddMessage("Unsupported task: "+temp->type,Log::ERR);
   	Log::AddMessage("Task "+temp->name+" started...",Log::LOW); 
   	(*found).second(resources,temp);
   	Log::AddMessage("Task "+temp->name+" finished",Log::LOW); 
   }
}