The following directory structure and coding practices are recommended for organizing your AI Engine projects to provide clarity and reuse.
- All adaptive data flow (ADF) graph class definitions, that is, all the ADF
graphs are derived from graph class
adf::graph, must be located in a header file. Multiple ADF graph definitions can be included in the same header file. This class header file should be included in themainapplication file where the actual top-level graph is declared in the file scope (see Creating a Data Flow Graph (Including Kernels)). - There should be no dependencies on the order that the header files are included. All header files must be self-contained and include all the other header files that it needs.
- There should be no file scoped variable or data-structure definitions in the
graph header files. Any definitions (including
static) must be declared in a separate source file that can be identified in theheaderproperty of the kernel where they are referenced (see Look-up Tables). - There is no need to declare the kernels under
extern "C" {...}. However, this declaration can be used in an application meant to run full-program simulation, but it must adhere to the following conditions:- If the kernel-function declaration is wrapped with
extern "C", then the definition must know about it. This can be done by either including the header file inside the definition file, or wrapping the definition withextern "C". - The
extern "C"must be wrapped with#ifdef __cplusplus. This is synonymous to howextern "C"is used in stdio.h.
- If the kernel-function declaration is wrapped with