add_link_command.cpp
Go to the documentation of this file.
1 
28 #include <boost/serialization/access.hpp>
29 #include <boost/serialization/nvp.hpp>
30 #include <boost/serialization/shared_ptr.hpp>
31 #include <memory>
33 
35 #include <tesseract_common/utils.h>
38 
39 namespace tesseract_environment
40 {
42 
45  , link_(std::make_shared<tesseract_scene_graph::Link>(link.clone()))
46  , joint_(nullptr)
47  , replace_allowed_(replace_allowed)
48 {
49 }
50 
52  const tesseract_scene_graph::Joint& joint,
53  bool replace_allowed)
55  , link_(std::make_shared<tesseract_scene_graph::Link>(link.clone()))
56  , joint_(std::make_shared<tesseract_scene_graph::Joint>(joint.clone()))
57  , replace_allowed_(replace_allowed)
58 {
59  if (joint_->child_link_name != link.getName())
60  throw std::runtime_error("AddLinkCommand: The provided joint child link name must equal the name of the provided "
61  "link.");
62 
64 }
65 
66 const std::shared_ptr<const tesseract_scene_graph::Link>& AddLinkCommand::getLink() const { return link_; }
67 const std::shared_ptr<const tesseract_scene_graph::Joint>& AddLinkCommand::getJoint() const { return joint_; }
69 
71 {
72  bool equal = true;
73  equal &= Command::operator==(rhs);
76  equal &= replace_allowed_ == rhs.replace_allowed_;
77  return equal;
78 }
79 bool AddLinkCommand::operator!=(const AddLinkCommand& rhs) const { return !operator==(rhs); }
80 
81 template <class Archive>
82 void AddLinkCommand::serialize(Archive& ar, const unsigned int /*version*/)
83 {
84  ar& BOOST_SERIALIZATION_BASE_OBJECT_NVP(Command);
85  ar& BOOST_SERIALIZATION_NVP(link_);
86  ar& BOOST_SERIALIZATION_NVP(joint_);
87  ar& BOOST_SERIALIZATION_NVP(replace_allowed_);
88 }
89 } // namespace tesseract_environment
90 
93 BOOST_CLASS_EXPORT_IMPLEMENT(tesseract_environment::AddLinkCommand)
tesseract_environment::Command::operator==
bool operator==(const Command &rhs) const
Definition: command.cpp:60
tesseract_environment
Definition: command.h:45
tesseract_environment::AddLinkCommand::joint_
std::shared_ptr< const tesseract_scene_graph::Joint > joint_
Definition: add_link_command.h:106
tesseract_environment::Command
Definition: command.h:83
utils.h
tesseract_environment::AddLinkCommand::replaceAllowed
bool replaceAllowed() const
Definition: add_link_command.cpp:68
tesseract_common::pointersEqual
bool pointersEqual(const std::shared_ptr< T > &p1, const std::shared_ptr< T > &p2)
TESSERACT_SERIALIZE_ARCHIVES_INSTANTIATE
#define TESSERACT_SERIALIZE_ARCHIVES_INSTANTIATE(Type)
tesseract_environment::AddLinkCommand::replace_allowed_
bool replace_allowed_
Definition: add_link_command.h:107
joint.h
TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
#define TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
tesseract_environment::AddLinkCommand::serialize
void serialize(Archive &ar, const unsigned int version)
Definition: add_link_command.cpp:82
tesseract_environment::CommandType::ADD_LINK
@ ADD_LINK
tesseract_environment::AddLinkCommand::link_
std::shared_ptr< const tesseract_scene_graph::Link > link_
Definition: add_link_command.h:105
tesseract_environment::AddLinkCommand::AddLinkCommand
AddLinkCommand()
Definition: add_link_command.cpp:41
tesseract_environment::AddLinkCommand::getLink
const std::shared_ptr< const tesseract_scene_graph::Link > & getLink() const
Definition: add_link_command.cpp:66
serialization.h
TESSERACT_COMMON_IGNORE_WARNINGS_POP
tesseract_environment::AddLinkCommand
Definition: add_link_command.h:45
tesseract_environment::AddLinkCommand::operator==
bool operator==(const AddLinkCommand &rhs) const
Definition: add_link_command.cpp:70
tesseract_scene_graph::Joint
tesseract_environment::AddLinkCommand::getJoint
const std::shared_ptr< const tesseract_scene_graph::Joint > & getJoint() const
Definition: add_link_command.cpp:67
macros.h
tesseract_scene_graph
tesseract_environment::CommandType
CommandType
Definition: command.h:47
tesseract_environment::AddLinkCommand::operator!=
bool operator!=(const AddLinkCommand &rhs) const
Definition: add_link_command.cpp:79


tesseract_environment
Author(s): Levi Armstrong
autogenerated on Sun May 18 2025 03:02:21