]> git.mxchange.org Git - flightgear.git/blobdiff - src/FDM/JSBSim/math/FGFunction.h
Merge branch 'vivian/trainz'
[flightgear.git] / src / FDM / JSBSim / math / FGFunction.h
index 435b031b6fb8206d982089296d618dd353707f58..d122ffe20755952aa66a38b2704cbf067e51bde4 100755 (executable)
@@ -4,7 +4,7 @@ Header: FGFunction.h
 Author: Jon Berndt
 Date started: August 25 2004
 
- ------------- Copyright (C) 2001  Jon S. Berndt (jsb@hal-pc.org) -------------
+ ------------- Copyright (C) 2001  Jon S. Berndt (jon@jsbsim.org) -------------
 
  This program is free software; you can redistribute it and/or modify it under
  the terms of the GNU Lesser General Public License as published by the Free Software
@@ -37,8 +37,6 @@ INCLUDES
 #include <vector>
 #include <string>
 #include "FGParameter.h"
-#include <input_output/FGXMLElement.h>
-#include <input_output/FGPropertyManager.h>
 
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 DEFINITIONS
@@ -52,6 +50,9 @@ FORWARD DECLARATIONS
 
 namespace JSBSim {
 
+class FGPropertyManager;
+class Element;
+
 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 CLASS DOCUMENTATION
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
@@ -69,6 +70,9 @@ A function definition consists of an operation, a value, a table, or a property
 - quotient (takes 2 args)
 - pow (takes 2 args)
 - exp (takes 2 args)
+- log2 (takes 1 arg)
+- ln (takes 1 arg)
+- log10 (takes 1 arg)
 - abs (takes n args)
 - sin (takes 1 arg)
 - cos (takes 1 arg)
@@ -165,7 +169,7 @@ public:
     @param prefix an optional prefix to prepend to the name given to the property
            that represents this function (if given).
 */
-  FGFunction(FGPropertyManager* PropertyManager, Element* element, string prefix="");
+  FGFunction(FGPropertyManager* PropertyManager, Element* element, const std::string& prefix="");
   /// Destructor.
   virtual ~FGFunction();
 
@@ -175,10 +179,10 @@ public:
 
 /** The value that the function evaluates to, as a string.
   @return the value of the function as a string. */
-  string GetValueAsString(void) const;
+  std::string GetValueAsString(void) const;
 
 /// Retrieves the name of the function.
-  string GetName(void) const {return Name;}
+  std::string GetName(void) const {return Name;}
 
 /** Specifies whether to cache the value of the function, so it is calculated only
     once per frame.
@@ -189,45 +193,48 @@ public:
   void cacheValue(bool shouldCache);
 
 private:
-  vector <FGParameter*> Parameters;
+  std::vector <FGParameter*> Parameters;
   FGPropertyManager* const PropertyManager;
   bool cached;
-  string Prefix;
-  string description_string;
-  string property_string;
-  string value_string;
-  string table_string;
-  string p_string;
-  string v_string;
-  string t_string;
-  string function_string;
-  string sum_string;
-  string difference_string;
-  string product_string;
-  string quotient_string;
-  string pow_string;
-  string exp_string;
-  string abs_string;
-  string sin_string;
-  string cos_string;
-  string tan_string;
-  string asin_string;
-  string acos_string;
-  string atan_string;
-  string atan2_string;
-  string min_string;
-  string max_string;
-  string avg_string;
-  string fraction_string;
-  string mod_string;
-  string random_string;
-  string integer_string;
+  double invlog2val;
+  std::string Prefix;
+  std::string description_string;
+  std::string property_string;
+  std::string value_string;
+  std::string table_string;
+  std::string p_string;
+  std::string v_string;
+  std::string t_string;
+  std::string function_string;
+  std::string sum_string;
+  std::string difference_string;
+  std::string product_string;
+  std::string quotient_string;
+  std::string pow_string;
+  std::string exp_string;
+  std::string log2_string;
+  std::string ln_string;
+  std::string log10_string;
+  std::string abs_string;
+  std::string sin_string;
+  std::string cos_string;
+  std::string tan_string;
+  std::string asin_string;
+  std::string acos_string;
+  std::string atan_string;
+  std::string atan2_string;
+  std::string min_string;
+  std::string max_string;
+  std::string avg_string;
+  std::string fraction_string;
+  std::string mod_string;
+  std::string random_string;
+  std::string integer_string;
   double cachedValue;
   enum functionType {eTopLevel=0, eProduct, eDifference, eSum, eQuotient, ePow,
                      eExp, eAbs, eSin, eCos, eTan, eASin, eACos, eATan, eATan2,
-                     eMin, eMax, eAvg, eFrac, eInteger, eMod, eRandom} Type;
-  string Name;
-  double GaussianRandomNumber(void) const;
+                     eMin, eMax, eAvg, eFrac, eInteger, eMod, eRandom, eLog2, eLn, eLog10} Type;
+  std::string Name;
   void bind(void);
   void Debug(int from);
 };