mirror of
https://github.com/nasa/trick.git
synced 2024-12-22 14:32:24 +00:00
684f0e6bdc
Initial checkin of using udunits for measurement units conversions. Replaced our conversion code in ICG and swig code to use udunits. Also added code to convert unit symbols that we used in Trick that are different names in udunits. Added a sim_object that will eventually allow users to specify a custom set of files to read units information. refs #231
28 lines
607 B
C++
28 lines
607 B
C++
|
|
#include <iostream>
|
|
|
|
#include "trick/UdUnits.hh"
|
|
|
|
ut_system * Trick::UdUnits::u_system = NULL ;
|
|
|
|
ut_system * Trick::UdUnits::get_u_system() {
|
|
return u_system ;
|
|
}
|
|
int Trick::UdUnits::read_default_xml() {
|
|
/* Initialize the udunits-2 library */
|
|
ut_set_error_message_handler(ut_ignore) ;
|
|
if( (u_system = ut_read_xml( NULL )) == NULL ) {
|
|
std::cerr << "Error initializing udunits-2 unit system" << std::endl ;
|
|
return -1 ;
|
|
}
|
|
ut_set_error_message_handler(ut_write_to_stderr) ;
|
|
|
|
return 0 ;
|
|
}
|
|
|
|
int Trick::UdUnits::read_user_xml(std::string file_name) {
|
|
return 0 ;
|
|
}
|
|
|
|
|