📣 An issue occured with the embedded container registry on October 25 2021, between 10:30 and 12:10 (UTC+2). Any persisting issues should be reported to CC-IN2P3 Support. 🐛

Commit 3ed8667c authored by Pierre Aubert's avatar Pierre Aubert
Browse files

Add DataStream geenration support

parent e33d96b9
Pipeline #98296 passed with stages
in 3 minutes and 6 seconds
......@@ -19,6 +19,11 @@ install(FILES FindPhoenixFileGenerator.cmake DESTINATION share/cmake)
add_subdirectory(src)
add_subdirectory(script)
if(SELF_TESTS_MODE)
include(CTest)
add_subdirectory(TESTS)
endif(SELF_TESTS_MODE)
set(PHOENIX_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/src;${PHOENIX_INCLUDE_DIRS}" CACHE INTERNAL "list of Phoenix include dirs")
......
project(Phoenix)
cmake_minimum_required(VERSION 2.8)
set(FILE_GENERATOR_PROGRAM ${CMAKE_BINARY_DIR}/src/phoenix_filegenerator)
add_subdirectory(TEST_FILE_GENERATOR)
project(Phoenix)
cmake_minimum_required(VERSION 2.8)
add_test(NAME TestFileGeneratorSource
COMMAND ${FILE_GENERATOR_PROGRAM} source -n test_source
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
add_test(NAME TestFileGeneratorClass
COMMAND ${FILE_GENERATOR_PROGRAM} class -n Shadok
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
add_test(NAME TestFileGeneratorClassTemplate
COMMAND ${FILE_GENERATOR_PROGRAM} class -n ShadokT -t "typename T"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
set(CONFIG_PDATA_FILE ${CMAKE_CURRENT_SOURCE_DIR}/ConfigShadok.pdata)
add_test(NAME TestFileGeneratorClassConfig
COMMAND ${FILE_GENERATOR_PROGRAM} class -n ShadokConfig -c ${CONFIG_PDATA_FILE}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
add_test(NAME TestFileGeneratorClassConfigDataStream
COMMAND ${FILE_GENERATOR_PROGRAM} class -n ShadokConfigDS -c ${CONFIG_PDATA_FILE} -s
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
///@brief Test Shadok
ConfigShadok {
///Age of the Shadok
int age;
///Name of the Shadok
std::string name;
}
......@@ -31,6 +31,7 @@ OptionParser createOptionParser(){
std::string templateDef("");
parser.addOption("template", "t", templateDef, "template definition of the class (ex: 'typename T' or 'typename T, typename U', etc)");
parser.addOption("config", "c", templateDef, "Configuration file to create a class (*.pdata)");
parser.addOption("datastream", "s", OptionType::NONE, false, "Enable DataStream use to save/load generated class automatically");
parser.closeMode();
parser.addMode("source");
......@@ -49,11 +50,13 @@ void createClass(const OptionMode & classMode){
classMode.getValue(classConfig, "config");
classMode.getValue(templatedef, "template");
bool enableDataStream = classMode.isOptionExist("datastream");
if(classConfig != ""){
if(className == ""){
className = eraseExtension(getFileName(classConfig));
}
if(!saveParserClassConfig(className, classConfig)){
if(!saveParserClassConfig(className, classConfig, enableDataStream)){
std::cerr << "createClass : can't save file '"<<className<<"'[.h or .cpp]" << std::endl;
return;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment