gwnavruntime/path/positiononpathblob.h Source File

positiononpathblob.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 // primary contact: GUAL - secondary contact: NOBODY
9 #ifndef Navigation_PositionOnPathBlob_H
10 #define Navigation_PositionOnPathBlob_H
11 
17 
18 namespace Kaim
19 {
20 
21 class PositionOnPathBlob
22 {
23  KY_ROOT_BLOB_CLASS(Runtime, PositionOnPathBlob, 0)
24 
25 public:
26  PositionOnPathBlob() : m_edgeIndex(KyUInt32MAXVAL), m_onPathStatus((KyUInt32)PositionOnPathStatus_Undefined) {}
27 
28  PositionOnPathStatus GetPositionStatus() const { return (PositionOnPathStatus)m_onPathStatus; }
29 public:
30  Vec3f m_positionOnPath;
31  KyUInt32 m_edgeIndex;
32  KyUInt32 m_onPathStatus;
33 };
34 inline void SwapEndianness(Endianness::Target e, PositionOnPathBlob& self)
35 {
36  SwapEndianness(e, self.m_positionOnPath);
37  SwapEndianness(e, self.m_edgeIndex);
38  SwapEndianness(e, self.m_onPathStatus);
39 }
40 
41 
42 class PositionOnPathBlobBuilder: public BaseBlobBuilder<PositionOnPathBlob>
43 {
44  KY_CLASS_WITHOUT_COPY(PositionOnPathBlobBuilder)
45 
46 public:
47  PositionOnPathBlobBuilder(const PositionOnPath* positionOnPath)
48  : m_positionOnPath(positionOnPath)
49  {}
50  ~PositionOnPathBlobBuilder() {}
51 
52 private:
53  virtual void DoBuild()
54  {
55  if ((m_positionOnPath != NULL) && (m_positionOnPath->GetPositionOnPathStatus() != PositionOnPathStatus_Undefined))
56  {
57  BLOB_SET(m_blob->m_positionOnPath, m_positionOnPath->GetPosition());
58  if (m_positionOnPath->GetPositionOnPathStatus() != PositionOnPathStatus_Undefined)
59  {
60  BLOB_SET(m_blob->m_edgeIndex , m_positionOnPath->GetPathEdgeIndex());
61  }
62  BLOB_SET(m_blob->m_onPathStatus, (KyUInt32)m_positionOnPath->GetPositionOnPathStatus());
63  }
64  }
65 
66 private:
67  const PositionOnPath* m_positionOnPath;
68 };
69 
70 
71 }
72 
73 #endif
#define BLOB_SET(blob, value)
Use this macro only in implementations of BaseBlobBuilder::DoBuild().
Definition: baseblobbuilder.h:136
PositionOnPathStatus
< enumerates="" the="" different="" status="" an="" objectpositiononpath="" can="" have="" on="" its="" path.="" />
Definition: positiononpath.h:20
#define KY_CLASS_WITHOUT_COPY(ClassName)
Define to forbid copy constructor and copy assignment.
Definition: types.h:387
The PositionOnPath is not yet defined.
Definition: positiononpath.h:22
Target
Enumerates the possible endianness types relative to the current platform.
Definition: endianness.h:35
PositionOnPathBlob * m_blob
The blob maintained by this builder. Only modify using the macros listed under DoBuild().
Definition: baseblobbuilder.h:117
Definition: gamekitcrowddispersion.h:20
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