00001 // $Header: /nfs/slac/g/glast/ground/cvs/xmlUtil/xmlUtil/Arith.h,v 1.3 2002/04/05 18:28:25 jrb Exp $
00002 #ifndef XMLUTIL_ARITH_H
00003 #define XMLUTIL_ARITH_H
00004
00005 #include <dom/DOM_Element.hpp>
00006 #include <dom/DOMString.hpp>
00007
00008 namespace xmlUtil {
00012 class Arith {
00013 public:
00015 enum eTagType {
00016 ETAG_const = 0,
00017 ETAG_refer,
00018 ETAG_add,
00019 ETAG_minus,
00020 ETAG_mul,
00021 ETAG_quo,
00022 ETAG_uminus,
00023 ETAG_max,
00024 ETAG_n
00025 } ;
00026
00027 Arith::Arith(const DOM_Element elt);
00030 double evaluate();
00031
00033
00034 void saveValue();
00035
00037
00040 static double getUnitsScale(const DOM_Element& elt);
00041 ~Arith() {};
00042
00043 private:
00044 static void init(); /*< Sets up static strings */
00045 double add(); /*< evaluate an \b add element */
00046 double minus(); /*< evaluate a \b minus element */
00047 double mul(); /*< evaluate a \b mul element */
00048 double quo(); /*< evalauate a \b quo element */
00049 double myMax(); /*< evaluate a \b max element */
00050
00051 DOM_Element m_elt; /*< element which may be evaluated */
00052 int m_tag; /*< element type (tagname) */
00053 double m_number; /*< value of element after evaluation */
00054 bool m_evaluated;/*< flag to keep track of whether eval has been done*/
00055
00056 typedef DOMString * ptrDOMString;/*< keep some static strings so we don't
00057 have to build them over and over */
00058 static ptrDOMString *typeNames;
00059 static ptrDOMString valString; // a DOMString containing "value"
00060 static ptrDOMString refToString; // ..and so forth
00061 static ptrDOMString constString;
00062 static ptrDOMString referString;
00063 static ptrDOMString addString;
00064 static ptrDOMString minusString;
00065 static ptrDOMString uminusString;
00066 static ptrDOMString mulString;
00067 static ptrDOMString quoString;
00068 static ptrDOMString maxString;
00069 static ptrDOMString notesString;
00070 static ptrDOMString lengthString;
00071 static ptrDOMString cmString;
00072 static ptrDOMString mString;
00073 };
00074
00075 }
00076 #endif
1.2.13.1 written by Dimitri van Heesch,
© 1997-2001