#include <simgear/compiler.h>
-#include <vector>
-SG_USING_STD(vector);
+#include <simgear/structure/SGReferenced.hxx>
-#include STL_STRING
-SG_USING_STD(string);
+#include <map>
+#include <string>
+class SGPropertyNode;
/**
* A class that provids a simple linear 2d interpolation lookup table.
* independant variable must be strictly ascending. The dependent
* variable can be anything.
*/
-class SGInterpTable {
-
- struct Entry
- {
- Entry ()
- : ind(0.0L), dep(0.0L) {}
- Entry (double independent, double dependent)
- : ind(independent), dep(dependent) {}
- double ind;
- double dep;
- };
-
- int size;
- vector<Entry> table;
-
+class SGInterpTable : public SGReferenced {
public:
/**
*/
SGInterpTable();
+ /**
+ * Constructor. Loads the interpolation table from an interpolation
+ * property node.
+ * @param interpolation property node having entry children
+ */
+ SGInterpTable(const SGPropertyNode* interpolation);
+
/**
* Constructor. Loads the interpolation table from the specified file.
* @param file name of interpolation file
*/
- SGInterpTable( const string& file );
+ SGInterpTable( const std::string& file );
/**
/** Destructor */
~SGInterpTable();
+
+private:
+ typedef std::map<double, double> Table;
+ Table _table;
};