Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cis-workflow-gen
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
msc
cis-workflow-gen
Commits
7e26f5b2
There was an error fetching the commit references. Please try again later.
Commit
7e26f5b2
authored
4 years ago
by
Bensong Liu
Browse files
Options
Downloads
Patches
Plain Diff
BugFix
parent
4807b80c
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
activity.hpp
+16
-9
16 additions, 9 deletions
activity.hpp
quick-include.hpp
+11
-0
11 additions, 0 deletions
quick-include.hpp
xaml.gen.example.cc
+1
-2
1 addition, 2 deletions
xaml.gen.example.cc
with
28 additions
and
11 deletions
activity.hpp
+
16
−
9
View file @
7e26f5b2
...
...
@@ -75,26 +75,31 @@ namespace CIS {
auto
generateXaml
()
const
;
private
:
bool
prevOperationIsSequential
=
fals
e
;
bool
prevOperationIsSequential
=
tru
e
;
rlib
::
string
xamlCode
;
std
::
queue
<
rlib
::
string
>
queued
;
Flow
binaryOperation
(
const
Flow
&
seqNext
,
bool
thisOperationIsSequential
)
const
{
Flow
binaryOperation
(
Flow
seqNext
,
bool
thisOperationIsSequential
)
const
{
rlib
::
printfln
(
"binOp begin, isSeq={}, queueSize={}"
,
thisOperationIsSequential
,
queued
.
size
());
Flow
result
=
*
this
;
if
(
thisOperationIsSequential
!=
prevOperationIsSequential
&&
!
queued
.
empty
())
{
resul
t
.
reduceQueued
(
);
}
result
.
reduceQueuedIfNecessary
(
thisOperationIsSequential
);
seqNex
t
.
reduceQueued
IfNecessary
(
thisOperationIsSequential
);
result
.
prevOperationIsSequential
=
thisOperationIsSequential
;
result
.
queued
.
push
(
seqNext
.
xamlCode
);
rlib
::
printfln
(
"binOp end, result.isSeq={}, result.queueSize={}"
,
result
.
prevOperationIsSequential
,
result
.
queued
.
size
());
return
result
;
}
void
reduceQueued
()
{
void
reduceQueuedIfNecessary
(
bool
thisOperationIsSequential
)
{
rlib
::
printfln
(
"reduce begin, PREVisSeq={}, thisIsSeq={}, queueSize={}"
,
prevOperationIsSequential
,
thisOperationIsSequential
,
queued
.
size
());
if
(
thisOperationIsSequential
==
prevOperationIsSequential
||
queued
.
empty
())
return
;
rlib
::
string
resultXaml
=
prevOperationIsSequential
?
templates
::
SEQ_BEGIN
:
templates
::
PAR_BEGIN
;
resultXaml
+=
xamlCode
;
while
(
!
queued
.
empty
())
resultXaml
+=
queued
.
front
(),
queued
.
pop
();
resultXaml
+=
prevOperationIsSequential
?
templates
::
SEQ_END
:
templates
::
PAR_END
;
rlib
::
printfln
(
"reduce end, PREVisSeq={}, queueSize={}, xaml dump:{}"
,
prevOperationIsSequential
,
queued
.
size
(),
resultXaml
);
xamlCode
=
std
::
move
(
resultXaml
);
}
};
...
...
@@ -103,11 +108,14 @@ namespace CIS {
return
Flow
(
*
this
)
>>
seqNext
;
}
inline
Flow
Activity
::
operator
|
(
const
Flow
&
seqNext
)
const
{
return
Flow
(
*
this
)
>>
seqNext
;
return
Flow
(
*
this
)
|
seqNext
;
}
struct
Metadata
{
friend
Flow
;
auto
&
setXtraShorthands
(
std
::
list
<
string
>
&&
xtraShorthands
)
{
this
->
xtraShorthands
=
std
::
move
(
xtraShorthands
);
return
*
this
;}
auto
&
setXtraNamespaces
(
std
::
list
<
string
>
&&
xtraNamespaces
)
{
this
->
xtraNamespaces
=
std
::
move
(
xtraNamespaces
);
return
*
this
;}
auto
&
setXtraAssemblies
(
std
::
list
<
string
>
&&
xtraAssemblies
)
{
this
->
xtraAssemblies
=
std
::
move
(
xtraAssemblies
);
return
*
this
;}
std
::
list
<
string
>
xtraShorthands
;
std
::
list
<
string
>
xtraNamespaces
;
std
::
list
<
string
>
xtraAssemblies
;
...
...
@@ -127,8 +135,7 @@ namespace CIS {
inline
auto
Flow
::
generateXaml
(
Metadata
metadata
)
const
{
Flow
finalized
(
*
this
);
if
(
!
finalized
.
queued
.
empty
())
finalized
.
reduceQueued
();
finalized
.
reduceQueuedIfNecessary
(
!
finalized
.
prevOperationIsSequential
);
// Always necessary if queue is not empty.
return
metadata
.
generateXamlHead
()
+
finalized
.
xamlCode
+
metadata
.
generateXamlTail
();
}
inline
auto
Flow
::
generateXaml
()
const
{
...
...
This diff is collapsed.
Click to expand it.
quick-include.hpp
+
11
−
0
View file @
7e26f5b2
// This file is ONLY intended to be included in XAML-GEN source file!
// DO NOT INCLUDE this file in any headers / libraries / production-ready-cxx code!
#ifndef RLIB_IMPL_QUICK_INCLUDE_XAML_GEN_HPP
#define RLIB_IMPL_QUICK_INCLUDE_XAML_GEN_HPP
...
...
@@ -14,7 +17,15 @@ inline auto &to_file(std::string filename) {
if
(
!*
outf
)
{
throw
std
::
invalid_argument
(
"Failed to open file: "
+
filename
);
}
// Don't do this in production cxx code.
return
*
outf
;
}
namespace
CIS
{
inline
auto
&
DefaultMetadata
()
{
// Don't do this in production cxx code.
return
*
new
Metadata
();
}
}
#endif
\ No newline at end of file
This diff is collapsed.
Click to expand it.
xaml.gen.example.cc
+
1
−
2
View file @
7e26f5b2
...
...
@@ -36,8 +36,7 @@ auto complexExample() {
auto
block4
=
IC3Tooling
>>
(
MonitoringSetup
|
(
MicroServices
>>
DevelopmentValidation
>>
IntegrationTesting
));
auto
completeFlow
=
block1
|
TSConfigAndInterop
|
block3
|
block4
;
Metadata
defaultMetadata
;
defaultMetadata
.
xtraAssemblies
=
{
"FleetAGC.Workflows"
};
auto
myMetadata
=
DefaultMetadata
().
xtraAssemblies
=
{
"FleetAGC.Workflows"
};
println
(
to_file
(
"BuildTeams.xaml"
),
completeFlow
.
generateXaml
());
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment