gwnavruntime/queries/blobs/pathfinderqueryblob.h Source File

pathfinderqueryblob.h
Go to the documentation of this file.
1 /*
2 * Copyright 2015 Autodesk, Inc. All rights reserved.
3 * Use of this software is subject to the terms of the Autodesk license agreement and any attachments or Appendices thereto provided at the time of installation or download,
4 * or which otherwise accompanies this software in either electronic or hard copy form, or which is signed by you and accepted by Autodesk.
5 */
6 
7 
8 #ifndef Navigation_PathFinderQueryBlob_H
9 #define Navigation_PathFinderQueryBlob_H
10 
13 namespace Kaim
14 {
15 
16 class PathFinderQueryBlob
17 {
18  KY_ROOT_BLOB_CLASS(Query, PathFinderQueryBlob, 0)
19 
20 public:
21  PathFinderQueryBlob() : m_queryType(KyUInt32MAXVAL), m_result((KyUInt32)IPathFinderQuery::PathFinderNotInitialized), m_isPathfinderWithDest(0) {}
22 
23  Vec3f m_startPos3f;
24  Vec3f m_destPos3f;
25  KyUInt32 m_queryType;
26  KyUInt32 m_result;
27  BlobArray<char> m_errorMessage;
28  KyUInt8 m_isPathfinderWithDest; // 0(false) or 1(true)
29 };
30 inline void SwapEndianness(Endianness::Target e, PathFinderQueryBlob& self)
31 {
32  SwapEndianness(e, self.m_startPos3f);
33  SwapEndianness(e, self.m_destPos3f);
34  SwapEndianness(e, self.m_queryType);
35  SwapEndianness(e, self.m_result);
36  SwapEndianness(e, self.m_errorMessage);
37  SwapEndianness(e, self.m_isPathfinderWithDest);
38 }
39 
40 class PathFinderInfoBlobBuilder: public BaseBlobBuilder<PathFinderQueryBlob>
41 {
42  KY_CLASS_WITHOUT_COPY(PathFinderInfoBlobBuilder)
43 
44 public:
45  PathFinderInfoBlobBuilder(const IPathFinderQuery* pathFinderQuery): m_pathFinderQuery(pathFinderQuery) {}
46  ~PathFinderInfoBlobBuilder() {}
47 
48 private:
49  virtual void DoBuild()
50  {
51  if (m_pathFinderQuery != NULL)
52  {
53  BLOB_SET(m_blob->m_startPos3f, m_pathFinderQuery->m_startPos3f);
54  const Vec3f* dest = m_pathFinderQuery->GetDestination();
55  if (dest == KY_NULL)
56  {
57  BLOB_SET(m_blob->m_isPathfinderWithDest, 1);
59  }
60  else
61  {
62  BLOB_SET(m_blob->m_isPathfinderWithDest, 1);
63  BLOB_SET(m_blob->m_destPos3f, *dest);
64  }
65 
66  BLOB_SET(m_blob->m_queryType, (KyUInt32)m_pathFinderQuery->GetType());
67  BLOB_SET(m_blob->m_result, (KyUInt32)m_pathFinderQuery->GetPathFinderResult());
68  String text;
69  m_pathFinderQuery->GetPathFinderTextResult(text);
70  BLOB_STRING(m_blob->m_errorMessage, text.ToCStr());
71  }
72  }
73 
74 private:
75  const IPathFinderQuery* m_pathFinderQuery;
76 };
77 
78 
79 }
80 
81 #endif // Kaim_PathFinderQueryInputBlob_H
#define BLOB_SET(blob, value)
Use this macro only in implementations of BaseBlobBuilder::DoBuild().
Definition: baseblobbuilder.h:136
#define KyFloat32MAXVAL
The maximum value that can be stored in the KyFloat32 variable type.
Definition: types.h:227
#define KY_NULL
Null value.
Definition: types.h:247
#define KY_CLASS_WITHOUT_COPY(ClassName)
Define to forbid copy constructor and copy assignment.
Definition: types.h:387
Target
Enumerates the possible endianness types relative to the current platform.
Definition: endianness.h:35
unsigned char KyUInt8
Type used internally to represent an unsigned 8-bit integer.
Definition: types.h:41
PathFinderQueryBlob * m_blob
The blob maintained by this builder. Only modify using the macros listed under DoBuild().
Definition: baseblobbuilder.h:117
Definition: gamekitcrowddispersion.h:20
#define BLOB_STRING(str, src)
Use this macro only in implementations of BaseBlobBuilder::DoBuild().
Definition: baseblobbuilder.h:179
unsigned int KyUInt32
Type used internally to represent an unsigned 32-bit integer.
Definition: types.h:36
#define KyUInt32MAXVAL
The maximum value that can be stored in the KyUInt32 variable type.
Definition: types.h:226