From 149e7a420d6d75d0d7d094393b7be98533f79343 Mon Sep 17 00:00:00 2001 From: Pherring04 Date: Tue, 14 May 2024 13:44:12 -0500 Subject: [PATCH] message --- include/trick/message_proto.h | 3 ++ .../sim_services/Message/Message_c_intf.cpp | 29 ++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/include/trick/message_proto.h b/include/trick/message_proto.h index d1458855..d9ca75f8 100644 --- a/include/trick/message_proto.h +++ b/include/trick/message_proto.h @@ -9,6 +9,9 @@ extern "C" { #endif +int message_add_subscriber( void * in_ms ) ; +int message_remove_subscriber( void * in_ms ) ; +void * message_get_subscriber( const char * sub_name) ; int message_publish(int level, const char *format_msg, ...) ; int message_publish_standalone(int level, const char *format_msg, ...) ; int send_hs(FILE * fp, const char *format_msg, ...) ; diff --git a/trick_source/sim_services/Message/Message_c_intf.cpp b/trick_source/sim_services/Message/Message_c_intf.cpp index 0353c9dd..60aec2d2 100644 --- a/trick_source/sim_services/Message/Message_c_intf.cpp +++ b/trick_source/sim_services/Message/Message_c_intf.cpp @@ -24,7 +24,7 @@ int message_subscribe( Trick::MessageSubscriber * in_ms ) { the_message_publisher->subscribe(in_ms) ; return(0) ; } - + /** @relates Trick::MessagePublisher @copydoc Trick::MessagePublisher::unsubscribe @@ -34,6 +34,33 @@ int message_unsubscribe( Trick::MessageSubscriber * in_ms ) { return(0) ; } + +/** + @relates Trick::MessagePublisher + @copydoc Trick::MessagePublisher::subscribe + */ +extern "C" int message_add_subscriber( void * in_ms ) { + the_message_publisher->subscribe((Trick::MessageSubscriber *)in_ms) ; + return(0) ; +} + +/** + @relates Trick::MessagePublisher + @copydoc Trick::MessagePublisher::unsubscribe + */ +extern "C" int message_remove_subscriber( void * in_ms ) { + the_message_publisher->unsubscribe((Trick::MessageSubscriber *)in_ms) ; + return(0) ; +} + +/** + @relates Trick::MessagePublisher + @copydoc Trick::MessagePublisher::getSubscriber + */ +extern "C" void * message_get_subscriber( const char * sub_name ) { + return (void *)the_message_publisher->getSubscriber(sub_name) ; +} + /** @relates Trick::MessagePublisher @userdesc Command to publish a message, which sends the message to all subscribers.