Skip to content

Commit

Permalink
first version with OpenScenario 1.3
Browse files Browse the repository at this point in the history
 - OSC 1.3 files generated
 - apps OpenScenarioReader and OpenScenarioTester extended with version 1.3
  • Loading branch information
kmfrank committed Aug 9, 2024
1 parent ccc88bb commit 4e92a41
Show file tree
Hide file tree
Showing 139 changed files with 319,278 additions and 6 deletions.
4 changes: 4 additions & 0 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ message(STATUS "${PROJECT_NAME}")
option(SUPPORT_OSC_1_0 "Build the artifacts supporting OSC standard version 1.0" ON)
option(SUPPORT_OSC_1_1 "Build the artifacts supporting OSC standard version 1.1" ON)
option(SUPPORT_OSC_1_2 "Build the artifacts supporting OSC standard version 1.2" ON)
option(SUPPORT_OSC_1_3 "Build the artifacts supporting OSC standard version 1.3" ON)

if (SUPPORT_OSC_1_0)
add_definitions(-DSUPPORT_OSC_1_0)
Expand All @@ -19,6 +20,9 @@ endif (SUPPORT_OSC_1_1)
if (SUPPORT_OSC_1_2)
add_definitions(-DSUPPORT_OSC_1_2)
endif (SUPPORT_OSC_1_2)
if (SUPPORT_OSC_1_3)
add_definitions(-DSUPPORT_OSC_1_3)
endif (SUPPORT_OSC_1_3)



Expand Down
59 changes: 56 additions & 3 deletions cpp/applications/openScenarioReader/src/OpenScenarioReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@
#include "XmlScenarioImportLoaderFactoryV1_2.h"
#endif

#ifdef SUPPORT_OSC_1_3
#include "ApiClassImplV1_3.h"
#include "XmlScenarioImportLoaderFactoryV1_3.h"
#endif

#include "ScenarioLoaderException.h"
#include "FileResourceLocator.h"
#include "../common/version.h"
Expand Down Expand Up @@ -83,6 +88,17 @@
#include "ExpressionResolverV1_2.h"
#include "ExpressionResolverStackV1_2.h"
#endif

#ifdef SUPPORT_OSC_1_3
#include "UnionCheckerRulesV1_3.h"
#include "RangeCheckerRulesV1_3.h"
#include "OpenScenarioXmlExporterV1_3.h"
#include "XmlParsersV1_3.h"
#include "CatalogCacheV1_3.h"
#include "CatalogReferenceParserContextV1_3.h"
#include "ExpressionResolverV1_3.h"
#include "ExpressionResolverStackV1_3.h"
#endif
#endif


Expand All @@ -104,6 +120,7 @@ static NET_ASAM_OPENSCENARIO::ErrorLevel logLevel = NET_ASAM_OPENSCENARIO::Error
static std::string VERSION_1_0 = "v1_0";
static std::string VERSION_1_1 = "v1_1";
static std::string VERSION_1_2 = "v1_2";
static std::string VERSION_1_3 = "v1_3";

#ifdef SUPPORT_OSC_1_0
std::shared_ptr<NET_ASAM_OPENSCENARIO::v1_0::OpenScenarioImpl> ExecuteImportParsing(std::string& filename, std::shared_ptr<NET_ASAM_OPENSCENARIO::SimpleMessageLogger>& messageLogger, std::shared_ptr <NET_ASAM_OPENSCENARIO::IParserMessageLogger> catalogMessageLogger, std::map<std::string, std::string>& injectionParameters)
Expand Down Expand Up @@ -132,6 +149,15 @@ std::shared_ptr<NET_ASAM_OPENSCENARIO::v1_2::OpenScenarioImpl> ExecuteImportPars
}
#endif

#ifdef SUPPORT_OSC_1_3
std::shared_ptr<NET_ASAM_OPENSCENARIO::v1_3::OpenScenarioImpl> ExecuteImportParsingV1_3(std::string& filename, std::shared_ptr<NET_ASAM_OPENSCENARIO::SimpleMessageLogger>& messageLogger, std::shared_ptr <NET_ASAM_OPENSCENARIO::IParserMessageLogger> catalogMessageLogger, std::map<std::string, std::string>& injectionParameters)
{
auto loaderFactory = NET_ASAM_OPENSCENARIO::v1_3::XmlScenarioImportLoaderFactory(catalogMessageLogger, filename);
auto loader = loaderFactory.CreateLoader(std::make_shared<NET_ASAM_OPENSCENARIO::FileResourceLocator>());
return std::static_pointer_cast<NET_ASAM_OPENSCENARIO::v1_3::OpenScenarioImpl>(loader->Load(messageLogger, injectionParameters)->GetAdapter(typeid(NET_ASAM_OPENSCENARIO::v1_2::OpenScenarioImpl).name()));
}
#endif

std::string GetFilledString(const size_t length, const char charToFill)
{
std::stringstream ss;
Expand Down Expand Up @@ -271,7 +297,16 @@ int CheckFile(std::string& inputFileName, std::string& paramFileName, std::strin

try
{
if (version == VERSION_1_2)
if (version == VERSION_1_3)
{
#ifdef SUPPORT_OSC_1_3
ExecuteImportParsingV1_3(inputFileName, messageLogger, catalogMessageLogger, injectedParamters);
#else
std::cout << "Standard Version 1.3 is not supported. Compile Reader with SUPPORT_OSC_1_3 option." << std::endl;
result = ERROR_RESULT;
#endif
}
else if (version == VERSION_1_2)
{
#ifdef SUPPORT_OSC_1_2
ExecuteImportParsingV1_2(inputFileName, messageLogger, catalogMessageLogger, injectedParamters);
Expand Down Expand Up @@ -408,6 +443,10 @@ int wmain(int argc, wchar_t** argv)
{
version = VERSION_1_2;
}
else if (argc == 6 && std::wstring(argv[5]) == L"-v1_3")
{
version = VERSION_1_3;
}
}
else if (argc == 4 && std::wstring(argv[3]) == L"-v1_1")
{
Expand All @@ -417,19 +456,24 @@ int wmain(int argc, wchar_t** argv)
{
version = VERSION_1_2;
}
else if (argc == 4 && std::wstring(argv[3]) == L"-v1_3")
{
version = VERSION_1_3;
}

isCommandLineParsable = true;
}

if (!isCommandLineParsable)
{
std::cout << "OpenScenarioChecker [[{-i <filename>|-d <dirname>} [-p <paramfilename>] [-v1_1|-v1_2]] | -v]" << std::endl;
std::cout << "OpenScenarioChecker [[{-i <filename>|-d <dirname>} [-p <paramfilename>] [-v1_1|-v1_2|v1_3]] | -v]" << std::endl;
std::cout << "Options:" << std::endl;
std::cout << "-i\t<filename> file to be validated" << std::endl;
std::cout << "-d\t<directory> directory to be validated" << std::endl;
std::cout << "-p\t<paramfilename> a file with name/value pairs. One line per name/value pair. tab separated" << std::endl;
std::cout << "-v1_1\tUse standard version 1.1" << std::endl;
std::cout << "-v1_2\tUse standard version 1.2" << std::endl;
std::cout << "-v1_3\tUse standard version 1.3" << std::endl;
std::cout << "-v\tprint program version" << std::endl;

return USAGE_RESULT;
Expand Down Expand Up @@ -503,6 +547,10 @@ int main(int argc, char** argv)
{
version = VERSION_1_2;
}
else if (argc == 6 && std::string(argv[5]) == "-v1_3")
{
version = VERSION_1_3;
}
}
else if (argc == 4 && std::string(argv[3]) == "-v1_1")
{
Expand All @@ -512,19 +560,24 @@ int main(int argc, char** argv)
{
version = VERSION_1_2;
}
else if (argc == 4 && std::string(argv[3]) == "-v1_3")
{
version = VERSION_1_3;
}

isCommandLineParsable = true;
}

if (!isCommandLineParsable)
{
std::cout << "OpenScenarioChecker [[{-i <filename>|-d <dirname>} [-p <paramfilename>] [-v1_1|-v1_2]] | -v]" << std::endl;
std::cout << "OpenScenarioChecker [[{-i <filename>|-d <dirname>} [-p <paramfilename>] [-v1_1|-v1_2|-v1_3]] | -v]" << std::endl;
std::cout << "Options:" << std::endl;
std::cout << "-i\t<filename> file to be validated" << std::endl;
std::cout << "-d\t<directory> directory to be validated" << std::endl;
std::cout << "-p\t<paramfilename> a file with name/value pairs. One line per name/value pair. tab separated" << std::endl;
std::cout << "-v1_1\tUse standard version 1.1" << std::endl;
std::cout << "-v1_2\tUse standard version 1.2" << std::endl;
std::cout << "-v1_3\tUse standard version 1.3" << std::endl;
std::cout << "-v\tprint program version" << std::endl;

return USAGE_RESULT;
Expand Down
62 changes: 62 additions & 0 deletions cpp/applications/openScenarioTester/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,30 @@ if (SUPPORT_OSC_1_2)
)
endif (SUPPORT_OSC_1_2)

if (SUPPORT_OSC_1_3)
set( HEADERS
${HEADERS}
"src/TestDeprecatedV1_3.h"
"src/TestExamplesV1_3.h"
"src/TestBaseV1_3.h"
"src/TestFilesV1_3.h"
"src/TestReaderV1_3.h"
"src/TestWriterApiV1_3.h"
"src/TestImportsV1_3.h"
"src/TestSimpleDemosV1_3.h"
"src/TestRangeCheckerV1_3.h"
"src/TestFlexInterfaceV1_3.h"
"src/TestVersionCheckerV1_3.h"
"src/TestInjectedParametersV1_3.h"
"src/TestAlksV1_3.h"
"src/TestParameterValidationV1_3.h"
"src/TestVariableValidationV1_3.h"
"src/TestDeprecatedValidationV1_3.h"
"src/TestExamplesOscV1_3.h"
"src/TestCardinalityV1_3.h"
)
endif (SUPPORT_OSC_1_3)

if (SUPPORT_OSC_1_0)
set( HEADERS_HELPER
${HEADERS_HELPER}
Expand All @@ -125,6 +149,13 @@ set( HEADERS_HELPER
)
endif (SUPPORT_OSC_1_2)

if (SUPPORT_OSC_1_3)
set( HEADERS_HELPER
${HEADERS_HELPER}
"src/helper/EgoCheckerRuleV1_3.h"
)
endif (SUPPORT_OSC_1_3)

# Source files
set( SOURCES
"../../externalLibs/TinyXML2/tinyxml2.cpp"
Expand Down Expand Up @@ -194,6 +225,30 @@ set( SOURCES
)
endif (SUPPORT_OSC_1_2)

if (SUPPORT_OSC_1_3)
set( SOURCES
${SOURCES}
"src/TestBaseV1_3.cpp"
"src/TestExamplesV1_3.cpp"
"src/TestFilesV1_3.cpp"
"src/TestFlexInterfaceV1_3.cpp"
"src/TestImportsV1_3.cpp"
"src/TestInjectedParametersV1_3.cpp"
"src/TestRangeCheckerV1_3.cpp"
"src/TestReaderV1_3.cpp"
"src/TestSimpleDemosV1_3.cpp"
"src/TestVersionCheckerV1_3.cpp"
"src/TestWriterApiV1_3.cpp"
"src/TestDeprecatedV1_3.cpp"
"src/TestAlksV1_3.cpp"
"src/TestParameterValidationV1_3.cpp"
"src/TestVariableValidationV1_3.cpp"
"src/TestDeprecatedValidationV1_3.cpp"
"src/TestExamplesOscV1_3.cpp"
"src/TestCardinalityV1_3.cpp"
)
endif (SUPPORT_OSC_1_3)

if (SUPPORT_OSC_1_0)
set( SOURCES_HELPER
${SOURCES_HELPER}
Expand All @@ -215,6 +270,13 @@ set( SOURCES_HELPER
)
endif (SUPPORT_OSC_1_2)

if (SUPPORT_OSC_1_3)
set( SOURCES_HELPER
${SOURCES_HELPER}
"src/helper/EgoCheckerRuleV1_3.cpp"
)
endif (SUPPORT_OSC_1_3)

# Resource files
if( MSVC )
set( RESOURCE_FILES
Expand Down
Loading

0 comments on commit 4e92a41

Please sign in to comment.