Cogs.Core
SwathPathChunks.h
1#pragma once
2#include "Flags.h"
3
4#include "Foundation/Collections/FixedIndexQueue.h"
5
6namespace Cogs
7{
8 namespace Core
9 {
10 class Context;
11
12 namespace EchoSounder
13 {
14 class SwathPathResamplingPositions;
15
17 {
18 uint32_t a;
19 uint32_t b;
20 };
21 inline bool operator==(const IndexRange& x, const IndexRange& y) { return (x.a == y.a) && (x.b == y.b); }
22
23 enum class SwathPathChunkFlag : uint32_t {
24 None = 0,
25 Tail = 1,
26 Head = 2
27 };
28 ENABLE_ENUM_FLAGS(SwathPathChunkFlag);
29
31 {
36
38 SwathPathChunkFlag flags;
39 };
40 inline bool operator==(const SwathPathChunk& x, const SwathPathChunk& y) { return (x.support == y.support) && (x.extent == y.extent); }
41
43 {
44 public:
45 SwathPathChunks(uint32_t preferredExtent, uint32_t skirtSize);
46
47 void clear();
48
49 bool update(const SwathPathResamplingPositions& positions);
50
51 const uint32_t getGeneration() const { return generation; }
52
53 const Collections::FixedIndexQueue<SwathPathChunk, uint32_t>& getChunks() const { return chunks; };
54
55 private:
57 uint32_t preferredExtent;
58 uint32_t skirtSize;
59 uint32_t resamplingPosGen = 0;
60 uint32_t generation = 0;
61
62 bool retireEvictedPositions(const SwathPathResamplingPositions& positions);
63
64 bool seedIfQueueEmpty(const SwathPathResamplingPositions& positions);
65
66 bool tryGrowMoreRecent(const SwathPathResamplingPositions& positions);
67
68 bool tryGrowLessRecent(const SwathPathResamplingPositions& positions);
69
70 };
71
72 }
73 }
74}
Indexable queue where an element index is fixed through arbitrary enqueues and dequeues.
Contains all Cogs related functionality.
Definition: FieldSetter.h:23
uint32_t a
Start of range, inclusive.
uint32_t b
End of range, inclusive.
IndexRange support
All indexes relevant for this chunk.
IndexRange extent
The actual extent of the chunk.