mirror of
https://github.com/nasa/trick.git
synced 2024-12-20 05:37:55 +00:00
19025d77ad
Reorganized. Created a new top level include directory that will hold all of Trick's header files. Moved all of the Trick headers to this directory. Created a libexec directory that holds all of the executables that users don't need to execute directly. Changed all of the executables remaining in bin to start with "trick-". In the sim_services directories changed all source files to find the Trick headers in their new location. Since all of the include files are gone in sim_services, removed the src directories as well, moving all of the source files up a level. Moved the makefiles, docs, man, and other architecture independent files into a top level share directory. Renamed lib_${TRICK_HOST_CPU} to lib64 or lib depending on the platform we're currently on. refs #63
74 lines
2.0 KiB
C++
74 lines
2.0 KiB
C++
/*
|
|
PURPOSE: (Units Conversion Package C++ Language Interface)
|
|
|
|
PROGRAMMERS:
|
|
(((John M. Penn) (L-3Com/Titan) (May 2006) (v1.0)
|
|
(Initial Release)))
|
|
*/
|
|
|
|
#ifndef UNIT_HH
|
|
#define UNIT_HH
|
|
#include "trick/units_conv.h"
|
|
#include "trick/UCFn.hh"
|
|
|
|
/**
|
|
* Unit (of measurement) class.
|
|
*/
|
|
class Unit {
|
|
|
|
public:
|
|
#ifndef SWIG
|
|
class CONVERSION_ERROR {}; // Exception Class
|
|
#endif
|
|
/**
|
|
*
|
|
*/
|
|
Unit(); // Throws CONVERSION_ERROR
|
|
Unit(const char *name); // Throws CONVERSION_ERROR
|
|
~Unit();
|
|
|
|
/**
|
|
Initialize the Unit object from the given units specifier.
|
|
Throw an exception if the specifier is invalid.
|
|
*/
|
|
std::string setUnitName(const char *units_spec); // Throws CONVERSION_ERROR
|
|
|
|
/**
|
|
Return the units specifier of this Unit object.
|
|
*/
|
|
const char *getUnitName() { return this->units_name.c_str(); }
|
|
|
|
/**
|
|
Return a base and offset that converts these units to the units
|
|
specified by the given units specifier. Throw an exception if its not possible.
|
|
*/
|
|
UCFn *Conversion_to( const char *units_spec); // Throws CONVERSION_ERROR
|
|
|
|
/**
|
|
Return a base and offset that converts these units to the units
|
|
specified by the given Unit object. Throw an exception if its not possible.
|
|
*/
|
|
UCFn *Conversion_to( const Unit *u); // Throws CONVERSION_ERROR
|
|
|
|
/**
|
|
Convert the value from these units to those specified by the given units specifier.
|
|
*/
|
|
double Convert_to( double val, const char *unit_spec); // Throws CONVERSION_ERROR
|
|
|
|
/**
|
|
Convert the value from these units to those specified by the Unit parameter.
|
|
*/
|
|
double Convert_to( double val, const Unit *u); // Throws CONVERSION_ERROR
|
|
|
|
#ifndef SWIG
|
|
friend std::ostream& operator<< ( std::ostream& s, const Unit *u);
|
|
#endif
|
|
|
|
private:
|
|
|
|
std::string units_name;
|
|
Units_t *units;
|
|
|
|
};
|
|
#endif
|