Cogs.Core
Extensions
EchoSounder
Source
Systems
DataSetSystem.h
1
#pragma once
2
3
#include "ExtensionRegistry.h"
4
#include "Systems/ComponentSystem.h"
5
6
#include "../Components/DataSetComponent.h"
7
8
namespace
Cogs
9
{
10
namespace
Core
11
{
12
namespace
EchoSounder
13
{
14
struct
PingMetaData
15
{
16
glm::quat vesselOrientationGlobal;
17
glm::vec3 vesselPositionGlobal;
18
glm::quat arrayOrientationVessel;
19
glm::vec3 arrayPositionVessel;
20
glm::quat arrayOrientationGlobal;
21
glm::vec3 arrayPositionGlobal;
22
};
23
24
struct
DataSetBuffers
25
{
26
uint32_t sliceBegin = 0;
27
uint32_t sliceCount = 0;
28
Memory::TypedBuffer<int64_t>
timestamps;
29
Memory::TypedBuffer<float>
values;
30
Memory::TypedBuffer<float>
bottomDepths;
31
Memory::TypedBuffer<float>
bottomReflectivities;
32
Memory::TypedBuffer<PingMetaData>
metaPings;
33
Memory::TypedBuffer<float>
distances;
34
};
35
36
// Data used by re-sampling task, must be kept alive as long
37
// as task is running regardless of component gets removed or not.
38
struct
DataSetPersistent
39
{
40
// Current data
41
Config
config;
42
DataSetBuffers
buffer;
43
44
// New data if dataReady is true.
45
Config
configNew;
46
DataSetBuffers
bufferNew;
47
48
bool
dataReady =
false
;
49
bool
configReady =
false
;
50
bool
configValid =
false
;
51
std::atomic<int> runningTasks = 0;
52
};
53
54
struct
DataSetData
55
{
56
DataSetData
()
57
{
58
persistent.reset(
new
DataSetPersistent
);
59
}
60
61
std::shared_ptr<DataSetPersistent> persistent;
62
63
uint32_t configGen = 0;
64
uint32_t dataGen = 0;
//increased when data is changed
65
uint32_t clearGen = 0;
//increased when data is cleared
66
uint32_t slicePreservedBegin = 0;
67
uint32_t slicePreservedCount = 0;
68
};
69
70
struct
DataSetSystem
71
:
public
ComponentSystemWithDataPool
<DataSetComponent, DataSetData>
72
{
73
public
:
74
DataSetSystem
(
Memory::Allocator
* allocator,
SizeType
capacity) :
ComponentSystemWithDataPool
(allocator, capacity) {}
75
76
void
update
(
Context
*
context
)
override
;
77
78
private
:
79
bool
handleConfigTransition(
Context
*
context
,
DataSetData
& dataData);
80
void
handleNewPing(
DataSetData
& dataData,
Ping
& ping);
81
void
resizeBuffers(
DataSetData
& dataData);
82
83
void
updateGridAngles(
DataSetData
& dataData);
84
};
85
86
}
87
}
88
}
Cogs::Core::ComponentSystemBase::context
Context * context
Pointer to the Context instance the system lives in.
Definition:
ComponentSystem.h:136
Cogs::Core::ComponentSystemBase::update
void update()
Updates the system state to that of the current frame.
Definition:
ComponentSystem.h:65
Cogs::Core::ComponentSystemWithDataPool
Component system with parallel data per component stored in a pool similar to how the components them...
Definition:
ComponentSystem.h:365
Cogs::Core::Context
A Context instance contains all the services, systems and runtime components needed to use Cogs.
Definition:
Context.h:83
Cogs::Memory::Allocator
Base allocator implementation.
Definition:
Allocator.h:30
Cogs::Memory::TypedBuffer
Definition:
MemoryBuffer.h:196
Cogs
Contains all Cogs related functionality.
Definition:
FieldSetter.h:23
Cogs::SizeType
ComponentIndex SizeType
Type used to track the size of pools.
Definition:
Component.h:19
Cogs::Core::EchoSounder::Config
Definition:
DataSetComponent.h:20
Cogs::Core::EchoSounder::DataSetBuffers
Definition:
DataSetSystem.h:25
Cogs::Core::EchoSounder::DataSetData
Definition:
DataSetSystem.h:55
Cogs::Core::EchoSounder::DataSetPersistent
Definition:
DataSetSystem.h:39
Cogs::Core::EchoSounder::DataSetSystem
Definition:
DataSetSystem.h:72
Cogs::Core::EchoSounder::PingMetaData
Definition:
DataSetSystem.h:15
Cogs::Core::EchoSounder::Ping
Definition:
DataSetComponent.h:38
Generated by
1.9.6