gwnavruntime/pathfollower/splineinputblobdumper.h Source File

splineinputblobdumper.h
Go to the documentation of this file.
1 /*
2 * Copyright 2016 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 #pragma once
8 
13 
14 namespace Kaim
15 {
16 
17 class CircleArcSplineComputer;
18 class StringStream;
19 
20 
21 // Internal: Class that configure a case tracker that save CircleArcSplineComputer
22 // inputs into a blob under specified conditions. This class is useful to track
23 // down mishandled edge cases.
24 class SplineInputBlobDumpConfig: public RefCountBase<SplineInputBlobDumpConfig, Stat_Debug_Mem>
25 {
26 public:
27  SplineInputBlobDumpConfig()
28  : m_baseName("CircleArcSplineComputerInput")
29  , m_trackedResultFlags(DumpAllFailureCases)
30  , m_trackedWarningFlags(0)
31  , m_maxSavedCase(50)
32  , m_minSqDistToLastSaved(0.1f)
33  , m_registredSavedCaseCount(0)
34  {}
35 
36  bool DoTrackAnyCase() const { return (m_trackedResultFlags != 0); }
37 
38  bool IsATrackedResult(CircleArcSplineComputationResult result, KyUInt32 warningFlags) const
39  {
40  if ((m_trackedResultFlags & result) != 0)
41  return true;
42  return ((warningFlags & m_trackedWarningFlags) != 0);
43  }
44 
45  static const KyUInt32 DumpAllFailureCases =
53 
54 public: // internal
55  // Internal: called only by the dumper itself to update saved case count
56  // and its start position.
57  void RegisterSavedCase(const Vec3f& savedCaseStartPos);
58  void GetCaseBlobName(StringStream& fileName) const;
59  bool IsCaseSaveAllowed(const Vec3f& caseStartPos) const;
60 
61 public:
62  const char* m_baseName;
63  KyUInt32 m_trackedResultFlags;
64  KyUInt32 m_trackedWarningFlags;
65  KyUInt32 m_maxSavedCase;
66  KyFloat32 m_minSqDistToLastSaved;
67 
68 private:
69  Vec3f m_lastSavedCaseStartPos;
70  KyUInt32 m_registredSavedCaseCount;
71 };
72 
73 
74 class SplineInputBlobDumper
75 {
76 public:
77  SplineInputBlobDumper(CircleArcSplineComputer* computer, Ptr<SplineInputBlobDumpConfig> config)
78  : m_computer(computer)
79  , m_config(config)
80  , m_saveBlobAtDestruction(false)
81  {
82  if (m_config)
83  m_saveBlobAtDestruction = m_config->DoTrackAnyCase();
84  }
85 
86  ~SplineInputBlobDumper()
87  {
88  if (m_saveBlobAtDestruction)
89  SaveBlob();
90  }
91 
92  KyResult SaveBlob();
93 
94 public:
95  CircleArcSplineComputer* m_computer;
96  Ptr<SplineInputBlobDumpConfig> m_config;
97  bool m_saveBlobAtDestruction;
98 };
99 
100 } // namespace Kaim
101 
An error occurred while computing optimized turns.
Definition: circlearcsplinecomputationresult.h:26
The string puller result is invalid (it returned an empty list).
Definition: circlearcsplinecomputationresult.h:24
std::uint32_t KyUInt32
uint32_t
Definition: types.h:29
Inputs are invalid: startSection or endSection are invalid or not in the same Channel.
Definition: circlearcsplinecomputationresult.h:21
Navigation return code class.
Definition: types.h:108
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
CircleArcSplineComputationResult
Enumerates the CircleArcSpline computation results.
Definition: circlearcsplinecomputationresult.h:15
Turn list could not be converted into CircleArcSpline (a turn is not correctly defined).
Definition: circlearcsplinecomputationresult.h:27
The string puller failed.
Definition: circlearcsplinecomputationresult.h:23
BubbleArray could not be build from Channel and start constraints.
Definition: circlearcsplinecomputationresult.h:22
The string puller result could not be converted into turn list (an edge or circle arc quits the Chann...
Definition: circlearcsplinecomputationresult.h:25
float KyFloat32
float
Definition: types.h:32