Skip to content

PLIBS_9 logo


pipeline status Latest release coverage report documentation Phoenix2 documentation phoenixfilegenerator conda channel DOI

Code

Source code is available here

Documentation

User documentation can be found here

Quick Start

Simple sources/header files generation

To generate an empty shadok.h and shadok.cpp files :

phoenix_filegenerator source -n Shadok

Nohting more to say, but it saves some times.

Simple class generation

To generate an empty Shadok class :

phoenix_filegenerator class -n Shadok

The previous command will generate an empty Shadok class with Shadok.h and Shadok.cpp files and basic constructor, destructor, copy function and equal operator.

Class generation from a configuration

Let's define a simple configuration in the file Shadok.pdata

///@brief Test Shadok
Shadok {
    ///Age of the Shadok
    int age;
    ///Name of the Shadok
    std::string name;
}

Do not hesitate to put some documentation into your class definition because it will be transfered into the generated code !

Then, you can call :

phoenix_filegenerator class -c Shadok.pdata

You can add multiple options to the command call depending on your requirements and the following arguments :

option name option type long value short value default value description
name String --name -n NONE base name of the file to be created
template String --template -t NONE template definition of the class
config FILENAME --config -c NONE configuration file .pdata used to create a class
datastream Bool --datastream -s false enable interfacing with PhoenixDataStream
typestream Bool --typestream -y false enable interfacing with PhoenixTypeStream
configstream Bool --configstream -f false enable interfacing with PhoenixConfigStream
tests Bool --tests -u false enable unit tests generation for generated class
testDir FILENAME --testdir -d NONE repository where to save the generated tests. Refers to the current directory for relative path
outputPath FILENAME --outputpath -o NONE Path where the generated source files from the class will be saved
projectName String --projectname -r NONE Name of the project target to generate class in with unit test

Generation of a full project

The project mode allows to generate a full project with some options of your choice, following the given arguments :

option name option type long value short value default value description
description FILENAME --description -d NONE The project descriptor file described in toml
config FILENAME --config -c NONE The class descriptor file described in toml
type String --type -t SimpleCpp Type of the project (base project is Simple cpp project)
pythonWrapper Bool --pythonwrapper -w false enable the generation of the python wrapper for the generated source code
datastream Bool --datastream -s false enable the interfacing with PhoenixDataStream
typestream Bool --typestream -y false enable the interfacing with PhoenixTypeStream
configStream Bool --configstream -f false enable the interfacing with PhoenixConfigStream
tests Bool --tests -u false enable unit test generation for the generated classes

Example project.toml descriptor file:

[project]
name = "StereoData"
url = "https://gitlab.in2p3.fr/CTA-LAPP/RTA/Stereo/StereoData"
version = "0.1.0"
description = "A very important project"
main_branch = "main"
runner_tag = "MUST_big_runner"
ci_toolkit_url = "https://gitlab.in2p3.fr/CTA-LAPP/PHOENIX_LIBS2/citoolkit/phoenixcitoolkitcpp/phoenix-workflow-cpp"
ci_toolkit_version = "3.0.4"
authors = [
    { firstName = "Oprinsen", lastName = "Thibaut", affiliation = "LAPP, Univ. Savoie Mont-Blanc, CNRS", mail = "thibaut.oprinsen@lapp.in2p3.fr" },
    { firstName = "Aubert", lastName = "Pierre", affiliation = "LAPP, Univ. Savoie Mont-Blanc, CNRS", mail = "pierre.aubert@lapp.in2p3.fr" }
]
maintainers = [
    { firstName = "Aubert", lastName = "Pierre", affiliation = "LAPP, Univ. Savoie Mont-Blanc, CNRS", mail = "pierre.aubert@lapp.in2p3.fr" }
]
contributors = [
    { firstName = "Pollet", lastName = "Vincent", affiliation = "LAPP, Univ. Savoie Mont-Blanc, CNRS", mail = "vincent.pollet@lapp.in2p3.fr" }
]
keywords = ["stereo", "data", "analysis", "CTA", "RTA"]
dependencies = ["PhoenixToml >=1.0.0, <2.0.0",
                "PhoenixYml ==1.0.0",
                "PhoenixCore",
                "PhoenixDataStream >=1.0.0, <2.0.0",
                "PhoenixTypeStream >=1.1.0, <2.0.0",
                "PhoenixConfigStream >=2.0.0, <3.0.0",
                "curl >=8.0.0, <9.0.0"]

For more details about the content of the project.toml you can refer to teh documentation of PhoenixGenerator which describes the content required for project generation.

Then, you can call :

phoenix_filegenerator project -d project.toml -c Shadok.pdata

You can also add the --wrapper option to generate the full python wrapper of the project. The wrapper will interpret several extra types : - DataStreamMsg : the message of PhoenixDataStream will be replaced by a ByteArrayObject - PPath and PString : Path and String of Phoenix will be replaced by Python String (str)

Installation

You can get the installation instructions from phoenix projects consistent installtion procedure.