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 "csitil/scf_implementation.h" 00026 #include "csutil/flags.h" 00027 #include "csutil/stringarray.h" 00028 #include <ivaria/mapnode.h> 00029 00030 struct iCelNode; 00031 00035 struct iCelEdge : public virtual iBase 00036 { 00037 SCF_INTERFACE (iCelEdge, 1, 0, 0); 00038 00043 virtual void SetState (bool open) = 0; 00044 00049 virtual void SetSuccessor (iCelNode* node) = 0; 00050 00051 00052 00057 virtual bool GetState () = 0; 00058 00059 00063 virtual iCelNode* GetSuccessor () = 0; 00064 00065 00069 //virtual iCelNode* GetPredecessor () = 0; 00070 }; 00071 00072 00076 struct iCelNode : public virtual iBase 00077 { 00078 SCF_INTERFACE (iCelNode, 1, 0, 0); 00079 00083 virtual void AddSuccessor (iCelNode* node, bool state) = 0; 00084 00089 virtual void SetMapNode (iMapNode* node) = 0; 00090 00096 virtual void SetParent (iCelNode* par)= 0; 00097 00102 virtual void SetName (const char* par)= 0; 00103 00109 virtual void Heuristic (float cost, iCelNode* goal)= 0; 00110 00111 00112 00116 virtual iMapNode* GetMapNode () = 0; 00117 00118 00122 virtual csVector3 GetPosition () = 0; 00123 00127 virtual const char* GetName () = 0; 00128 00129 00133 virtual iCelNode* GetParent () = 0; 00134 00135 00139 virtual csArray<iCelNode*> GetSuccessors () = 0; 00140 00141 00145 virtual csArray<iCelNode*> GetAllSuccessors () = 0; 00146 00150 virtual float GetHeuristic () = 0; 00151 00155 virtual float GetCost () = 0; 00156 00157 /* 00158 * Get Number of Edges 00159 */ 00160 virtual size_t GetEdgeCount() = 0; 00161 00162 /* 00163 * Get a node by index 00164 */ 00165 virtual iCelEdge *GetEdge(size_t idx) = 0; 00166 00170 //virtual csRefArray<iCelNode> GetPredecessors() = 0; 00171 }; 00172 00173 00177 struct iCelPath : public virtual iBase 00178 { 00179 SCF_INTERFACE (iCelPath, 2, 0, 0); 00180 00184 virtual iObject* QueryObject () = 0; 00185 00189 virtual void AddNode (iMapNode* node) = 0; 00190 00194 virtual void InsertNode (size_t pos, iMapNode* node) = 0; 00195 00196 00200 virtual iMapNode* Next () = 0; 00201 00202 00206 virtual iMapNode* Previous () = 0; 00207 00211 virtual iMapNode* Current () = 0; 00212 00216 virtual csVector3 CurrentPosition () = 0; 00217 00221 virtual iSector* CurrentSector () = 0; 00222 00223 00227 virtual bool HasNext () = 0; 00228 00229 00233 virtual bool HasPrevious () = 0; 00234 00238 virtual void Restart () = 0; 00239 00243 virtual void Clear () = 0; 00244 00248 virtual iMapNode* GetFirst () = 0; 00249 00253 virtual iMapNode* GetLast () = 0; 00254 00258 virtual void Invert () = 0; 00259 00260 /* 00261 * Get 00262 */ 00263 virtual size_t GetNodeCount() = 0; 00264 }; 00265 00266 00270 struct iCelGraph : public virtual iBase 00271 { 00272 SCF_INTERFACE (iCelGraph, 1, 0, 0); 00273 00277 virtual iObject* QueryObject () = 0; 00278 00282 virtual iCelNode *CreateNode (const char* name, csVector3 &pos) = 0; 00283 00287 virtual void AddNode (iCelNode* node) = 0; 00288 00292 virtual void AddEdge (iCelNode* from, iCelNode* to, bool state) = 0; 00293 00297 virtual bool AddEdgeByNames (const char* from, const char* to, bool state) = 0; 00298 00302 virtual iCelNode* GetClosest (csVector3 position) = 0; 00303 00304 00308 virtual bool ShortestPath (iCelNode* from, iCelNode* goal, iCelPath* path) = 0; 00309 00313 virtual iCelNode* RandomPath (iCelNode* from, int distance, iCelPath* path) = 0; 00314 00318 virtual size_t GetNodeCount() = 0; 00319 00320 /* 00321 * Get a node by index 00322 */ 00323 virtual iCelNode *GetNode(size_t idx) = 0; 00324 00329 //virtual float Heuristic (iCelNode* from, iCelNode* to) = 0; 00330 00331 }; 00332 00333 #endif //__CEL_CELGRAPH__ 00334
Generated for CEL: Crystal Entity Layer 1.4.1 by doxygen 1.7.1