collada_urdf: writeDocument now throws instead of returning bool
This commit is contained in:
parent
51a5c72b31
commit
275955babf
|
@ -95,8 +95,9 @@ public:
|
||||||
*
|
*
|
||||||
* \param documentName The filename of the document to write to
|
* \param documentName The filename of the document to write to
|
||||||
* \return True if the file was successfully written
|
* \return True if the file was successfully written
|
||||||
|
* \throws ColladaWriterException if an error occurred writing the COLLADA file
|
||||||
*/
|
*/
|
||||||
bool writeDocument(std::string const& documentName);
|
void writeDocument(std::string const& documentName);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void handleError(daeString msg);
|
virtual void handleError(daeString msg);
|
||||||
|
|
|
@ -70,7 +70,7 @@ ColladaWriter::ColladaWriter(shared_ptr<urdf::Model> robot, string const& source
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ColladaWriter::writeDocument(string const& documentName) {
|
void ColladaWriter::writeDocument(string const& documentName) {
|
||||||
initDocument(documentName);
|
initDocument(documentName);
|
||||||
|
|
||||||
SCENE scene = createScene();
|
SCENE scene = createScene();
|
||||||
|
@ -83,8 +83,6 @@ bool ColladaWriter::writeDocument(string const& documentName) {
|
||||||
addBindings(scene);
|
addBindings(scene);
|
||||||
|
|
||||||
collada_->writeAll();
|
collada_->writeAll();
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ColladaWriter::~ColladaWriter() {
|
ColladaWriter::~ColladaWriter() {
|
||||||
|
|
|
@ -31,7 +31,8 @@
|
||||||
|
|
||||||
TEST(collada_urdf, collada_writer_writes)
|
TEST(collada_urdf, collada_writer_writes)
|
||||||
{
|
{
|
||||||
ASSERT_TRUE(collada_urdf::ColladaWriter("test/pr2.urdf").writeDocument("test/pr2.dae"));
|
// An exception will be thrown on any error opening the URDF or writing the COLLADA file
|
||||||
|
collada_urdf::ColladaWriter("test/pr2.urdf").writeDocument("test/pr2.dae");
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
|
|
Loading…
Reference in New Issue