Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
a6632a1
cleaning add functions
Lucas-TJ Dec 22, 2025
5c9c02a
Merge branch 'sofa-framework:master' into fix_add_from_link
Lucas-TJ May 19, 2026
5f2acb7
Merge branch 'sofa-framework:master' into fix_add_from_link
Lucas-TJ May 21, 2026
206b1be
Merge branch 'sofa-framework:master' into fix_add_from_link
Lucas-TJ May 27, 2026
108cd53
Merge branch 'master' into fix_add_from_link
Lucas-TJ May 28, 2026
3c2c5db
Merge branch 'sofa-framework:master' into fix_add_from_link
Lucas-TJ Jun 17, 2026
9ded891
add unit test
Lucas-TJ Jun 18, 2026
3201a16
Merge branch 'sofa-framework:master' into fix_add_from_link
Lucas-TJ Jun 18, 2026
e271ba2
Merge branch 'sofa-framework:master' into fix_add_from_link
Lucas-TJ Jul 24, 2026
9ada962
[Project] Start dev phase v26.12 (#6195)
hugtalbot Jul 28, 2026
71f6e04
[Scene] TetrahedronHyperelasticityFEMForceField.scn: add correct plug…
fredroy Jul 29, 2026
0c1e65c
[CORE] Add remove function in BaseLink (#6130)
Lucas-TJ Jul 29, 2026
bc53413
[Tests] Fix LCPForceFeedbackTests (#6213)
bakpaul Jul 29, 2026
416737e
[Plugins] Set SofaImplicitField as supported plugin (#6189)
bakpaul Jul 30, 2026
33acf3a
[Engine] Rename VolumeFromTetrahedrons to VolumeFromVolumetricElement…
alxbilger Jul 30, 2026
246108d
[Mapper] Missing `override` keyword (#6215)
alxbilger Jul 30, 2026
48c059a
cleaning add functions
Lucas-TJ Dec 22, 2025
6ab4044
add unit test
Lucas-TJ Jun 18, 2026
b84f7b5
[CORE] Add remove function in BaseLink (#6130)
Lucas-TJ Jul 29, 2026
3e4784c
[CORE] Add remove function in BaseLink (#6130)
Lucas-TJ Jul 29, 2026
2e78dc5
cleaning add functions
Lucas-TJ Dec 22, 2025
359eefe
add unit test
Lucas-TJ Jun 18, 2026
70c08be
Merge branch 'master' into fix_add_from_link
Lucas-TJ Jul 30, 2026
c48cee3
cleaning
Lucas-TJ Jul 30, 2026
0e7f361
cleaning
Lucas-TJ Jul 30, 2026
cf24261
restore and rename functions in Link.h
Lucas-TJ Jul 31, 2026
089ae6f
cleaning
Lucas-TJ Jul 31, 2026
f0621d2
cleaning
Lucas-TJ Jul 31, 2026
dace078
Merge branch 'sofa-framework:master' into fix_add_from_link
Lucas-TJ Sep 7, 2026
7017837
Merge branch 'sofa-framework:master' into fix_add_from_link
Lucas-TJ Sep 14, 2026
f81ccf1
revert changes + Add addRawPtr method to BaseLink
Lucas-TJ Sep 14, 2026
8179b10
cleaning
Lucas-TJ Sep 14, 2026
318ceb0
Merge branch 'master' into fix_add_from_link
bakpaul Sep 17, 2026
a7555e3
Merge branch 'master' into fix_add_from_link
Lucas-TJ Sep 21, 2026
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
24 changes: 24 additions & 0 deletions Sofa/framework/Core/simutest/objectmodel/BaseLink_simutest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,30 @@ TEST_F(BaseLink_test, remove)
ASSERT_FALSE(owner.l_target.remove(nullptr));
}

TEST_F(BaseLink_test, add)
{
FakeComponent Component1;
Component1.setName("Component1");
FakeComponent Component2;
Component2.setName("Component2");
FakeComponent Component3;
Component3.setName("Component3");

FakeComponent* ptr;
ptr = &Component2;

EXPECT_EQ(Component1.l_target.getValueString(), "");

Component1.l_target.add(ptr);
EXPECT_EQ(Component1.l_target.getValueString(), "@Component2");

ptr = &Component3;

Component1.l_target.add(ptr);
EXPECT_EQ(Component1.l_target.getValueString(), "@Component2 @Component3");
}


//////////////////////// Testing valid path //////////////////////////////////////
class MultiLink_simutest : public BaseLink_test {};

Expand Down
1 change: 1 addition & 0 deletions Sofa/framework/Core/src/sofa/core/objectmodel/BaseLink.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ class SOFA_CORE_API BaseLink
virtual void _doClear_() = 0;
virtual std::string _doGetLinkedPath_(const size_t=0) const = 0;
virtual bool _doRemove_(Base* target) = 0;
virtual bool addRawPtr(Base* baseptr) = 0;

unsigned int m_flags;
std::string m_name;
Expand Down
18 changes: 18 additions & 0 deletions Sofa/framework/Core/src/sofa/core/objectmodel/Link.h
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,24 @@ class TLink : public BaseLink
return TLink::add(destptr, path);
}

bool addRawPtr(Base* baseptr) override
{
/// If the pointer is null and the path empty we do nothing
if(!baseptr)
return false;

/// Downcast the pointer to a compatible type and
/// If the types are not compatible with the Link we returns false
auto destptr = castTo<DestType*>(baseptr);
if(!destptr)
{
return false;
}

/// TLink:adding accepts nullptr (for a not yet resolved link).
return TLink::add(destptr);
}

/// Returns false on type mismatch
bool _doSet_(Base* baseptr, const size_t index) override
{
Expand Down
Loading