8 #ifndef Navigation_IQuery_H
9 #define Navigation_IQuery_H
38 TypeSpatializedPointCollectorInAABB,
39 TypeTriangleFromPosAndTriangleSeed,
40 TypeNearestBorderHalfEdgeFromPos,
44 TypeInsidePosFromOutsidePos,
45 TypeMultipleFloorTrianglesFromPos,
46 TypeRayCanGoOnSegment,
49 TypeFindFirstVisiblePositionOnPath,
50 TypeBestGraphVertexPathFinderQuery,
51 TypeMakeNavFloorStitchQuery,
55 TypeTagVolumesFromPos,
56 TypeMultiDestinationPathFinderQuery,
57 TypeCircleArcSplineComputation,
68 QueryStat_Spatialization,
71 QueryStat_ProgressOnPath,
72 QueryStat_PathValidityInterval,
73 QueryStat_TargetOnPathIsStillVisible,
74 QueryStat_TargetOnPathShortcutForward,
75 QueryStat_TargetOnPathSearchBackward,
85 PerformQueryStat_Count,
86 PerformQueryStat_Unspecified = PerformQueryStat_Count,
103 QueryPushedAsCommand,
107 enum QueryProcessMode
109 QueryProcessMode_Sync,
110 QueryProcessMode_ASync
117 class IOnDone :
public RefCountBase<IOnDone, MemStat_Query>
122 virtual void OnDone() = 0;
126 class IQuery :
public RefCountBase<IQuery, MemStat_Query>
169 void* GetTraverseLogicUserData() const;
183 virtual
void Advance(WorkingMemory* workingMemory) = 0;
195 virtual Ptr<BaseBlobHandler> CreateQueryBlobHandler() {
return KY_NULL; }
196 virtual void BuildQueryBlob(Kaim::BaseBlobHandler* ) {}
197 virtual void InitFromQueryBlob(World* ,
void* ) {}
200 static const char* GetQueryTypeName(
QueryType queryType);
237 class IAtomicQuery :
public IQuery
241 virtual ~IAtomicQuery() {}
252 class ITimeSlicedQuery :
public IQuery
256 virtual ~ITimeSlicedQuery();
288 KY_INLINE IQuery::IQuery() :
289 m_processStatus(QueryNotStarted),
291 m_traverseLogicUserData(
KY_NULL),
293 m_inQueueStatus(QueryNotInQueue),
297 KY_INLINE IQuery::~IQuery() {}
301 KY_LOG_ERROR_IF(database ==
KY_NULL, (
"The database you are bounding the query to is not valid."));
302 KY_LOG_ERROR_IF(
CanBeInitialized() ==
false, (
"You cannot bind a query to a Database while it is registered in a QueryQueue."));
309 KY_LOG_ERROR_IF(
m_database ==
KY_NULL, (
"This query must have been bound to a valid Database before calling Initialize"));
310 KY_LOG_ERROR_IF(
CanBeInitialized() ==
false, (
"You cannot initialized a query while it is registered in a QueryQueue."));
331 KY_INLINE IAtomicQuery::IAtomicQuery() : m_performQueryStat(PerformQueryStat_Unspecified) {}
332 KY_INLINE
void IAtomicQuery::SetPerformQueryStat(
PerformQueryStat performQueryStat) { m_performQueryStat = performQueryStat; }
333 KY_INLINE
PerformQueryStat IAtomicQuery::GetPerformQueryStat() {
return m_performQueryStat; }
337 KY_INLINE ITimeSlicedQuery::ITimeSlicedQuery() : m_advanceCount(0), m_lastAdvanceFrameIdx(0) {}
338 KY_INLINE ITimeSlicedQuery::~ITimeSlicedQuery() {}
343 m_lastAdvanceFrameIdx = 0;
KyInt32 KyResult
Defines a type that can be returned by methods or functions in the Gameware Navigation SDK to indicat...
Definition: types.h:254
QueryProcessStatus m_processStatus
Modified by the query within Advance().
Definition: iquery.h:272
CommonQueryResult
Enumerates the result codes that are common to all queries.
Definition: iquery.h:344
virtual void Advance(WorkingMemory *workingMemory)=0
This function is called by the QueryQueue to process one step on the query.
virtual void ReleaseWorkingMemoryOnCancelDuringProcess(WorkingMemory *workingMemory)=0
Called when a query is canceled in FlushCommands while its status is QueryInProcess to make sure that...
#define KY_NULL
Null value.
Definition: types.h:247
bool IsSafeToReadResult() const
Returns true if the query has been processed, is no longer in a queue, and OnDone (if there is one) h...
Definition: iquery.h:381
bool CanBeInitialized() const
In the case of a query processed in a QueryQueue, this must be tested before initializing the query...
Definition: iquery.h:379
Ptr< IOnDone > m_onDone
The optional IOnDone instance to be called. Must be set manually by the user. See IOnDone...
Definition: iquery.h:273
QueryType
Enumerates all the type of query.
Definition: iquery.h:29
Small interface class that you have to derive from and set to an IQuery to get the IOnDone::OnDone() ...
Definition: iquery.h:119
Definition: gamekitcrowddispersion.h:20
Indicates that the query has not yet been initialized.
Definition: iquery.h:346
QueryProcessStatus
Enumerates all the processing status a query can have.
Definition: iquery.h:91
#define KY_DEFINE_NEW_DELETE_OPERATORS(MemStat)
This macro defines new and delete operators.
Definition: memory.h:137
void BindToDatabase(Database *database)
Should be called by the derived class before Initializing the query It sets m_database to the provide...
Definition: iquery.h:364
bool IsInAQueryQueue() const
Returns true if the query is currently registered in a QueryQueue.
Definition: iquery.h:380
QueryStatusInQueue m_inQueueStatus
Used by the QueryQueue. Do not modify.
Definition: iquery.h:281
PerformQueryStat
Definition: iquery.h:66
void PerformQueryBlocking(WorkingMemory *workingMemory=0)
Process the query at once whether it is time-sliced or not.
unsigned int KyUInt32
Type used internally to represent an unsigned 32-bit integer.
Definition: types.h:36
QueryQueue * m_queue
Updated by the QueryQueue. Do not modify.
Definition: iquery.h:280
Indicates that the query has not yet been launched.
Definition: iquery.h:347
void * m_traverseLogicUserData
This userData is typically passed by the Bot.
Definition: iquery.h:278
can be used sporadically to differentiate from PerformQueryStat_Unspecified
Definition: iquery.h:84
void Initialize()
Should be called by the derived class before trying to perform the query or to push it in a QueryQueu...
Definition: iquery.h:404
void Initialize()
Should be called by the derived class before trying to perform the query or to push it in a QueryQueu...
Definition: iquery.h:372
Database * m_database
The database on which the query will be performed. Set in Initialize(), do not directly modify...
Definition: iquery.h:277
void OnDone()
Calls the OnDone function of the IOnDone object if provided.
Definition: iquery.h:386
QueryStatusInQueue
Enumerates the different states a query may have in a QueryQueue.
Definition: iquery.h:101
void SetTraverseLogicUserData(void *traverseLogicUserData)
Should be set for queries templated by a traverse logic, useless otherwise.
Definition: iquery.h:384