Skip to content

Allow upcasting #944

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

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
c105c75
Enable polymorphic shared_ptr downcasting in Any using type traits
captain-yoshi Apr 2, 2025
14815b5
Enable blackboard matching for types sharing a common base class
captain-yoshi Apr 2, 2025
6183340
Add test fixture for Greeter type hierarchy and type trait registration
captain-yoshi Apr 2, 2025
d644f67
Add unit test for Any/Blackboard type casting
captain-yoshi Apr 2, 2025
f403fb6
Avoid std::is_polymorphic instantiation on incomplete types
captain-yoshi Apr 3, 2025
5829a40
Refactor castPtr() to unify shared_ptr casting logic
captain-yoshi Apr 4, 2025
4a2e42c
Support recursive root base resolution for polymorphic shared_ptr types
captain-yoshi Apr 17, 2025
6f0c367
Adjust any_cast_base<FancyHelloGreeter> to map to HelloGreeter
captain-yoshi Apr 17, 2025
d313bec
Add compile-time base class chain introspection using any_cast_base
captain-yoshi Apr 18, 2025
f90f822
Extend TypeInfo to store and expose base class chain
captain-yoshi Apr 18, 2025
423e970
Add unit test for upcasting base type chain in PortInfo
captain-yoshi Apr 18, 2025
8ac0c1c
Use original typeid for shared_ptr types in TypeInfo::Create()
captain-yoshi Apr 18, 2025
12c1377
Add PortInfo constructors that accept TypeInfo for cleaner initializa…
captain-yoshi Apr 18, 2025
42b1d80
Allow port type mismatch if convertible via base class chain
captain-yoshi Apr 18, 2025
5090086
Improve test coverage for polymorphic port casting
captain-yoshi Apr 18, 2025
eda2683
Make test platform-independent by relaxing exact exception message check
captain-yoshi Apr 18, 2025
cad9a05
Refactor upcasting tests to use clearer Animal hierarchy example
captain-yoshi Apr 19, 2025
5f94fea
Restrict polymorphic upcast to INPUT ports only during type resolution
captain-yoshi Apr 19, 2025
1ce5185
Revert to direct type_index comparison in Blackboard::set()
captain-yoshi Apr 19, 2025
67276dd
Add caching mechanism for derived castPtr() in Any
captain-yoshi Apr 19, 2025
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
Prev Previous commit
Next Next commit
Make test platform-independent by relaxing exact exception message check
  • Loading branch information
captain-yoshi committed Apr 18, 2025
commit eda26831f75804fb3370bbb8750b479ca9e80c7c
20 changes: 1 addition & 19 deletions tests/gtest_blackboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1035,24 +1035,6 @@ TEST(BlackboardTest, Upcasting_Issue943)
factory.registerNodeType<ShowGreetMessage>("ShowGreetMessage");
factory.registerNodeType<ShowFancyGreetMessage>("ShowFancyGreetMessage");

try
{
auto tree = factory.createTreeFromText(xml_txt);
FAIL() << "Expected BT::RuntimeError to be thrown";
}
catch(const BT::RuntimeError& e)
{
std::string expected_msg = "The creation of the tree failed because the port "
"[hello_greeter] was initially "
"created with type [std::shared_ptr<HelloGreeter>] and, "
"later type "
"[std::shared_ptr<FancyHelloGreeter>] was used "
"somewhere else.";
ASSERT_EQ(e.what(), expected_msg);
}
catch(...)
{
FAIL() << "Expected BT::RuntimeError but caught a different exception";
}
ASSERT_ANY_THROW(auto tree = factory.createTreeFromText(xml_txt));
}
}
Loading