CoreFlow 1.0.0
A modern orchestration and execution runtime
Loading...
Searching...
No Matches
hello_world.cpp

Hello World Example.

Hello World Example

Version
0.1
Date
2025-09-06
#include <cstdlib>
#include <iostream>
#include <COREFLOW/all.hpp>
using namespace coreflow;
int main(int argc, char* argv[])
{
if (argc != 2)
{
std::cerr << "Usage: " << argv[0] << " <graph.xml>" << std::endl;
return EXIT_FAILURE;
}
// Create context
auto context = Context::createContext();
if (Error::getStatus(context) != VX_SUCCESS)
{
std::cerr << "Failed to create Context" << std::endl;
return EXIT_FAILURE;
}
// Import graph(s) from XML
auto graphs = xml::Import::importFromXML(context, argv[1]);
if (graphs.empty())
{
std::cerr << "Failed to import graph from XML" << std::endl;
return EXIT_FAILURE;
}
// Process graph
for (auto graph : graphs)
{
{
if (graph->process() == VX_SUCCESS)
{
std::cout << "Graph processed successfully" << std::endl;
}
else
{
std::cerr << "Failed to process graph" << std::endl;
}
}
}
// Print performance metrics
for (auto graph : graphs)
{
auto perf = graph->performance();
std::cout << "Graph " << (size_t)graph << " performance metrics:" << std::endl
<< " begin time (ns): " << perf.beg << std::endl
<< " end time (ns): " << perf.end << std::endl
<< " sum time (ns): " << perf.sum << std::endl
<< " num runs: " << perf.num << std::endl
<< " avg time (ns): " << perf.avg << std::endl
<< " min time (ns): " << perf.min << std::endl
<< " max time (ns): " << perf.max << std::endl
<< std::endl;
}
// Automatically cleanup when program exits
std::cout << "completed successfully" << std::endl;
return EXIT_SUCCESS;
}
CoreVX single-include header for C++ development.
int main()
Definition blur_pipeline.cpp:15
@ VX_SUCCESS
No error.
Definition vx_types.h:543
static vx_context createContext()
Create a new context.
static vx_status getStatus(vx_reference ref)
Provides a generic API to return status values from Object constructors if they fail.
static std::vector< vx_graph > importFromXML(vx_context context, std::string filepath)
Import from XML.
Definition vx_xml.h:42
The internal representation of a vx_array.
Definition vx_array.h:34