mirror of
https://github.com/nasa/trick.git
synced 2024-12-27 16:38:52 +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
90 lines
2.2 KiB
C++
90 lines
2.2 KiB
C++
|
|
#include <iostream>
|
|
#include <sstream>
|
|
|
|
#include "trick/TrickConstant.hh"
|
|
#include "trick/Executive.hh"
|
|
#include "trick/exec_proto.h"
|
|
#include "trick/message_proto.h"
|
|
#include "trick/message_type.h"
|
|
|
|
int Trick::Executive::get_freeze_job(std::string sim_object_name) {
|
|
freeze_job = get_job(sim_object_name + ".sched_freeze_to_exec_command") ;
|
|
if ( freeze_job == NULL ) {
|
|
exec_terminate_with_return(-1 , __FILE__ , __LINE__ , "Executive could not find freeze job" ) ;
|
|
} else {
|
|
freeze_job->next_tics = TRICK_MAX_LONG_LONG ;
|
|
}
|
|
|
|
return 0 ;
|
|
}
|
|
|
|
/**
|
|
@details
|
|
-# Set async_freeze_command to true Requirement [@ref r_exec_mode_4]
|
|
*/
|
|
int Trick::Executive::freeze() {
|
|
|
|
async_freeze_command = true ;
|
|
|
|
return(0) ;
|
|
|
|
}
|
|
|
|
int Trick::Executive::freeze(double in_time) {
|
|
|
|
long long new_time ;
|
|
new_time = (long long)(in_time * time_tic_value) ;
|
|
|
|
if (new_time > time_tics ) {
|
|
freeze_times.push(new_time) ;
|
|
if ( new_time < freeze_job->next_tics ) {
|
|
freeze_job->next_tics = new_time ;
|
|
}
|
|
//std::cout << "\033[33mSET FREEZE TIME " << in_time << " " << new_time << "\033[0m" << std::endl ;
|
|
} else {
|
|
message_publish(MSG_ERROR, "Freeze time specified in the past. specified %f, current_time %f\n",
|
|
in_time , get_sim_time()) ;
|
|
}
|
|
|
|
return(0) ;
|
|
|
|
}
|
|
|
|
/**
|
|
@details
|
|
-# Sets exec_command to FreezeCmd at the end of the software frame
|
|
*/
|
|
int Trick::Executive::async_freeze_to_exec_command() {
|
|
|
|
if ( async_freeze_command ) {
|
|
exec_command = FreezeCmd ;
|
|
async_freeze_command = false ;
|
|
}
|
|
|
|
return(0) ;
|
|
}
|
|
|
|
int Trick::Executive::sched_freeze_to_exec_command(bool end_of_frame) {
|
|
|
|
if ( end_of_frame or !freeze_on_frame_boundary ) {
|
|
// remove all times at the top of the queue that match the current time.
|
|
while ( !freeze_times.empty() and (freeze_times.top() <= time_tics) ) {
|
|
exec_command = FreezeCmd ;
|
|
freeze_times.pop() ;
|
|
}
|
|
|
|
if ( freeze_job != NULL ) {
|
|
if ( !freeze_times.empty() ) {
|
|
freeze_job->next_tics = freeze_times.top() ;
|
|
} else {
|
|
freeze_job->next_tics = TRICK_MAX_LONG_LONG ;
|
|
}
|
|
}
|
|
}
|
|
|
|
return(0) ;
|
|
|
|
}
|
|
|