trick/trick_source/sim_services/RealtimeSync/RealtimeSync_c_intf.cpp
Alex Lin 19025d77ad Standardize directory names
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
2015-06-09 08:44:42 -05:00

88 lines
2.2 KiB
C++

#include <stdio.h>
#include "trick/RealtimeSync.hh"
#include "trick/realtimesync_proto.h"
#include "trick/exec_proto.h"
/* Global singleton pointer to the real-time synchronization */
extern Trick::RealtimeSync * the_rts ;
/*************************************************************************/
/* These routines are the "C" interface to the real-time synchronization */
/*************************************************************************/
/**
* @relates Trick::RealtimeSync
* @copydoc Trick::RealtimeSync::enable
* C wrapper for Trick::RealtimeSync::enable
*/
extern "C" int real_time_enable() {
if ( the_rts != NULL ) {
return the_rts->enable() ;
}
return(0) ;
}
/**
* @relates Trick::RealtimeSync
* @copydoc Trick::RealtimeSync::disable
* C wrapper for Trick::RealtimeSync::disable
*/
extern "C" int real_time_disable() {
if ( the_rts != NULL ) {
return the_rts->disable() ;
}
return(0) ;
}
/**
* @relates Trick::RealtimeSync
* @copydoc Trick::RealtimeSync::start_realtime
* C wrapper for Trick::RealtimeSync::start_realtime
*/
extern "C" int real_time_restart(long long ref_time ) {
if ( the_rts != NULL ) {
return the_rts->start_realtime(exec_get_software_frame() , ref_time) ;
}
return(0) ;
}
/**
* @relates Trick::RealtimeSync
@userdesc Return whether real-time synchronization is currently active.
@par Python Usage:
@code <my_int> = trick.is_real_time() @endcode
@return Trick::RealtimeSync::active (integer converted from boolean)
*/
extern "C" int is_real_time() {
if ( the_rts != NULL ) {
return((int)(the_rts->active)) ;
}
return(0) ;
}
int real_time_change_clock(Trick::Clock * in_clock ) {
if ( the_rts != NULL ) {
return the_rts->change_clock(in_clock) ;
}
return -1 ;
}
const char * real_time_clock_get_name() {
if ( the_rts != NULL ) {
return the_rts->clock_get_name() ;
}
return NULL ;
}
int real_time_change_timer(Trick::Timer * in_sleep_timer ) {
if ( the_rts != NULL ) {
return the_rts->change_timer(in_sleep_timer) ;
}
return -1 ;
}
extern "C" int real_time_set_rt_clock_ratio(double in_clock_ratio) {
return the_rts->set_rt_clock_ratio(in_clock_ratio) ;
}