Skip to content

Commit 7c76bf0

Browse files
committed
Expose APIs for clearing the ECMs internal state tracking addition and removal (#3002)
This is necessary for use with the `SetState` API. This API is commonly used to create a local version of the servers ECM that is periodically synchronized. However, without exposing this function into our public API additions and removals of entities or components are not reflected in the local ECM. Currently, we use `friend` relationships for the `GuiRunner` class to allow it to run these functions, but this is not feasible for external code that wants to use `SetState`. https://github.com/gazebosim/gz-sim/blob/5ce62a8826b930078fae940288ac9677aae9ec7b/include/gz/sim/EntityComponentManager.hh#L834, https://github.com/gazebosim/gz-sim/blob/5ce62a8826b930078fae940288ac9677aae9ec7b/src/gui/GuiRunner.cc#L316-L318 Signed-off-by: Addisu Z. Taddese <[email protected]> (cherry picked from commit b2f3c82)
1 parent daab6f2 commit 7c76bf0

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

include/gz/sim/EntityComponentManager.hh

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -684,21 +684,19 @@ namespace gz
684684
const std::string &_name) const;
685685

686686
/// \brief Clear the list of newly added entities so that a call to
687-
/// EachAdded after this will have no entities to iterate. This function
688-
/// is protected to facilitate testing.
689-
protected: void ClearNewlyCreatedEntities();
687+
/// EachAdded after this will have no entities to iterate.
688+
public: void ClearNewlyCreatedEntities();
690689

691690
/// \brief Clear the list of removed components so that a call to
692691
/// RemoveComponent doesn't make the list grow indefinitely.
693-
protected: void ClearRemovedComponents();
692+
public: void ClearRemovedComponents();
694693

695694
/// \brief Process all entity remove requests. This will remove
696-
/// entities and their components. This function is protected to
697-
/// facilitate testing.
698-
protected: void ProcessRemoveEntityRequests();
695+
/// entities and their components.
696+
public: void ProcessRemoveEntityRequests();
699697

700698
/// \brief Mark all components as not changed.
701-
protected: void SetAllComponentsUnchanged();
699+
public: void SetAllComponentsUnchanged();
702700

703701
/// Compute the diff between this EntityComponentManager and _other at the
704702
/// entity level. This does not compute the diff between components of an

0 commit comments

Comments
 (0)