4646#define SECTION_LIGHTSET
4747#endif
4848
49- namespace dmxnode
50- {
51- class Data
52- {
49+ namespace dmxnode {
50+ class Data {
5351 public:
54- static Data& Get ()
55- {
52+ static Data& Get () {
5653 static Data instance SECTION_LIGHTSET ;
5754 return instance;
5855 }
@@ -76,19 +73,16 @@ class Data
7673 static void Restore (uint32_t port_index, const uint8_t * data) { Get ().IRestore (port_index, data); }
7774
7875 private:
79- void IMergeSourceA (uint32_t port_index, const uint8_t * data, uint32_t length, MergeMode merge_mode)
80- {
76+ void IMergeSourceA (uint32_t port_index, const uint8_t * data, uint32_t length, MergeMode merge_mode) {
8177 assert (port_index < kPorts );
8278 assert (data != nullptr );
8379
8480 memcpy (output_port_[port_index].source_a .data , data, length);
8581
8682 output_port_[port_index].length = length;
8783
88- if (merge_mode == MergeMode::kHtp )
89- {
90- for (uint32_t i = 0 ; i < length; i++)
91- {
84+ if (merge_mode == MergeMode::kHtp ) {
85+ for (uint32_t i = 0 ; i < length; i++) {
9286 const auto kData = std::max (output_port_[port_index].source_a .data [i], output_port_[port_index].source_b .data [i]);
9387 output_port_[port_index].data [i] = kData ;
9488 }
@@ -99,19 +93,16 @@ class Data
9993 memcpy (output_port_[port_index].data , data, length);
10094 }
10195
102- void IMergeSourceB (uint32_t port_index, const uint8_t * data, uint32_t length, MergeMode merge_mode)
103- {
96+ void IMergeSourceB (uint32_t port_index, const uint8_t * data, uint32_t length, MergeMode merge_mode) {
10497 assert (port_index < kPorts );
10598 assert (data != nullptr );
10699
107100 memcpy (output_port_[port_index].source_b .data , data, length);
108101
109102 output_port_[port_index].length = length;
110103
111- if (merge_mode == MergeMode::kHtp )
112- {
113- for (uint32_t i = 0 ; i < length; i++)
114- {
104+ if (merge_mode == MergeMode::kHtp ) {
105+ for (uint32_t i = 0 ; i < length; i++) {
115106 const auto kData = std::max (output_port_[port_index].source_a .data [i], output_port_[port_index].source_b .data [i]);
116107 output_port_[port_index].data [i] = kData ;
117108 }
@@ -122,41 +113,35 @@ class Data
122113 memcpy (output_port_[port_index].data , data, length);
123114 }
124115
125- void IClear (uint32_t port_index)
126- {
116+ void IClear (uint32_t port_index) {
127117 assert (port_index < kPorts );
128118
129119 memset (output_port_[port_index].data , 0 , dmxnode::kUniverseSize );
130120 output_port_[port_index].length = dmxnode::kUniverseSize ;
131121 }
132122
133- void IClearLength (uint32_t port_index)
134- {
123+ void IClearLength (uint32_t port_index) {
135124 assert (port_index < kPorts );
136125 output_port_[port_index].length = 0 ;
137126 }
138127
139- uint32_t IGetLength (uint32_t port_index) const
140- {
141- assert (port_index < kPorts );
142- return output_port_[port_index].length ;
143- }
128+ uint32_t IGetLength (uint32_t port_index) const {
129+ assert (port_index < kPorts );
130+ return output_port_[port_index].length ;
131+ }
144132
145- const uint8_t * IBackup (uint32_t port_index)
146- {
133+ const uint8_t * IBackup (uint32_t port_index) {
147134 assert (port_index < kPorts );
148135 return const_cast <const uint8_t *>(output_port_[port_index].data );
149136 }
150137
151- void IRestore (uint32_t port_index, const uint8_t * data)
152- {
138+ void IRestore (uint32_t port_index, const uint8_t * data) {
153139 assert (port_index < kPorts );
154140 assert (data != nullptr );
155141
156142 memcpy (output_port_[port_index].data , data, dmxnode::kUniverseSize );
157143 }
158144
159- private:
160145#if !defined(DMXNODE_PORTS)
161146#define DMXNODE_PORTS 0
162147#endif
@@ -167,13 +152,11 @@ class Data
167152 static constexpr auto kPorts = DMXNODE_PORTS ;
168153#endif
169154
170- struct Source
171- {
155+ struct Source {
172156 uint8_t data[dmxnode::kUniverseSize ] __attribute__((aligned(4 )));
173157 };
174158
175- struct OutputPort
176- {
159+ struct OutputPort {
177160 Source source_a;
178161 Source source_b;
179162 uint8_t data[dmxnode::kUniverseSize ] __attribute__((aligned(4 )));
@@ -184,4 +167,4 @@ class Data
184167};
185168} // namespace dmxnode
186169
187- #endif // DMXNODEDATA_H_
170+ #endif // DMXNODEDATA_H_
0 commit comments