cgma
|
00001 //------------------------------------------------------------------ 00002 //- Class: AbstractTree 00003 //- Author: Kevin Albrecht 00004 //- Created: 2 October 2003 00005 //- 00006 //- Description: 00007 //- Abstract class to act as superclass of spacial data structures 00008 //- such as KDDTree and RTree. 00009 //------------------------------------------------------------------ 00010 00011 #ifndef ABSTRACTTREE_HPP 00012 #define ABSTRACTTREE_HPP 00013 00014 #include "CubitVector.hpp" 00015 #include "CubitBox.hpp" 00016 #include "DLIList.hpp" 00017 00018 template <class Z> class AbstractTree 00019 { 00020 public: 00022 typedef double (*DistSqFunc)(CubitVector &a, Z& b); 00023 00025 virtual CubitStatus add (Z data) = 0; 00026 virtual void set_tol (double tol) = 0; 00027 virtual double get_tol () = 0; 00028 virtual CubitBoolean remove (Z data) = 0; 00029 virtual CubitStatus find (const CubitBox &range_box, DLIList <Z> &range_members) = 0; 00030 virtual CubitStatus k_nearest_neighbor (CubitVector &q, int k, double &closest_dist, 00031 DLIList<Z> &nearest_neighbors, 00032 DistSqFunc dist_sq_point_data) = 0; 00033 00035 virtual CubitStatus balance () { return CUBIT_SUCCESS; }; 00036 00038 virtual ~AbstractTree () {}; 00039 }; 00040 00041 #endif