mirror of
https://github.com/nasa/trick.git
synced 2025-06-17 06:38:27 +00:00
Suppress units conversion messages in input file. #414
Added a routine to shoot_the_units_conversion_messenger.
This commit is contained in:
@ -36,7 +36,8 @@ namespace Trick {
|
|||||||
/** Returned value from event condition evaluation.\n */
|
/** Returned value from event condition evaluation.\n */
|
||||||
int return_val ; /**< trick_io(**) trick_units(--) */
|
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.
|
@brief Constructor.
|
||||||
@ -48,6 +49,16 @@ namespace Trick {
|
|||||||
*/
|
*/
|
||||||
void get_TMM_named_variables() ;
|
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.
|
@brief Initialize and run the Python input processor on the user input file.
|
||||||
*/
|
*/
|
||||||
@ -75,6 +86,11 @@ namespace Trick {
|
|||||||
@return always 0
|
@return always 0
|
||||||
*/
|
*/
|
||||||
int restart() ;
|
int restart() ;
|
||||||
|
|
||||||
|
protected :
|
||||||
|
/** false = see units conversion messages, true = head in sand */
|
||||||
|
bool units_conversion_msgs ;
|
||||||
|
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -82,6 +98,12 @@ namespace Trick {
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
//SWIG generated routine.
|
//SWIG generated routine.
|
||||||
void init_swig_modules(void) ;
|
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
|
#endif
|
||||||
|
@ -25,8 +25,7 @@
|
|||||||
Trick::IPPython * the_pip ;
|
Trick::IPPython * the_pip ;
|
||||||
|
|
||||||
//Constructor
|
//Constructor
|
||||||
Trick::IPPython::IPPython() : Trick::InputProcessor::InputProcessor() {
|
Trick::IPPython::IPPython() : Trick::InputProcessor::InputProcessor() , units_conversion_msgs(true) {
|
||||||
|
|
||||||
the_pip = this ;
|
the_pip = this ;
|
||||||
return ;
|
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.
|
//Initialize and run the Python input processor on the user input file.
|
||||||
int Trick::IPPython::init() {
|
int Trick::IPPython::init() {
|
||||||
/** @par Detailed Design: */
|
/** @par Detailed Design: */
|
||||||
@ -193,3 +200,14 @@ int Trick::IPPython::shutdown() {
|
|||||||
return(0) ;
|
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 <udunits2.h>
|
||||||
#include "trick/swig/swig_double.hh"
|
#include "trick/swig/swig_double.hh"
|
||||||
#include "trick/map_trick_units_to_udunits.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) ;
|
line_no = PyFrame_GetLineNumber(tstate->frame) ;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
std::cout << "\033[33mUnits converted from [" << in_units << "] to [" << new_units << "] "
|
if ( check_units_conversion_messenger_for_signs_of_life() ) {
|
||||||
<< file_name << ":" << line_no << "\033[0m" << std::endl ;
|
std::cout << "\033[33mUnits converted from [" << in_units << "] to [" << new_units << "] "
|
||||||
|
<< file_name << ":" << line_no << "\033[0m" << std::endl ;
|
||||||
|
}
|
||||||
in_units = new_units ;
|
in_units = new_units ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user