gwnavruntime/pathfollower/splineinputblobdumper.h Source File

splineinputblobdumper.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 // primary contact: LAPA - secondary contact: NOBODY
8 #ifndef Navigation_SplineInputBlobDumper_H
9 #define Navigation_SplineInputBlobDumper_H
10 
16 
17 namespace Kaim
18 {
19 
20 class CircleArcSplineComputer;
21 class StringStream;
22 
23 
24 // Internal: Class that configure a case tracker that save CircleArcSplineComputer
25 // inputs into a blob under specified conditions. This class is useful to track
26 // down mishandled edge cases.
27 class SplineInputBlobDumpConfig: public RefCountBase<SplineInputBlobDumpConfig, Stat_Debug_Mem>
28 {
29 public:
30  SplineInputBlobDumpConfig()
31  : m_baseName("CircleArcSplineComputerInput")
32  , m_trackedResultFlags(DumpAllFailureCases)
33  , m_trackedWarningFlags(0)
34  , m_maxSavedCase(50)
35  , m_minSqDistToLastSaved(0.1f)
36  , m_registredSavedCaseCount(0)
37  {}
38 
39  bool DoTrackAnyCase() const { return (m_trackedResultFlags != 0); }
40 
41  bool IsATrackedResult(CircleArcSplineComputationResult result, KyUInt32 warningFlags) const
42  {
43  if ((m_trackedResultFlags & result) != 0)
44  return true;
45  return ((warningFlags & m_trackedWarningFlags) != 0);
46  }
47 
48  static const KyUInt32 DumpAllFailureCases =
56 
57 public: // Internal
58  // Internal: called only by the dumper itself to update saved case count
59  // and its start position.
60  void RegisterSavedCase(const Vec3f& savedCaseStartPos);
61  void GetCaseBlobName(StringStream& fileName) const;
62  bool IsCaseSaveAllowed(const Vec3f& caseStartPos) const;
63 
64 public:
65  const char* m_baseName;
66  KyUInt32 m_trackedResultFlags;
67  KyUInt32 m_trackedWarningFlags;
68  KyUInt32 m_maxSavedCase;
69  KyFloat32 m_minSqDistToLastSaved;
70 
71 private:
72  Vec3f m_lastSavedCaseStartPos;
73  KyUInt32 m_registredSavedCaseCount;
74 };
75 
76 
77 class SplineInputBlobDumper
78 {
79 public:
80  SplineInputBlobDumper(CircleArcSplineComputer* computer, Ptr<SplineInputBlobDumpConfig> config)
81  : m_computer(computer)
82  , m_config(config)
83  , m_saveBlobAtDestruction(false)
84  {
85  if (m_config)
86  m_saveBlobAtDestruction = m_config->DoTrackAnyCase();
87  }
88 
89  ~SplineInputBlobDumper()
90  {
91  if (m_saveBlobAtDestruction)
92  SaveBlob();
93  }
94 
95  KyResult SaveBlob();
96 
97 public:
98  CircleArcSplineComputer* m_computer;
99  Ptr<SplineInputBlobDumpConfig> m_config;
100  bool m_saveBlobAtDestruction;
101 };
102 
103 } // namespace Kaim
104 
105 #endif
An error occurred while computing optimized turns.
Definition: circlearcsplinecomputationresult.h:28
The string puller result is invalid (it returned an empty list).
Definition: circlearcsplinecomputationresult.h:26
KyInt32 KyResult
Defines a type that can be returned by methods or functions in the Gameware Navigation SDK to indicat...
Definition: types.h:254
Inputs are invalid: startSection or endSection are invalid or not in the same Channel.
Definition: circlearcsplinecomputationresult.h:23
Definition: gamekitcrowddispersion.h:20
CircleArcSplineComputationResult
Enumerates the CircleArcSpline computation results.
Definition: circlearcsplinecomputationresult.h:17
Turn list could not be converted into CircleArcSpline (a turn is not correctly defined).
Definition: circlearcsplinecomputationresult.h:29
The string puller failed.
Definition: circlearcsplinecomputationresult.h:25
unsigned int KyUInt32
Type used internally to represent an unsigned 32-bit integer.
Definition: types.h:36
BubbleArray could not be build from Channel and start constraints.
Definition: circlearcsplinecomputationresult.h:24
The string puller result could not be converted into turn list (an edge or circle arc quits the Chann...
Definition: circlearcsplinecomputationresult.h:27
float KyFloat32
Type used internally to represent a 32-bit floating-point number.
Definition: types.h:43