mirror of
https://github.com/nasa/trick.git
synced 2024-12-22 22:42:26 +00:00
19025d77ad
Reorganized. Created a new top level include directory that will hold all of Trick's header files. Moved all of the Trick headers to this directory. Created a libexec directory that holds all of the executables that users don't need to execute directly. Changed all of the executables remaining in bin to start with "trick-". In the sim_services directories changed all source files to find the Trick headers in their new location. Since all of the include files are gone in sim_services, removed the src directories as well, moving all of the source files up a level. Moved the makefiles, docs, man, and other architecture independent files into a top level share directory. Renamed lib_${TRICK_HOST_CPU} to lib64 or lib depending on the platform we're currently on. refs #63
83 lines
3.8 KiB
C++
83 lines
3.8 KiB
C++
|
|
#include <iostream>
|
|
#include <math.h>
|
|
|
|
#include "trick/Executive.hh"
|
|
#include "trick/exec_proto.hh"
|
|
#include "trick/memorymanager_c_intf.h"
|
|
#include "trick/TrickConstant.hh"
|
|
|
|
/**
|
|
@details
|
|
*/
|
|
int Trick::Executive::remove_jobs( Trick::SimObject * in_sim_object ) {
|
|
|
|
/* erase jobs from the all_jobs map whose parent_object is this sim_object */
|
|
for ( std::multimap <std::string, Trick::JobData *>::iterator mit = all_jobs.begin() ; mit != all_jobs.end() ; ) {
|
|
if ( (*mit).second->parent_object == in_sim_object ) {
|
|
all_jobs.erase(mit++) ;
|
|
} else {
|
|
mit++ ;
|
|
}
|
|
}
|
|
|
|
/* erase all jobs from the all_jobs_vector whose parent_object is this sim_object */
|
|
for ( std::vector <Trick::JobData *>::iterator jit = all_jobs_vector.begin() ; jit != all_jobs_vector.end() ; ) {
|
|
if ( (*jit)->parent_object == in_sim_object ) {
|
|
jit = all_jobs_vector.erase(jit) ;
|
|
} else {
|
|
jit++ ;
|
|
}
|
|
}
|
|
|
|
/* erase all jobs from the all_tagged_jobs map whose parent_object is this sim_object */
|
|
for ( std::multimap< std::string, Trick::JobData * >::iterator mit = all_tagged_jobs.begin() ; mit != all_tagged_jobs.end() ; ) {
|
|
if ( (*mit).second->parent_object == in_sim_object ) {
|
|
all_tagged_jobs.erase(mit++) ;
|
|
} else {
|
|
mit++ ;
|
|
}
|
|
}
|
|
|
|
/* search the executive queues for the job and remove it if found */
|
|
for ( std::vector <Trick::JobData *>::iterator jit = in_sim_object->jobs.begin() ; jit != in_sim_object->jobs.end() ; jit++ ) {
|
|
std::map<std::string, int>::iterator class_id_it ;
|
|
std::map<int, Trick::ScheduledJobQueue *>::iterator queue_it ;
|
|
Trick::ScheduledJobQueue * curr_queue ;
|
|
if ( (class_id_it = class_map.find((*jit)->job_class_name)) != class_map.end() ) {
|
|
if ( (*jit)->thread != 0 ) {
|
|
/* Add threaded scheduled jobs to the thread scheduled queue */
|
|
if ( (*jit)->job_class >= scheduled_start_index ) {
|
|
threads[(*jit)->thread]->job_queue.remove((*jit)) ;
|
|
// Add all scheduled jobs to the scheduled_queue for use in the multi-threaded loop
|
|
scheduled_queue.remove((*jit)) ;
|
|
/* Threaded top_of_frame/end_of_frame jobs go to thread specific queues. */
|
|
} else if ( ! (*jit)->job_class_name.compare("top_of_frame")) {
|
|
threads[(*jit)->thread]->top_of_frame_queue.remove((*jit)) ;
|
|
} else if ( ! (*jit)->job_class_name.compare("end_of_frame")) {
|
|
threads[(*jit)->thread]->end_of_frame_queue.remove((*jit)) ;
|
|
/* Other jobs classes are put into the main thread */
|
|
} else if ( (queue_it = class_to_queue.find((*jit)->job_class)) != class_to_queue.end() ) {
|
|
/* for non-scheduled jobs, the class_to_queue map holds the correct queue to insert the job */
|
|
curr_queue = queue_it->second ;
|
|
curr_queue->remove( (*jit) ) ;
|
|
}
|
|
} else {
|
|
/* if the job is a "scheduled" type job, insert the job into the proper thread queue */
|
|
if ( (*jit)->job_class >= scheduled_start_index ) {
|
|
threads[0]->job_queue.remove((*jit)) ;
|
|
// Add all scheduled jobs to the scheduled_queue for use in the multi-threaded loop
|
|
scheduled_queue.remove((*jit)) ;
|
|
} else if ( (queue_it = class_to_queue.find((*jit)->job_class)) != class_to_queue.end() ) {
|
|
/* for non-scheduled jobs, the class_to_queue map holds the correct queue to insert the job */
|
|
curr_queue = queue_it->second ;
|
|
curr_queue->remove( (*jit) ) ;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return 0 ;
|
|
|
|
}
|