physical::parser::detail::unit_parser::definition< ScannerT > Struct Template Reference

List of all members.

Public Types

typedef spirit::rule< ScannerT,
unit_closure::context_t > 
rule_t

Public Member Functions

 definition (unit_parser const &self)
rule_t const & start () const

Public Attributes

spirit::symbols< physical::DynamicPhysical<
SI > > 
symbol
spirit::symbols< physical::DynamicPhysical<
SI > > 
prefix
rule_t symbol_exp
rule_t unit
rule_t quantity
rule_t top

Detailed Description

template<typename ScannerT>
struct physical::parser::detail::unit_parser::definition< ScannerT >

Definition at line 66 of file parser.cpp.


Member Typedef Documentation

template<typename ScannerT>
typedef spirit::rule<ScannerT, unit_closure::context_t> physical::parser::detail::unit_parser::definition< ScannerT >::rule_t

Definition at line 70 of file parser.cpp.


Constructor & Destructor Documentation

template<typename ScannerT>
physical::parser::detail::unit_parser::definition< ScannerT >::definition ( unit_parser const &  self  )  [inline]

Definition at line 73 of file parser.cpp.

References physical::unitsymbol_si_float::A, physical::unitsymbol_si_float::Bq, physical::unitsymbol_si_float::C, physical::unitsymbol_si_float::cd, physical::unitsymbol_si_float::g, physical::unitsymbol_si_float::Gy, physical::unitsymbol_si_float::Hz, physical::unitsymbol_si_float::J, physical::unitsymbol_si_float::K, physical::unitsymbol_si_float::kat, physical::unitsymbol_si_float::lm, physical::unitsymbol_si_float::lx, physical::unitsymbol_si_float::m, physical::unitsymbol_si_float::mol, physical::unitsymbol_si_float::N, physical::unitsymbol_si_float::Omega, physical::unitsymbol_si_float::Pa, physical::parser::detail::unit_parser::definition< ScannerT >::prefix, physical::parser::detail::unit_parser::definition< ScannerT >::quantity, physical::parser::detail::quantity_power, physical::unitsymbol_si_float::rad, physical::unitsymbol_si_float::S, physical::unitsymbol_si_float::s, physical::unitsymbol_si_float::sr, physical::unitsymbol_si_float::Sv, physical::parser::detail::unit_parser::definition< ScannerT >::symbol, physical::parser::detail::unit_parser::definition< ScannerT >::symbol_exp, physical::unitsymbol_si_float::T, physical::parser::detail::unit_parser::definition< ScannerT >::top, physical::parser::detail::unit_parser::definition< ScannerT >::unit, physical::unit_si_double::unity, physical::unitsymbol_si_float::V, physical::unitsymbol_si_float::W, and physical::unitsymbol_si_float::Wb.

