]> git.mxchange.org Git - flightgear.git/commitdiff
Tweaks to fix directory change.
authorcurt <curt>
Thu, 6 Dec 2001 18:16:22 +0000 (18:16 +0000)
committercurt <curt>
Thu, 6 Dec 2001 18:16:22 +0000 (18:16 +0000)
src/FDM/YASim/Airplane.hpp
src/FDM/YASim/ControlMap.hpp
src/FDM/YASim/FGFDM.hpp
src/FDM/YASim/Model.hpp
src/FDM/YASim/Vector.hpp [new file with mode: 0644]
src/FDM/YASim/Wing.hpp

index 46fab823e44c72e08d03f8aeeb94e1a4b5dc8831..2f350f81adf0e99b8bd3e3310c99d2c081fd3ed0 100644 (file)
@@ -4,7 +4,7 @@
 #include "ControlMap.hpp"
 #include "Model.hpp"
 #include "Wing.hpp"
-#include "util/Vector.hpp"
+#include "Vector.hpp"
 
 namespace yasim {
 
index 370181f6b7957038c6911e215d3d82db212f47a9..15daf6c44243ed43a718e1ee50e72bfd00f7de52 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef _CONTROL_MAP_HPP
 #define _CONTROL_MAP_HPP
 
-#include "util/Vector.hpp"
+#include "Vector.hpp"
 
 namespace yasim {
 
index 1df02b65371d28fab4bed26954ac538288b6e2b6..3efec50d46dc32ddf8e107874c0dea9e0680ed36 100644 (file)
@@ -4,7 +4,7 @@
 #include <simgear/easyxml.hxx>
 
 #include "Airplane.hpp"
-#include "util/Vector.hpp"
+#include "Vector.hpp"
 
 namespace yasim {
 
index 0a32c63040ab76096868ac0cbcf43fac74b51ba2..6c1682a96e6cc7190fbd650d8479b289b36412eb 100644 (file)
@@ -4,7 +4,7 @@
 #include "Integrator.hpp"
 #include "RigidBody.hpp"
 #include "BodyEnvironment.hpp"
-#include "util/Vector.hpp"
+#include "Vector.hpp"
 
 namespace yasim {
 
diff --git a/src/FDM/YASim/Vector.hpp b/src/FDM/YASim/Vector.hpp
new file mode 100644 (file)
index 0000000..db8c8c7
--- /dev/null
@@ -0,0 +1,65 @@
+#ifndef _VECTOR_HPP
+#define _VECTOR_HPP
+
+//
+// Excruciatingly simple vector-of-pointers class.  Easy & useful.
+// No support for addition of elements anywhere but at the end of the
+// list, nor for removal of elements.  Does not delete (or interpret
+// in any way) its contents.
+//
+class Vector {
+public:
+    Vector();
+    int   add(void* p);
+    void* get(int i);
+    void  set(int i, void* p);
+    int   size();
+private:
+    void realloc();
+
+    int _nelem;
+    int _sz;
+    void** _array;
+};
+
+inline Vector::Vector()
+{
+    _nelem = 0;
+    _sz = 0;
+    _array = 0;
+}
+
+inline int Vector::add(void* p)
+{
+    if(_nelem == _sz)
+        realloc();
+    _array[_sz] = p;
+    return _sz++;
+}
+
+inline void* Vector::get(int i)
+{
+    return _array[i];
+}
+
+inline void Vector::set(int i, void* p)
+{
+    _array[i] = p;
+}
+
+inline int Vector::size()
+{
+    return _sz;
+}
+
+inline void Vector::realloc()
+{
+    _nelem = 2*_nelem + 1;
+    void** array = new void*[_nelem];
+    for(int i=0; i<_sz; i++)
+        array[i] = _array[i];
+    delete[] _array;
+    _array = array;
+}
+
+#endif // _VECTOR_HPP
index b448f83fa018d3426b6e761bc945ab965592c665..861436e8a99fbce16f6351b18ebbdbec32fd0362 100644 (file)
@@ -1,7 +1,7 @@
 #ifndef _WING_HPP
 #define _WING_HPP
 
-#include "util/Vector.hpp"
+#include "Vector.hpp"
 
 namespace yasim {