Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure xodr and xosc crash when exception occurs #13

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion appln/main_xodr.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,15 @@ int main (int argc , char **argv)

xodr _odrive;
_odrive.load(filename);
_odrive.parse();

try{
_odrive.parse();
std::cout << "OpenDRIVE parse successfully " << _odrive.m_OpenDRIVE<< std::endl;
}
catch (std::exception &e)
{
std::cout << "ERROR :Exception .. " << e.what() << std::endl;
}

_odrive.save("xodr_save.xml");

Expand Down
9 changes: 8 additions & 1 deletion appln/main_xosc.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,14 @@ int main (int argc , char **argv)

xosc _osc;
_osc.load(filename);
_osc.parse();
try{
_osc.parse();
std::cout << "OpenSCENARIO parse successfully " << _osc.m_OpenSCENARIO<< std::endl;
}
catch (std::exception &e)
{
std::cout << "ERROR :Exception .. " << e.what() << std::endl;
}

_osc.save("xosc_save.xml");

Expand Down
9 changes: 1 addition & 8 deletions src/xodr/xodr.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2011,14 +2011,7 @@ void xodr::load(std::string xodrfilename )
}
void xodr::parse()
{
try {
m_OpenDRIVE = std::make_shared<OpenDRIVE>(m_root.child("OpenDRIVE"));
std::cout << "OpenDRIVE parse successfully " << m_OpenDRIVE<< std::endl;
}
catch (std::exception &e)
{
std::cout << "ERROR :Exception .. " << e.what() << std::endl;
}
m_OpenDRIVE = std::make_shared<OpenDRIVE>(m_root.child("OpenDRIVE"));
}
void xodr::save(std::string filename)
{
Expand Down
1 change: 1 addition & 0 deletions src/xodr/xodr.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <cstring>
#include <string>
#include <vector>
#include <limits>
//
#include "pugixml.hpp"
#include "common.h"
Expand Down
9 changes: 1 addition & 8 deletions src/xosc/xosc.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -3428,14 +3428,7 @@ void xosc::load(std::string xoscfilename )
}
void xosc::parse()
{
try {
m_OpenSCENARIO = std::make_shared<OpenSCENARIO>(m_root.child("OpenSCENARIO"));
std::cout << "OpenSCENARIO parse successfully " << m_OpenSCENARIO<< std::endl;
}
catch (std::exception &e)
{
std::cout << "ERROR :Exception .. " << e.what() << std::endl;
}
m_OpenSCENARIO = std::make_shared<OpenSCENARIO>(m_root.child("OpenSCENARIO"));
}
void xosc::save(std::string filename)
{
Expand Down