Plasma Engine  2.0
Loading...
Searching...
No Matches
ProcessingStreamGroup.h
1
2#pragma once
3
4#include <Foundation/Basics.h>
5#include <Foundation/Communication/Event.h>
6#include <Foundation/Containers/HybridArray.h>
7#include <Foundation/DataProcessing/Stream/ProcessingStream.h>
8
11
13{
14 plProcessingStreamGroup* m_pStreamGroup;
15 plUInt64 m_uiElementIndex;
16};
17
22
24class PL_FOUNDATION_DLL plProcessingStreamGroup
25{
26public:
29
32
33 void Clear();
34
38 void AddProcessor(plProcessingStreamProcessor* pProcessor);
39
41 void RemoveProcessor(plProcessingStreamProcessor* pProcessor);
42
44 void ClearProcessors();
45
49
51 void RemoveStreamByName(plStringView sName);
52
54 plProcessingStream* GetStreamByName(plStringView sName) const;
55
57 void SetSize(plUInt64 uiNumElements);
58
61 void RemoveElement(plUInt64 uiElementIndex);
62
65 void InitializeElements(plUInt64 uiNumElements);
66
68 void Process();
69
71 inline plUInt64 GetNumElements() const { return m_uiNumElements; }
72
74 inline plUInt64 GetNumActiveElements() const { return m_uiNumActiveElements; }
75
77 inline plUInt64 GetHighestNumActiveElements() const { return m_uiHighestNumActiveElements; }
78
81
82private:
84 void RunPendingDeletions();
85
86 void EnsureStreamAssignmentValid();
87
88 void RunPendingSpawns();
89
90 void SortProcessorsByPriority();
91
93
95
96 plHybridArray<plUInt64, 64> m_PendingRemoveIndices;
97
98 plUInt64 m_uiPendingNumberOfElementsToSpawn;
99
100 plUInt64 m_uiNumElements;
101
102 plUInt64 m_uiNumActiveElements;
103
104 plUInt64 m_uiHighestNumActiveElements;
105
106 bool m_bStreamAssignmentDirty;
107};
Definition Event.h:177
A hybrid array uses in-place storage to handle the first few elements without any allocation....
Definition HybridArray.h:12
A stream group encapsulates the streams and the corresponding data processors.
Definition ProcessingStreamGroup.h:25
plEvent< const plStreamGroupElementRemovedEvent & > m_ElementRemovedEvent
Subscribe to this event to be informed when (shortly before) items are deleted.
Definition ProcessingStreamGroup.h:80
plUInt64 GetNumActiveElements() const
Returns the number of currently active elements.
Definition ProcessingStreamGroup.h:74
plUInt64 GetNumElements() const
Returns the number of elements the streams store.
Definition ProcessingStreamGroup.h:71
plUInt64 GetHighestNumActiveElements() const
Returns the highest number of active elements since the last SetSize() call.
Definition ProcessingStreamGroup.h:77
A single stream in a stream group holding contiguous data of a given type.
Definition ProcessingStream.h:8
DataType
The data types which can be stored in the stream. When adding new data types the GetDataTypeSize() of...
Definition ProcessingStream.h:13
Base class for all stream processor implementations.
Definition ProcessingStreamProcessor.h:11
plStringView represent a read-only sub-string of a larger string, as it can store a dedicated string ...
Definition StringView.h:34
Definition ProcessingStreamGroup.h:13
Definition ProcessingStreamGroup.h:19