mirror of
https://github.com/nasa/trick.git
synced 2024-12-21 06:03:10 +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
62 lines
2.1 KiB
C++
62 lines
2.1 KiB
C++
|
|
#include "trick/Scheduler.hh"
|
|
|
|
Trick::Scheduler::~Scheduler() {}
|
|
|
|
// Default implementation of add_sim_object adds sim_object jobs to the scheduler queues
|
|
// if this scheduler handles that job type
|
|
int Trick::Scheduler::add_sim_object( Trick::SimObject * in_object ) {
|
|
|
|
unsigned int jj ;
|
|
std::map<std::string, int>::iterator class_id_it ;
|
|
JobData * job ;
|
|
std::map<int, Trick::ScheduledJobQueue *>::iterator queue_it ;
|
|
Trick::ScheduledJobQueue * curr_queue ;
|
|
|
|
for ( jj = 0 ; jj < in_object->jobs.size() ; jj++ ) {
|
|
job = in_object->jobs[jj] ;
|
|
if ( (class_id_it = class_map.find(job->job_class_name)) != class_map.end() ) {
|
|
job->job_class = class_id_it->second ;
|
|
if ( (queue_it = class_to_queue.find(job->job_class)) != class_to_queue.end() ) {
|
|
curr_queue = queue_it->second ;
|
|
curr_queue->push( job ) ;
|
|
}
|
|
}
|
|
}
|
|
|
|
return 0 ;
|
|
}
|
|
|
|
// Default implementation of delete_sim_object removes all jobs associated with the incoming
|
|
// sim_object from the queues in this scheduler.
|
|
int Trick::Scheduler::delete_sim_object( Trick::SimObject * in_object ) {
|
|
|
|
unsigned int jj ;
|
|
std::map<std::string, int>::iterator class_id_it ;
|
|
JobData * job ;
|
|
std::map<int, Trick::ScheduledJobQueue *>::iterator queue_it ;
|
|
Trick::ScheduledJobQueue * curr_queue ;
|
|
|
|
for ( jj = 0 ; jj < in_object->jobs.size() ; jj++ ) {
|
|
job = in_object->jobs[jj] ;
|
|
if ( (class_id_it = class_map.find(job->job_class_name)) != class_map.end() ) {
|
|
if ( (queue_it = class_to_queue.find(class_id_it->second)) != class_to_queue.end() ) {
|
|
curr_queue = queue_it->second ;
|
|
curr_queue->remove( job ) ;
|
|
}
|
|
}
|
|
}
|
|
|
|
return 0 ;
|
|
}
|
|
|
|
// These 2 routines should no longer be needed. (Alex 9/12/12)
|
|
int Trick::Scheduler::write_sched_queue( FILE * fp , Trick::ScheduledJobQueue * curr_queue ) {
|
|
return curr_queue->write_sched_queue(fp) ;
|
|
}
|
|
|
|
int Trick::Scheduler::write_non_sched_queue( FILE * fp , Trick::ScheduledJobQueue * curr_queue ) {
|
|
return curr_queue->write_non_sched_queue(fp) ;
|
|
}
|
|
|