Part 1 : Quick Start
The program
phoenix_datagenerator is a code generator which automates data format development for
C,
C++ and
Fortran.
This can be pretty usefull to make clean interfaces between these languages without carring about development.
There are two modes :
- The classical mode, as any kind of data format generator (except that the documentation is generated too)
- The project mode. When the project argument is provided the phoenix_datagenerator produces a full C, C++ and Fortran project (depending on the selected languages, mix are allowed too) which contains libraries to use the data format in all the specified languages and also all unit tests which prove the data format is working. The generated project has also a .gitlab-ci.yml config to be integrated natively in a gitlab
To run
phoenix_datagenerator :
phoenix_datagenerator -i baseConfig.pdg -o outputDir -c --c++ --fortran
or :
phoenix_datagenerator -i baseConfig.pdg -p project_config.yml -o outputDir -c --c++ --fortran
Where
outputDir is the output directory where to create generated code (current directory by default),
baseConfig.pdg is the class description and
project_config.yml is the project configuration which allows to create a full
gitlab project.
A simple example :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
///Table of values
Class TableVertex{
///Event id
luint eventId;
///Timestamp
double timestamp;
///Number of pixels
luint nbPixel;
///Image
Tensor(float, nbPixel) image;
///Number of value
uint nbValue;
///Float value
Tensor(float, nbValue) matValue;
}
|
Here, the name of the generated
class,
struct is
TableVertex.
All the defined attributes are stored and read in the same order they are defined.
A Tensor is defined by its type, first, and then all its dimentions (with variables or fixed values) and you can use as many as dimensions you need.
Note : The documentation of the class and of its attributes is transmitted into the generated code for all languages.