00073                                                                                 { 
00074                                                    namespace unitsymbol=physical::unitsymbol_si_double;
00075 
00076                                                    symbol.add("m",              unitsymbol::m);
00077                                                    symbol.add("g",              unitsymbol::g);
00078                                                    symbol.add("s",              unitsymbol::s);
00079                                                    symbol.add("A",              unitsymbol::A);
00080                                                    symbol.add("K",              unitsymbol::K);
00081                                                    symbol.add("mol",       unitsymbol::mol);
00082                                                    symbol.add("cd",        unitsymbol::cd);
00083                                                    symbol.add("rad",       unitsymbol::rad);
00084                                                    symbol.add("sr",        unitsymbol::sr);
00085                                                    symbol.add("Hz",        unitsymbol::Hz);
00086                                                    symbol.add("N",              unitsymbol::N);
00087                                                    symbol.add("Pa",        unitsymbol::Pa);
00088                                                    symbol.add("J",              unitsymbol::J);
00089                                                    symbol.add("W",              unitsymbol::W);
00090                                                    symbol.add("C",              unitsymbol::C);
00091                                                    symbol.add("V",              unitsymbol::V);
00092                                                    symbol.add("Ohm",       unitsymbol::Omega); // special character?
00093                                                    symbol.add("S",              unitsymbol::S);
00094                                                    symbol.add("Wb",        unitsymbol::Wb);
00095                                                    symbol.add("T",              unitsymbol::T);
00096                                                    symbol.add("lm",        unitsymbol::lm);
00097                                                    symbol.add("lx",        unitsymbol::lx);
00098                                                    symbol.add("Bq",        unitsymbol::Bq);
00099                                                    symbol.add("Gy",        unitsymbol::Gy);
00100                                                    symbol.add("Sv",        unitsymbol::Sv);
00101                                                    symbol.add("kat",       unitsymbol::kat);
00102                                                    // Fixme what about celsius, Fahrenheit, reaumur ?
00103                                                    // Fixme what about day, hour, minute ?
00104                                                    // Fixme what about long unit names? (meter, second..)
00105                                                    prefix.add("Y",              1.e24);
00106                                                    prefix.add("Z",              1.e21);
00107                                                    prefix.add("E",              1.e18);
00108                                                    prefix.add("P",              1.e15);
00109                                                    prefix.add("T",              1.e12);
00110                                                    prefix.add("G",              1.e9);
00111                                                    prefix.add("M",              1.e6);
00112                                                    prefix.add("k",              1.e3);
00113                                                    prefix.add("h",              1.e2);
00114                                                    prefix.add("da",        1.e1);
00115                                                    prefix.add("d",              1.e-1);
00116                                                    prefix.add("c",              1.e-2);
00117                                                    prefix.add("m",              1.e-3);
00118                                                    prefix.add("u",              1.e-6); // use some special character for mu?
00119                                                    prefix.add("mu",        1.e-6);
00120                                                    prefix.add("n",              1.e-9);
00121                                                    prefix.add("p",              1.e-12);
00122                                                    prefix.add("f",              1.e-15);
00123                                                    prefix.add("a",              1.e-18);
00124                                                    prefix.add("z",              1.e-21);
00125                                                    prefix.add("y",              1.e-24);
00126 
00127                                                    symbol_exp = spirit::epsilon_p[symbol_exp.val = unit_si_double::unity] >>
00128                                                            (
00129                                                                    symbol[symbol_exp.val = phoenix::arg1] 
00130                                                            >> !('^' >> spirit::int_p[symbol_exp.val =  quantity_power(symbol_exp.val, phoenix::arg1)])
00131                                                            ) || (
00132                                                               prefix[symbol_exp.val  = phoenix::arg1] 
00133                                                            >> symbol[symbol_exp.val *= phoenix::arg1] 
00134                                                            >> !('^' >> spirit::int_p[symbol_exp.val =  quantity_power(symbol_exp.val, phoenix::arg1)])
00135                                                            );
00136 
00137                                                            unit = spirit::epsilon_p[unit.val = unit_si_double::unity] >>
00138                                                                ( 
00139                                                                            spirit::str_p("[]") || spirit::str_p("[1]")
00140                                                                    ) || (
00141                                                                            "[" >>        symbol_exp[unit.val = unit.val * phoenix::arg1] 
00142                                                                            >> *( ("*" >> symbol_exp[unit.val = unit.val * phoenix::arg1] ) 
00143                                                                                    || ("/" >> symbol_exp[unit.val = unit.val / phoenix::arg1] ) 
00144                                                                                    ) >> "]"
00145                                                                    );
00146 
00147                                                    quantity = spirit::real_p[quantity.val = phoenix::arg1] 
00148                                                                     >> !(unit[quantity.val = quantity.val * phoenix::arg1]);
00149 
00150                                                            top = quantity[self.val = phoenix::arg1];
00151                                            };


Member Function Documentation

template<typename ScannerT>
rule_t const& physical::parser::detail::unit_parser::definition< ScannerT >::start (  )  const [inline]

Definition at line 153 of file parser.cpp.

References physical::parser::detail::unit_parser::definition< ScannerT >::top.

00153 { return top; }


Member Data Documentation

template<typename ScannerT>
spirit::symbols<physical::DynamicPhysical<SI> > physical::parser::detail::unit_parser::definition< ScannerT >::symbol

Definition at line 68 of file parser.cpp.

Referenced by physical::parser::detail::unit_parser::definition< ScannerT >::definition().

template<typename ScannerT>
spirit::symbols<physical::DynamicPhysical<SI> > physical::parser::detail::unit_parser::definition< ScannerT >::prefix

Definition at line 69 of file parser.cpp.

Referenced by physical::parser::detail::unit_parser::definition< ScannerT >::definition().

template<typename ScannerT>
rule_t physical::parser::detail::unit_parser::definition< ScannerT >::symbol_exp

Definition at line 71 of file parser.cpp.

Referenced by physical::parser::detail::unit_parser::definition< ScannerT >::definition().

template<typename ScannerT>
rule_t physical::parser::detail::unit_parser::definition< ScannerT >::unit

Definition at line 71 of file parser.cpp.

Referenced by physical::parser::detail::unit_parser::definition< ScannerT >::definition().

template<typename ScannerT>
rule_t physical::parser::detail::unit_parser::definition< ScannerT >::quantity

Definition at line 71 of file parser.cpp.

Referenced by physical::parser::detail::unit_parser::definition< ScannerT >::definition().

template<typename ScannerT>
rule_t physical::parser::detail::unit_parser::definition< ScannerT >::top

Definition at line 71 of file parser.cpp.

Referenced by physical::parser::detail::unit_parser::definition< ScannerT >::definition(), and physical::parser::detail::unit_parser::definition< ScannerT >::start().


The documentation for this struct was generated from the following file:
Generated on Mon Apr 2 22:25:08 2007 for physical_svn by  doxygen 1.5.1-p1
hosted on SourceForge.net Logo