/* in order to compile AI in C++ and link with GAM in C*/
#if defined(__cplusplus)
extern "C"
{
#endif
 
#if !defined(__WPGRAPH_TYPES__)
#define __WPGRAPH_TYPES__
 
#if !defined(ONLY_TYPES)
#define WPGRAPH_UNDEF
#define ONLY_TYPES
#endif /* !ONLY_TYPES */
 
/*
------------------------------------------------------------------------------------------
INCLUDE FILES :
------------------------------------------------------------------------------------------
*/
#include "Acp_Base.h"
#include "SPO.h"
#include "MTH.h"
 
/*
----------------------------------------
File Name :
 WP_Handl.h
----------------------------------------
Required for :
 Defines waypoint handles.
----------------------------------------
*/
#include "WP_Handl.h"
#include "WP_Func.h"
 
 
#if defined(WPGRAPH_UNDEF)
#undef ONLY_TYPES
#undef WPGRAPH_UNDEF
#endif /* !WPWAYPT_UNDEF */
 
/*
------------------------------------------------------------------------------------------
TYPE AND STRUCTURE DEFINITION :
------------------------------------------------------------------------------------------
*/
 
/*#ifdef _WP_D_WPGRAPH_FRIEND_*/
 
LST2_M_DynamicUseListOf(WP_tdhGraphNode) ;
 
typedef struct WP_tdstGraphNode_ {
	LST2_M_DynamicElementDeclaration(WP_tdhGraphNode) 
	WP_tdhWayPoint         m_hWayPoint ;  /* reference to the WayPoint */
  long m_lTypeOfWP; /*BART*/
  long m_lTypeOfWPInit; /*BART*/
	WP_tdHandleOfListOfArc m_hListOfArc ; /* list of link of the node */
} WP_tdstGraphNode;
 
 
typedef struct WP_tdstGraph_ {
	LST2_M_DynamicAnchorDeclaration(WP_tdhGraphNode) m_hListOfNode ;
#ifdef GAM_USE_SCRIPT
  char* m_szNameOfGraph;
  char* m_szReferenceSection;
#endif
} WP_tdstGraph;
 
/*#endif /* _WP_D_WPGRAPH_FRIEND_   */
 
#endif /* !__WPGRAPH_TYPES__ */
 
#if !defined(ONLY_TYPES)
 
#if !defined(__WPGRAPH_VARS__)
#define __WWPGRAPH_VARS__
 
#undef WP_WAYPOINT_EXTERN
#undef extern
#if !defined(WP_D_WPGRAPH_GLOBALS_)
#define WP_WAYPOINT_EXTERN extern
#else /* !WP_D_WPGRAPH_GLOBALS_ */
#define WP_WAYPOINT_EXTERN
#endif /* !WP_D_WPGRAPH_GLOBALS_ */
 
/*
------------------------------------------------------------------------------------------
VARIABLE DECLARATION :
 <type> <variable name>
 #if defined(WP_D_WAYPOINT_GLOBALS_)
 = <initial values>
 #endif
 ;
------------------------------------------------------------------------------------------
*/
 
/*
------------------------------------------------------------------------------------------
MACROS-CONSTANT DECLARATION:
------------------------------------------------------------------------------------------
*/
/* allready defined in WP_Handl.h
#define WP_C_hWayPointInvalid ((WP_tdhWayPoint)0)
*/
 
#undef extern
#endif /* !__WPWAYPT_VARS__ */
 
#if !defined (__WPGRAPH_PROTOS__)
#define __WPGRAPH_PROTOS__
 
/****************************************/
#if !defined(CPA_EXPORT)
#if defined(CPA_WANTS_IMPORT)
#define CPA_EXPORT __declspec(dllimport)
#elif defined(CPA_WANTS_EXPORT)
#define CPA_EXPORT __declspec(dllexport)
#else
#define CPA_EXPORT
#endif /*CPA_WANTS_IMPORT || CPA_WANTS_EXPORT*/
#endif /*CPA_EXPORT*/
/****************************************/
 
/*
------------------------------------------------------------------------------------------
MACROS-FUNCTIONS DECLARATION:
------------------------------------------------------------------------------------------
*/
 
/*
------------------------------------------------------------------------------------------
FUNCTIONS DECLARATION:
------------------------------------------------------------------------------------------
*/
 
 
/* list of graph */
CPA_EXPORT WP_tdHandleOfGraph WPG_fn_hGetGraph (char*  _szName);
CPA_EXPORT void WPG_fn_vAddGlobalGraph(WP_tdHandleOfGraph hGraph) ;
CPA_EXPORT void WPG_fn_vDestroyAllGraph (void) ;
 
/* Graph managment */
/*CPA_EXPORT WP_tdHandleOfGraph WPG_fn_hCreate (void) ;*/
CPA_EXPORT WP_tdHandleOfGraph WPG_fn_hCreate (char* _szName, char* _szReference) ;
 
/*ROMTEAM Network (Gabriela Dumitrascu 15/03/98)*/
CPA_EXPORT char* WPG_fn_pGetNameOfGraph(WP_tdHandleOfGraph hGraph);
CPA_EXPORT void  WPG_fn_vSetNameOfGraph(WP_tdHandleOfGraph hGraph, const char* _szName);
CPA_EXPORT char* WPG_fn_pGetReferenceSection(WP_tdHandleOfGraph hGraph);
CPA_EXPORT void  WPG_fn_vSetReferenceSection(WP_tdHandleOfGraph hGraph, const char* _szReferenceSection);
 
CPA_EXPORT void  WPG_fn_vCopy (WP_tdHandleOfGraph hDst,WP_tdHandleOfGraph hSrc);
/*ENDROMTEAM Network (Gabriela Dumitrascu)*/
 
CPA_EXPORT void WPG_fn_vDestroy (WP_tdHandleOfGraph hGraph) ;
CPA_EXPORT long WPG_fn_lAddWayPointIfNotExists (WP_tdHandleOfGraph _hGraph,
                                                WP_tdhWayPoint _hWayPoint, long _lTypeOfWP); /*BART*/
CPA_EXPORT long WPG_fn_lAddWayPoint (WP_tdHandleOfGraph _hGraph, 
																		 WP_tdhWayPoint _hWayPoint, long _lTypeOfWP); /*BART*/
CPA_EXPORT long WPG_fn_lChangeTypeOfWP (WP_tdHandleOfGraph _hGraph, WP_tdhWayPoint _hWayPoint, long _lTypeOfWP); /* BART*/
 
CPA_EXPORT long WPG_fn_lRemoveWayPoint (WP_tdHandleOfGraph hGraph,
																		    WP_tdhWayPoint hWayPoint) ;
CPA_EXPORT long WPG_fn_lAddArcToWayPoint (WP_tdHandleOfGraph hGraph, 
																			WP_tdhWayPoint hSrcWayPoint, 
																			WP_tdhWayPoint hDstWayPoint, 
																			long lWeight, unsigned long ulCapability) ;
CPA_EXPORT long WPG_fn_lRemoveArcFromWayPoint (WP_tdHandleOfGraph hGraph, 
																			WP_tdhWayPoint hSrcWayPoint, 
																			WP_tdhWayPoint hDstWayPoint ) ;
 
CPA_EXPORT long WPG_fn_lChangeLinkCapabilities (WP_tdHandleOfGraph hGraph, 
                                                WP_tdhWayPoint hSrcWayPoint, 
                                                WP_tdhWayPoint hDstWayPoint, 
                                                unsigned long ulCapability, long lValue ) ;
CPA_EXPORT long WPG_fn_lGetLinkCapabilities (WP_tdHandleOfGraph hGraph, 
                                             WP_tdhWayPoint hSrcWayPoint, 
                                             WP_tdhWayPoint hDstWayPoint, 
                                             unsigned long* p_ulCapability ) ;
CPA_EXPORT long WPG_fn_lChangeLinkWeight (WP_tdHandleOfGraph hGraph, 
                                          WP_tdhWayPoint hSrcWayPoint, 
                                          WP_tdhWayPoint hDstWayPoint, 
                                          long lWeight) ;
CPA_EXPORT long WPG_fn_lGetLinkWeight (WP_tdHandleOfGraph hGraph, 
                                       WP_tdhWayPoint hSrcWayPoint, 
                                       WP_tdhWayPoint hDstWayPoint, 
                                       long *p_lWeight ) ;
 
CPA_EXPORT void WPG_fn_vReinitGraph (WP_tdHandleOfGraph hGraph) ;
 
 
CPA_EXPORT WP_tdHandleOfGraph  WPG_fn_lShortestPath (WP_tdHandleOfGraph hGraph, 
																			               WP_tdhWayPoint hSrcWayPoint, 
																			               WP_tdhWayPoint hDstWayPoint, 
																			               unsigned long ulCapability) ;
/*bart:*/
CPA_EXPORT WP_tdHandleOfGraph WPG_fn_lBuildOrderedPath(WP_tdHandleOfGraph hGraph, WP_tdhWayPoint hStartWP);
 
CPA_EXPORT WP_tdhWayPoint WPG_fn_hGetFirstWaypointOfGraph (WP_tdHandleOfGraph hGraph) ;
CPA_EXPORT WP_tdhWayPoint WPG_fn_hGetLastWaypointOfGraph (WP_tdHandleOfGraph hGraph) ;
CPA_EXPORT long WPG_fn_lNumberOfWaypointOfGraph (WP_tdHandleOfGraph hGraph) ;
CPA_EXPORT WP_tdhWayPoint WPG_fn_hGetWaypointOfGraph (WP_tdHandleOfGraph hGraph, 
																											int iIndex, long* _plTypeOfWP) ; /*BART*/
 
CPA_EXPORT char *WPG_fn_szGetReferenceSection (WP_tdHandleOfGraph hGraph) ;
 
 
/* Graph node managment */
CPA_EXPORT WP_tdhGraphNode WPG_fn_hCreateNode (WP_tdhWayPoint _hWayPoint, long _lTypeOfWP); /*BART*/
CPA_EXPORT void WPG_fn_vDestroyNode (WP_tdhGraphNode hNode) ;
CPA_EXPORT void WPG_fn_vAddArc (WP_tdhGraphNode hSrcNode, WP_tdhGraphNode hDstNode, 
																unsigned long ulCapability, long lWeight) ;
CPA_EXPORT void WPG_fn_vRemoveArc (WP_tdhGraphNode hSrcNode, 
																	 WP_tdhGraphNode hDstNode ) ;
CPA_EXPORT WP_tdHandleOfListOfArc WPG_fn_hGetArcList (WP_tdhGraphNode hSrcNode) ;
 
CPA_EXPORT long WPG_fn_lChangeArcCapabilities (WP_tdhGraphNode hSrcNode, WP_tdhGraphNode hDstNode, unsigned long ulCapability, long lValue) ;
CPA_EXPORT long WPG_fn_lGetArcCapabilities (WP_tdhGraphNode hSrcNode, WP_tdhGraphNode hDstNode, unsigned long* p_ulCapability) ;
CPA_EXPORT long WPG_fn_lChangeArcWeight ( WP_tdhGraphNode hSrcNode, WP_tdhGraphNode hDstNode, long lWeight) ;
CPA_EXPORT long WPG_fn_lGetArcWeight ( WP_tdhGraphNode hSrcNode, WP_tdhGraphNode hDstNode, long *p_lWeight) ;
 
/*DMJ*/
 
/*ROMTEAM Networks (Gabriela Dumitrascu 05/03/98)*/
/* export link table */
CPA_EXPORT struct SCR_tdst_Link_Table_ *WPG_fnp_Graph_GetLinkTable (void);
/*ENDROMTEAM Networks (Gabriela Dumitrascu)*/
 
#endif /* !__WPGRAPH_PROTOS__ */
 
#endif /* !ONLY_TYPES */
 
 
 
/* in order to compile AI in C++ and link with GAM in C*/
#if defined(__cplusplus)
}
#endif
 
