-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[systems/lcm] Use shared_ptr for LCM serializers
For a given message type, it's OK to use one const serializer across all systems that publish or subscribe for efficiency. This also allows us to greatly simplify the Python bindings. Deprecate SerializerInterface::Clone. It now has very little upside, but is extremely difficult to override correctly in Python.
- Loading branch information
1 parent
4d4949a
commit c9b02b9
Showing
12 changed files
with
106 additions
and
49 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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#include <gtest/gtest.h> | ||
|
||
#include "drake/common/is_cloneable.h" | ||
#include "drake/lcmt_drake_signal.hpp" | ||
#include "drake/systems/lcm/serializer.h" | ||
|
||
namespace drake { | ||
namespace systems { | ||
namespace lcm { | ||
namespace { | ||
|
||
GTEST_TEST(SerializerDeprecatedTest, BasicTest) { | ||
// The device under test. | ||
auto dut = std::make_unique<Serializer<lcmt_drake_signal>>(); | ||
|
||
#pragma GCC diagnostic push | ||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations" | ||
// Cloning works. | ||
EXPECT_TRUE(is_cloneable<SerializerInterface>::value); | ||
auto fresh = dut->Clone(); | ||
ASSERT_NE(fresh, nullptr); | ||
auto fresh_value = fresh->CreateDefaultValue(); | ||
EXPECT_EQ(fresh_value->get_value<lcmt_drake_signal>().dim, 0); | ||
#pragma GCC diagnostic pop | ||
} | ||
|
||
} // namespace | ||
} // namespace lcm | ||
} // namespace systems | ||
} // namespace drake |
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