Skip to content

Commit

Permalink
[examples][dataflow] fix snippet comments in HelloGraph
Browse files Browse the repository at this point in the history
  • Loading branch information
MathiasPaulin committed Oct 17, 2022
1 parent e9c883a commit 5597064
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions examples/DataflowExamples/HelloGraph/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ int main( int argc, char* argv[] ) {

//! [Execute the graph]
g.execute();
// The reference to the result is now available
// The reference to the result is now available. Results can be accessed through a reference
// (sort of RVO from the graph https://en.cppreference.com/w/cpp/language/copy_elision)
// or copied in an application variable.
auto& result = output->getData<std::vector<Scalar>>();
//! [Execute the graph]

Expand All @@ -116,7 +118,7 @@ int main( int argc, char* argv[] ) {
g.releaseDataSetter( "Source_to" );
g.execute();
std::cout << "Output values after third execution: " << result.size() << "\n";
//! [Disconnect data setter and rerun the graph]
//! [Disconnect data setter and rerun the graph - result is now empty]

//! [As interface is disconnected, we can set data direclty on the source node]
sourceNode->setData( &test );
Expand All @@ -126,7 +128,7 @@ int main( int argc, char* argv[] ) {
std::cout << ord << ' ';
}
std::cout << '\n';
//! [Disconnect data setter and rerun the graph]
//! [As interface is disconnected, we can set data direclty on the source node]

//! [Reconnect data setter and rerun the graph - result is the same than second execution]
g.activateDataSetter( "Source_to" );
Expand All @@ -136,6 +138,6 @@ int main( int argc, char* argv[] ) {
std::cout << ord << ' ';
}
std::cout << '\n';
//! [Disconnect data setter and rerun the graph]
//! [Reconnect data setter and rerun the graph - result is the same than second execution]
return 0;
}

0 comments on commit 5597064

Please sign in to comment.