Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Leander Schulten
Lichtsteuerung
Commits
9600a5f1
Commit
9600a5f1
authored
Jul 19, 2018
by
Leander Schulten
Browse files
Add dmxProgrammBlock
parent
0af94c01
Changes
3
Hide whitespace changes
Inline
Side-by-side
programms/dmxprogramblock.cpp
View file @
9600a5f1
#include
"dmxprogramblock.h"
namespace
Modules
{
DMXProgramBlock
::
DMXProgramBlock
()
DMXProgramBlock
::
DMXProgramBlock
(
std
::
shared_ptr
<
Consumer
>
consumer
)
{
prog
=
new
DMXProgram
();
addProgramm
(
prog
);
consumer
=
std
::
make_shared
<
DMXC
onsumer
>
()
;
this
->
consumer
=
c
onsumer
;
prog
->
setOutputLength
(
512
);
consumer
->
setInputLength
(
512
);
detail
::
Connection
c
(
consumer
);
c
.
addTarget
(
512
,
prog
,
0
);
addConsumer
(
std
::
move
(
c
));
}
void
DMXProgramBlock
::
setDMXConsumer
(
std
::
shared_ptr
<
Consumer
>
consumer
){
this
->
consumer
=
consumer
;
consumer
->
setInputLength
(
512
);
removeConsumer
([](
const
detail
::
Connection
&
){
return
true
;});
detail
::
Connection
c
(
consumer
);
c
.
addTarget
(
512
,
prog
,
0
);
addConsumer
(
std
::
move
(
c
));
}
}
programms/dmxprogramblock.h
View file @
9600a5f1
...
...
@@ -3,15 +3,25 @@
#include
"programblock.h"
#include
"dmxprogram.h"
#include
"dmxconsumer.h"
namespace
Modules
{
/**
* @brief Ein DMXProgramBlock der von Controller ausgeführt werden kann, damit DMXProgramm ausgeführt werden können.
*/
class
DMXProgramBlock
:
public
ProgramBlock
{
DMXProgram
*
prog
=
nullptr
;
std
::
shared_ptr
<
DMX
Consumer
>
consumer
;
std
::
shared_ptr
<
Consumer
>
consumer
;
public:
DMXProgramBlock
();
/**
* @brief isLoaded returns true, if a consumer is loaded so that the dmxouput can be shown
* @return true if a consumer exists
*/
bool
isLoaded
(){
return
consumer
.
operator
bool
();}
void
setDMXConsumer
(
std
::
shared_ptr
<
Consumer
>
consumer
);
DMXProgramBlock
(
std
::
shared_ptr
<
Consumer
>
consumer
);
~
DMXProgramBlock
(){}
};
}
...
...
programms/programblock.h
View file @
9600a5f1
...
...
@@ -21,7 +21,7 @@ namespace Modules {
unsigned
int
startIndex
;
};
typedef
unsigned
int
length_t
;
const
enum
SourceType
{
Filter
,
Consumer
}
sourceType
;
enum
SourceType
{
Filter
,
Consumer
}
sourceType
;
std
::
shared_ptr
<
InputDataConsumer
>
source
;
template
<
typename
Type
>
Connection
(
std
::
shared_ptr
<
Type
>
source
)
:
source
(
source
),
sourceType
(
Filter
){
...
...
@@ -146,6 +146,10 @@ namespace Modules {
* @param c
*/
void
addConsumer
(
detail
::
Connection
c
);
template
<
typename
F
>
void
removeConsumer
(
F
f
){
std
::
remove_if
(
consumer
.
begin
(),
consumer
.
end
(),
f
);
}
public:
ProgramBlock
();
ProgramBlock
(
const
QJsonObject
&
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment