mirror of
https://github.com/nasa/trick.git
synced 2024-12-19 21:27:54 +00:00
JITEvents are not checkpointable
JITEvents all need C bindings. They need to be extern "C"ed if they are in C++. Refs #53
This commit is contained in:
parent
24fe5adaec
commit
83e68ef26e
@ -11,43 +11,44 @@
|
||||
//#define protected public
|
||||
|
||||
#include "../S_source.hh"
|
||||
#include "sim_services/CheckPointRestart/include/CheckPointRestart_c_intf.hh"
|
||||
|
||||
extern "C" int run_event_1() {
|
||||
message_publish(1, "event 1 fired!\n") ;
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
int run_event_2() {
|
||||
extern "C" int run_event_2() {
|
||||
message_publish(1, "event 2 fired!\n") ;
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
int run_event_3() {
|
||||
extern "C" int run_event_3() {
|
||||
message_publish(1, "event 3 fired!\n") ;
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
int run_event_4() {
|
||||
extern "C" int run_event_4() {
|
||||
message_publish(1, "event 4 fired!\n") ;
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
int run_event_before() {
|
||||
extern "C" int run_event_before() {
|
||||
message_publish(1, "event before fired!\n") ;
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
int run_event_before2() {
|
||||
extern "C" int run_event_before2() {
|
||||
message_publish(1, "event before2 fired!\n") ;
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
int run_event_after() {
|
||||
extern "C" int run_event_after() {
|
||||
message_publish(1, "event after fired!\n") ;
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
int remove_events() {
|
||||
extern "C" int remove_events() {
|
||||
event_manager_remove_event(event_manager_get_event("event_3")) ;
|
||||
event_manager_remove_event(event_manager_get_event("event_before")) ;
|
||||
event_manager_remove_event(event_manager_get_event("event_after")) ;
|
||||
@ -60,19 +61,23 @@ extern "C" int run_me() {
|
||||
ball.obj.state.input.position[0] = 6.0 ;
|
||||
ball.obj.state.input.position[1] = 6.0 ;
|
||||
|
||||
checkpoint_pre_init(true) ;
|
||||
|
||||
// add read events
|
||||
jit_add_read( 90.0 , run_event_1 ) ;
|
||||
jit_add_read( 80.0 , run_event_2 ) ;
|
||||
jit_add_read( 90.0 , "run_event_1" ) ;
|
||||
jit_add_read( 80.0 , "run_event_2" ) ;
|
||||
|
||||
// add cyclic event
|
||||
jit_add_event( run_event_3 , "event_3" , 100.0 ) ;
|
||||
jit_add_event( "run_event_3" , "event_3" , 100.0 ) ;
|
||||
|
||||
// events tied to jobs
|
||||
jit_add_event_before( run_event_before , "event_before", "ball.obj.state_print" ) ;
|
||||
jit_add_event_after( run_event_after, "event_after", "ball.obj.state_print" ) ;
|
||||
jit_add_event_before( "run_event_before", "event_before", "ball.obj.state_print" ) ;
|
||||
jit_add_event_after( "run_event_after", "event_after", "ball.obj.state_print" ) ;
|
||||
|
||||
// add a read event that removes all other events.
|
||||
jit_add_read( 150.0 , remove_events ) ;
|
||||
jit_add_read( 150.0 , "remove_events" ) ;
|
||||
|
||||
jit_add_read( 190.0 , "hidden_event" ) ;
|
||||
|
||||
exec_set_terminate_time(200.0) ;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user