tools/celgraph.h
00001 /* 00002 Crystal Space Entity Layer 00003 Copyright (C) 2006 by Jorrit Tyberghein 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public 00016 License along with this library; if not, write to the Free 00017 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00018 */ 00019 00020 #ifndef __CEL_CELGRAPH__ 00021 #define __CEL_CELGRAPH__ 00022 00023 #include "cstypes.h" 00024 #include "csutil/scf.h" 00025 #include "csutil/flags.h" 00026 #include "csutil/stringarray.h" 00027 #include <ivaria/mapnode.h> 00028 00029 struct iCelNode; 00030 00034 struct iCelEdge : public virtual iBase 00035 { 00036 SCF_INTERFACE (iCelEdge, 1, 0, 1); 00037 00041 virtual void SetState (bool open) = 0; 00042 00046 virtual void SetSuccessor (iCelNode* node) = 0; 00047 00051 virtual bool GetState () = 0; 00052 00056 virtual iCelNode* GetSuccessor () = 0; 00057 00059 virtual float GetWeight () const = 0; 00060 00062 virtual void SetWeight (float weight) = 0; 00063 }; 00064 00065 00069 struct iCelNode : public virtual iBase 00070 { 00071 SCF_INTERFACE (iCelNode, 1, 0, 3); 00072 00076 virtual size_t AddSuccessor (iCelNode* node, bool state) = 0; 00077 00081 virtual void SetMapNode (iMapNode* node) = 0; 00082 00086 virtual void SetParent (iCelNode* par)= 0; 00087 00091 virtual void SetName (const char* par)= 0; 00092 00096 virtual void Heuristic (float cost, iCelNode* goal)= 0; 00097 00101 virtual iMapNode* GetMapNode () = 0; 00102 00106 virtual csVector3 GetPosition () = 0; 00107 00111 virtual const char* GetName () = 0; 00112 00116 virtual iCelNode* GetParent () = 0; 00117 00121 virtual csArray<iCelNode*> GetSuccessors () = 0; 00122 00126 virtual csArray<iCelNode*> GetAllSuccessors () = 0; 00127 00131 virtual float GetHeuristic () = 0; 00132 00136 virtual float GetCost () = 0; 00137 00141 virtual size_t GetEdgeCount () = 0; 00142 00146 virtual iCelEdge* GetEdge (size_t idx) = 0; 00147 00151 virtual void RemoveEdge (size_t idx) = 0; 00152 00157 virtual size_t AddSuccessor (iCelNode* node, bool state, float weight) = 0; 00158 00162 virtual csRefArray<iCelEdge>* GetEdges () = 0; 00163 }; 00164 00165 00169 struct iCelPath : public virtual iBase 00170 { 00171 SCF_INTERFACE (iCelPath, 2, 0, 1); 00172 00176 virtual iObject* QueryObject () = 0; 00177 00181 virtual void AddNode (iMapNode* node) = 0; 00182 00186 virtual void InsertNode (size_t pos, iMapNode* node) = 0; 00187 00191 virtual iMapNode* Next () = 0; 00192 00196 virtual iMapNode* Previous () = 0; 00197 00201 virtual iMapNode* Current () = 0; 00202 00206 virtual csVector3 CurrentPosition () = 0; 00207 00211 virtual iSector* CurrentSector () = 0; 00212 00216 virtual bool HasNext () = 0; 00217 00221 virtual bool HasPrevious () = 0; 00222 00226 virtual void Restart () = 0; 00227 00231 virtual void Clear () = 0; 00232 00236 virtual iMapNode* GetFirst () = 0; 00237 00241 virtual iMapNode* GetLast () = 0; 00242 00246 virtual void Invert () = 0; 00247 00251 virtual size_t GetNodeCount () = 0; 00252 }; 00253 00254 00258 struct iCelGraph : public virtual iBase 00259 { 00260 SCF_INTERFACE (iCelGraph, 1, 0, 4); 00261 00265 virtual iObject* QueryObject () = 0; 00266 00270 virtual iCelNode* CreateNode (const char* name, csVector3 &pos) = 0; 00271 00275 virtual size_t AddNode (iCelNode* node) = 0; 00276 00280 virtual void AddEdge (iCelNode* from, iCelNode* to, bool state) = 0; 00281 00285 virtual bool AddEdgeByNames (const char* from, const char* to, bool state) = 0; 00286 00290 virtual iCelNode* GetClosest (csVector3 position) = 0; 00291 00295 virtual bool ShortestPath (iCelNode* from, iCelNode* goal, iCelPath* path) = 0; 00296 00300 virtual iCelNode* RandomPath (iCelNode* from, int distance, iCelPath* path) = 0; 00301 00305 virtual size_t GetNodeCount () = 0; 00306 00310 virtual iCelNode* GetNode (size_t idx) = 0; 00311 00315 virtual void RemoveNode (size_t idx) = 0; 00316 00320 virtual void RemoveEdge (iCelNode* from, size_t idx) = 0; 00321 00326 virtual size_t AddEdge (iCelNode* from, iCelNode* to, bool state, float weight) = 0; 00327 00331 virtual iCelNode* CreateEmptyNode (size_t& index) = 0; 00332 00336 virtual bool ShortestPath2 (iCelNode* from, iCelNode* goal, iCelPath* path) = 0; 00337 00338 }; 00339 00340 #endif //__CEL_CELGRAPH__ 00341
Generated for CEL: Crystal Entity Layer 2.1 by doxygen 1.6.1
