-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ContactResult boost serialization
- Loading branch information
1 parent
08fce35
commit dd348a9
Showing
5 changed files
with
159 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
tesseract_collision/core/include/tesseract_collision/core/serialization.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/** | ||
* @file serialization.h | ||
* @brief Tesseracts Collision Serialization | ||
* | ||
* @author Levi Armstrong | ||
* @date March 20, 2023 | ||
* @version TODO | ||
* @bug No known bugs | ||
* | ||
* @copyright Copyright (c) 2023, Levi Armstrong | ||
* | ||
* @par License | ||
* Software License Agreement (Apache License) | ||
* @par | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* @par | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
#ifndef TESSERACT_COLLISION_SERIALIZATION_H | ||
#define TESSERACT_COLLISION_SERIALIZATION_H | ||
|
||
#include <tesseract_common/macros.h> | ||
TESSERACT_COMMON_IGNORE_WARNINGS_PUSH | ||
#include <variant> | ||
#include <fstream> | ||
#include <sstream> | ||
#include <boost/archive/xml_oarchive.hpp> | ||
#include <boost/archive/xml_iarchive.hpp> | ||
#include <boost/archive/binary_oarchive.hpp> | ||
#include <boost/archive/binary_iarchive.hpp> | ||
#include <boost/serialization/tracking.hpp> | ||
#include <boost/serialization/tracking_enum.hpp> | ||
TESSERACT_COMMON_IGNORE_WARNINGS_POP | ||
|
||
#include <tesseract_collision/core/types.h> | ||
|
||
namespace boost::serialization | ||
{ | ||
/************************************************/ | ||
/****** tesseract_collision::ContactResult ******/ | ||
/************************************************/ | ||
|
||
template <class Archive> | ||
void save(Archive& ar, const tesseract_collision::ContactResult& g, const unsigned int version); // NOLINT | ||
|
||
template <class Archive> | ||
void load(Archive& ar, tesseract_collision::ContactResult& g, const unsigned int version); // NOLINT | ||
|
||
template <class Archive> | ||
void serialize(Archive& ar, tesseract_collision::ContactResult& g, const unsigned int version); // NOLINT | ||
|
||
} // namespace boost::serialization | ||
|
||
#endif // TESSERACT_COLLISION_SERIALIZATION_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
/** | ||
* @file serialization.cpp | ||
* @brief Contact results serialization wrappers | ||
* @details Supports the following | ||
* - tesseract_collision::ContactResult | ||
* - tesseract_collision::ContactResultVector | ||
* - tesseract_collision::ContactResultMap | ||
* | ||
* @author Levi Armstrong | ||
* @date March 20, 2023 | ||
* @version TODO | ||
* @bug No known bugs | ||
* | ||
* @copyright Copyright (c) 2023, Levi Armstrong | ||
* | ||
* @par License | ||
* Software License Agreement (Apache License) | ||
* @par | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* @par | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#include <tesseract_common/macros.h> | ||
TESSERACT_COMMON_IGNORE_WARNINGS_PUSH | ||
#include <boost/serialization/base_object.hpp> | ||
#include <boost/serialization/nvp.hpp> | ||
#include <boost/serialization/array.hpp> | ||
#include <boost/serialization/vector.hpp> | ||
#include <tesseract_common/eigen_serialization.h> | ||
TESSERACT_COMMON_IGNORE_WARNINGS_POP | ||
|
||
#include <tesseract_collision/core/serialization.h> | ||
|
||
namespace boost::serialization | ||
{ | ||
/************************************************/ | ||
/****** tesseract_collision::ContactResult ******/ | ||
/************************************************/ | ||
template <class Archive> | ||
void save(Archive& ar, const tesseract_collision::ContactResult& g, const unsigned int /*version*/) | ||
{ | ||
ar& boost::serialization::make_nvp("distance", g.distance); | ||
ar& boost::serialization::make_nvp("type_id", g.type_id); | ||
ar& boost::serialization::make_nvp("link_names", g.link_names); | ||
ar& boost::serialization::make_nvp("shape_id", g.shape_id); | ||
ar& boost::serialization::make_nvp("subshape_id", g.subshape_id); | ||
ar& boost::serialization::make_nvp("nearest_points", g.nearest_points); | ||
ar& boost::serialization::make_nvp("nearest_points_local", g.nearest_points_local); | ||
ar& boost::serialization::make_nvp("transform", g.transform); | ||
ar& boost::serialization::make_nvp("normal", g.normal); | ||
ar& boost::serialization::make_nvp("cc_time", g.cc_time); | ||
ar& boost::serialization::make_nvp("cc_type", g.cc_type); | ||
ar& boost::serialization::make_nvp("cc_transform", g.cc_transform); | ||
ar& boost::serialization::make_nvp("single_contact_point", g.single_contact_point); | ||
} | ||
|
||
template <class Archive> | ||
void load(Archive& ar, tesseract_collision::ContactResult& g, const unsigned int /*version*/) | ||
{ | ||
ar& boost::serialization::make_nvp("distance", g.distance); | ||
ar& boost::serialization::make_nvp("type_id", g.type_id); | ||
ar& boost::serialization::make_nvp("link_names", g.link_names); | ||
ar& boost::serialization::make_nvp("shape_id", g.shape_id); | ||
ar& boost::serialization::make_nvp("subshape_id", g.subshape_id); | ||
ar& boost::serialization::make_nvp("nearest_points", g.nearest_points); | ||
ar& boost::serialization::make_nvp("nearest_points_local", g.nearest_points_local); | ||
ar& boost::serialization::make_nvp("transform", g.transform); | ||
ar& boost::serialization::make_nvp("normal", g.normal); | ||
ar& boost::serialization::make_nvp("cc_time", g.cc_time); | ||
ar& boost::serialization::make_nvp("cc_type", g.cc_type); | ||
ar& boost::serialization::make_nvp("cc_transform", g.cc_transform); | ||
ar& boost::serialization::make_nvp("single_contact_point", g.single_contact_point); | ||
} | ||
|
||
template <class Archive> | ||
void serialize(Archive& ar, tesseract_collision::ContactResult& g, const unsigned int version) | ||
{ | ||
split_free(ar, g, version); | ||
} | ||
|
||
} // namespace boost::serialization | ||
|
||
#include <tesseract_common/serialization.h> | ||
TESSERACT_SERIALIZE_SAVE_LOAD_FREE_ARCHIVES_INSTANTIATE(tesseract_collision::ContactResult) |