From d859ac8453decca609fbe29c2d31defc65c86915 Mon Sep 17 00:00:00 2001 From: Derek Bankieris Date: Tue, 29 Nov 2016 11:47:10 -0600 Subject: [PATCH] Add funciton to remove all data record groups Refs #350 --- include/trick/DataRecordDispatcher.hh | 3 +++ include/trick/data_record_proto.h | 1 + .../sim_services/DataRecord/DataRecordDispatcher.cpp | 6 ++++++ .../sim_services/DataRecord/data_record_utilities.cpp | 4 ++++ 4 files changed, 14 insertions(+) diff --git a/include/trick/DataRecordDispatcher.hh b/include/trick/DataRecordDispatcher.hh index c89eec87..32936e92 100644 --- a/include/trick/DataRecordDispatcher.hh +++ b/include/trick/DataRecordDispatcher.hh @@ -70,6 +70,9 @@ namespace Trick { /** @brief Removes a data recording group. */ int remove_group(Trick::DataRecordGroup * in_group ) ; + /** @brief Removes all data recording groups. */ + void remove_all_groups() ; + /** @brief Gets a data recording group. */ Trick::DataRecordGroup * get_group(std::string group_name) ; diff --git a/include/trick/data_record_proto.h b/include/trick/data_record_proto.h index e2312820..cd06c47b 100644 --- a/include/trick/data_record_proto.h +++ b/include/trick/data_record_proto.h @@ -14,6 +14,7 @@ int dr_disable() ; int dr_enable_group( const char * in_name ) ; int dr_disable_group( const char * in_name ) ; int dr_record_now_group( const char * in_name ) ; +void remove_all_data_record_groups() ; #ifdef __cplusplus int add_data_record_group( Trick::DataRecordGroup * in_group, Trick::DR_Buffering buffering = Trick::DR_Not_Specified ) ; diff --git a/trick_source/sim_services/DataRecord/DataRecordDispatcher.cpp b/trick_source/sim_services/DataRecord/DataRecordDispatcher.cpp index 56e85f31..5bb0838f 100644 --- a/trick_source/sim_services/DataRecord/DataRecordDispatcher.cpp +++ b/trick_source/sim_services/DataRecord/DataRecordDispatcher.cpp @@ -193,6 +193,12 @@ int Trick::DataRecordDispatcher::remove_group(Trick::DataRecordGroup * in_group) return 0 ; } +void Trick::DataRecordDispatcher::remove_all_groups() { + while (!groups.empty()) { + remove_group(groups[0]); + } +} + Trick::DataRecordGroup * Trick::DataRecordDispatcher::get_group(std::string in_name) { std::vector ::iterator it ; for ( it = groups.begin() ; it != groups.end() ; it++ ) { diff --git a/trick_source/sim_services/DataRecord/data_record_utilities.cpp b/trick_source/sim_services/DataRecord/data_record_utilities.cpp index 5b4bbfc9..ffb883ff 100644 --- a/trick_source/sim_services/DataRecord/data_record_utilities.cpp +++ b/trick_source/sim_services/DataRecord/data_record_utilities.cpp @@ -68,6 +68,10 @@ extern "C" int remove_data_record_group( Trick::DataRecordGroup * in_group ) { return -1 ; } +extern "C" void remove_all_data_record_groups() { + the_drd->remove_all_groups() ; +} + extern "C" Trick::DataRecordGroup * get_data_record_group( std::string in_name ) { if ( the_drd != NULL ) { return the_drd->get_group(in_name) ;