mirror of
https://github.com/nasa/trick.git
synced 2024-12-18 20:57:55 +00:00
Suppress units conversion messages in input file. #414
Added a routine to shoot_the_units_conversion_messenger.
This commit is contained in:
parent
b2ebe157ed
commit
dce161ad94
@ -36,7 +36,8 @@ namespace Trick {
|
||||
/** Returned value from event condition evaluation.\n */
|
||||
int return_val ; /**< trick_io(**) trick_units(--) */
|
||||
|
||||
/** Input processor mutex for protection for var server and event processing.\n */ pthread_mutex_t ip_mutex; /**< trick_io(**) trick_units(--) */
|
||||
/** Input processor mutex for protection for var server and event processing.\n */
|
||||
pthread_mutex_t ip_mutex; /**< trick_io(**) trick_units(--) */
|
||||
|
||||
/**
|
||||
@brief Constructor.
|
||||
@ -48,6 +49,16 @@ namespace Trick {
|
||||
*/
|
||||
void get_TMM_named_variables() ;
|
||||
|
||||
/**
|
||||
@brief Get the status of the units conversion message flag
|
||||
*/
|
||||
bool get_units_conversion_msgs() ;
|
||||
|
||||
/**
|
||||
@brief Setting to see units conversions warnings
|
||||
*/
|
||||
void shoot_the_units_conversion_messenger(bool onoff) ;
|
||||
|
||||
/**
|
||||
@brief Initialize and run the Python input processor on the user input file.
|
||||
*/
|
||||
@ -75,6 +86,11 @@ namespace Trick {
|
||||
@return always 0
|
||||
*/
|
||||
int restart() ;
|
||||
|
||||
protected :
|
||||
/** false = see units conversion messages, true = head in sand */
|
||||
bool units_conversion_msgs ;
|
||||
|
||||
} ;
|
||||
|
||||
}
|
||||
@ -82,6 +98,12 @@ namespace Trick {
|
||||
extern "C" {
|
||||
//SWIG generated routine.
|
||||
void init_swig_modules(void) ;
|
||||
|
||||
/* Call this if you you refuse to fix your units problems and want to shoot the messenger instead */
|
||||
void shoot_the_units_conversion_messenger() ;
|
||||
void revive_the_units_conversion_messenger() ;
|
||||
|
||||
int check_units_conversion_messenger_for_signs_of_life() ;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -25,8 +25,7 @@
|
||||
Trick::IPPython * the_pip ;
|
||||
|
||||
//Constructor
|
||||
Trick::IPPython::IPPython() : Trick::InputProcessor::InputProcessor() {
|
||||
|
||||
Trick::IPPython::IPPython() : Trick::InputProcessor::InputProcessor() , units_conversion_msgs(true) {
|
||||
the_pip = this ;
|
||||
return ;
|
||||
}
|
||||
@ -67,6 +66,14 @@ void Trick::IPPython::get_TMM_named_variables() {
|
||||
}
|
||||
}
|
||||
|
||||
bool Trick::IPPython::get_units_conversion_msgs() {
|
||||
return units_conversion_msgs ;
|
||||
}
|
||||
|
||||
void Trick::IPPython::shoot_the_units_conversion_messenger(bool onoff) {
|
||||
units_conversion_msgs = !onoff ;
|
||||
}
|
||||
|
||||
//Initialize and run the Python input processor on the user input file.
|
||||
int Trick::IPPython::init() {
|
||||
/** @par Detailed Design: */
|
||||
@ -193,3 +200,14 @@ int Trick::IPPython::shutdown() {
|
||||
return(0) ;
|
||||
}
|
||||
|
||||
void shoot_the_units_conversion_messenger() {
|
||||
the_pip->shoot_the_units_conversion_messenger(true) ;
|
||||
}
|
||||
|
||||
void revive_the_units_conversion_messenger() {
|
||||
the_pip->shoot_the_units_conversion_messenger(false) ;
|
||||
}
|
||||
|
||||
int check_units_conversion_messenger_for_signs_of_life() {
|
||||
return the_pip->get_units_conversion_msgs() ;
|
||||
}
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include <udunits2.h>
|
||||
#include "trick/swig/swig_double.hh"
|
||||
#include "trick/map_trick_units_to_udunits.hh"
|
||||
#include "trick/IPPython.hh"
|
||||
|
||||
%}
|
||||
|
||||
@ -50,8 +51,10 @@ PyObject * attach_units(PyObject * in_units_obj , PyObject * in_object) {
|
||||
line_no = PyFrame_GetLineNumber(tstate->frame) ;
|
||||
#endif
|
||||
}
|
||||
std::cout << "\033[33mUnits converted from [" << in_units << "] to [" << new_units << "] "
|
||||
<< file_name << ":" << line_no << "\033[0m" << std::endl ;
|
||||
if ( check_units_conversion_messenger_for_signs_of_life() ) {
|
||||
std::cout << "\033[33mUnits converted from [" << in_units << "] to [" << new_units << "] "
|
||||
<< file_name << ":" << line_no << "\033[0m" << std::endl ;
|
||||
}
|
||||
in_units = new_units ;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user