From a6f3a25d4390c45495c9a46fbe8f968005a5f948 Mon Sep 17 00:00:00 2001 From: Shingo Kitagawa Date: Wed, 7 Jun 2023 14:35:05 +0900 Subject: [PATCH] add method to get memory tools service attributes --- .../memory_tools/memory_tools_service.hpp | 10 ++++++++++ .../src/memory_tools/memory_tools_service.cpp | 12 ++++++++++++ 2 files changed, 22 insertions(+) diff --git a/osrf_testing_tools_cpp/include/osrf_testing_tools_cpp/memory_tools/memory_tools_service.hpp b/osrf_testing_tools_cpp/include/osrf_testing_tools_cpp/memory_tools/memory_tools_service.hpp index f28670b..1684a76 100644 --- a/osrf_testing_tools_cpp/include/osrf_testing_tools_cpp/memory_tools/memory_tools_service.hpp +++ b/osrf_testing_tools_cpp/include/osrf_testing_tools_cpp/memory_tools/memory_tools_service.hpp @@ -87,12 +87,22 @@ struct MemoryToolsService void unignore(); + // Return ignored or not. + OSRF_TESTING_TOOLS_CPP_MEMORY_TOOLS_PUBLIC + bool + get_ignored(); + /// Adds a backtrace to the log message. /** Repeated calls do nothing, and only prints if a log is also printed. */ OSRF_TESTING_TOOLS_CPP_MEMORY_TOOLS_PUBLIC void print_backtrace(); + // Return print back trace or not. + OSRF_TESTING_TOOLS_CPP_MEMORY_TOOLS_PUBLIC + bool + get_print_backtrace(); + /// Returns a stack trace object for introspection. /** * Pointer should not be used after MemoryToolsService is out of scope. diff --git a/osrf_testing_tools_cpp/src/memory_tools/memory_tools_service.cpp b/osrf_testing_tools_cpp/src/memory_tools/memory_tools_service.cpp index 5984a5c..6234212 100644 --- a/osrf_testing_tools_cpp/src/memory_tools/memory_tools_service.cpp +++ b/osrf_testing_tools_cpp/src/memory_tools/memory_tools_service.cpp @@ -87,12 +87,24 @@ MemoryToolsService::unignore() impl_->ignored = false; } +bool +MemoryToolsService::get_ignored() +{ + return impl_->ignored; +} + void MemoryToolsService::print_backtrace() { impl_->should_print_backtrace = true; } +bool +MemoryToolsService::get_print_backtrace() +{ + return impl_->should_print_backtrace; +} + StackTrace * MemoryToolsService::get_stack_trace() {