17 #ifndef IGNITION_GAZEBO_ENTITYCOMPONENTMANAGER_HH_ 18 #define IGNITION_GAZEBO_ENTITYCOMPONENTMANAGER_HH_ 28 #include <type_traits> 29 #include <unordered_set> 36 #include "ignition/gazebo/Export.hh" 40 #include "ignition/gazebo/detail/View.hh" 47 inline namespace IGNITION_GAZEBO_VERSION_NAMESPACE {
74 public:
Entity CreateEntity();
78 public:
size_t EntityCount()
const;
91 public:
void RequestRemoveEntity(
const Entity _entity,
92 bool _recursive =
true);
97 public:
void RequestRemoveEntities();
102 public:
bool HasEntity(
const Entity _entity)
const;
120 public:
bool SetParentEntity(
const Entity _child,
const Entity _parent);
131 public:
bool EntityHasComponent(
const Entity _entity,
139 public:
bool EntityHasComponentType(
const Entity _entity,
146 public:
bool EntityMatches(
Entity _entity,
154 public:
bool RemoveComponent(
162 public:
bool RemoveComponent(
170 public:
template<
typename ComponentTypeT>
171 bool RemoveComponent(
Entity _entity);
175 public:
void RebuildViews();
183 public:
template<
typename ComponentTypeT>
185 const ComponentTypeT &_data);
192 public:
template<
typename ComponentTypeT>
193 const ComponentTypeT *Component(
const Entity _entity)
const;
200 public:
template<
typename ComponentTypeT>
201 ComponentTypeT *Component(
const Entity _entity);
207 public:
template<
typename ComponentTypeT>
208 const ComponentTypeT *Component(
const ComponentKey &_key)
const;
214 public:
template<
typename ComponentTypeT>
225 public:
template<
typename ComponentTypeT>
226 std::optional<typename ComponentTypeT::Type> ComponentData(
227 const Entity _entity)
const;
238 public:
template<
typename ComponentTypeT>
239 const ComponentTypeT *First()
const;
244 public:
template<
typename ComponentTypeT>
245 ComponentTypeT *First();
258 public:
template<
typename ...ComponentTypeTs>
259 Entity EntityByComponents(
260 const ComponentTypeTs &..._desiredComponents)
const;
274 public:
template<
typename ...ComponentTypeTs>
276 const ComponentTypeTs &..._desiredComponents)
const;
293 public:
template<
typename ...ComponentTypeTs>
295 const ComponentTypeTs &..._desiredComponents)
const;
298 private:
template <
typename T>
313 public:
template<
typename ...ComponentTypeTs>
315 bool(
const Entity &_entity,
316 const ComponentTypeTs *...)>>::type _f)
const;
330 public:
template<
typename ...ComponentTypeTs>
332 bool(
const Entity &_entity,
333 ComponentTypeTs *...)>>::type _f);
347 public:
template<
typename ...ComponentTypeTs>
349 bool(
const Entity &_entity,
350 const ComponentTypeTs *...)>>::type _f)
const;
364 public:
template<
typename ...ComponentTypeTs>
366 bool(
const Entity &_entity,
367 ComponentTypeTs *...)>>::type _f);
373 public:
template <
class Function,
class... ComponentTypeTs>
374 static void ForEach(Function _f,
const ComponentTypeTs &... _components);
387 public:
template <
typename... ComponentTypeTs>
389 bool(
const Entity &_entity,
390 ComponentTypeTs *...)>>::type _f);
403 public:
template <
typename... ComponentTypeTs>
405 bool(
const Entity &_entity,
406 const ComponentTypeTs *...)>>::type _f)
const;
418 public:
template<
typename ...ComponentTypeTs>
420 bool(
const Entity &_entity,
421 const ComponentTypeTs *...)>>::type _f)
const;
465 public:
bool HasNewEntities()
const;
469 public:
bool HasEntitiesMarkedForRemoval()
const;
474 public:
bool HasOneTimeComponentChanges()
const;
500 bool _full =
false)
const;
533 public:
void SetChanged(
548 public:
void SetEntityCreateOffset(uint64_t _offset);
553 protected:
void ClearNewlyCreatedEntities();
557 protected:
void ClearRemovedComponents();
562 protected:
void ProcessRemoveEntityRequests();
565 protected:
void SetAllComponentsUnchanged();
573 private:
bool IsNewEntity(
const Entity _entity)
const;
578 private:
bool IsMarkedForRemoval(
const Entity _entity)
const;
583 private:
bool RemoveEntity(
const Entity _entity);
639 private:
template<
typename FirstComponent,
640 typename ...RemainingComponents,
642 sizeof...(RemainingComponents) == 0,
int>::type = 0>
643 void AddComponentsToView(detail::View &_view,
644 const Entity _entity)
const;
651 private:
template<
typename FirstComponent,
652 typename ...RemainingComponents,
654 sizeof...(RemainingComponents) != 0,
int>::type = 0>
655 void AddComponentsToView(detail::View &_view,
656 const Entity _entity)
const;
662 private:
template<
typename ...ComponentTypeTs>
663 detail::View &FindView()
const;
673 detail::View>::iterator &_iter)
const;
682 detail::View &&_view)
const;
686 private:
void UpdateViews(
const Entity _entity);
718 bool _full =
false)
const;
724 friend class SimulationRunner;
728 friend class NetworkManagerPrimary;
729 friend class NetworkManagerSecondary;
733 friend class detail::View;
739 #include "ignition/gazebo/detail/EntityComponentManager.hh" Responsible for running GUI systems as new states are received from the backend.
Definition: GuiRunner.hh:38
Component< Entity, class ParentEntityTag > ParentEntity
This component holds an entity's parent entity.
Definition: ParentEntity.hh:41
The EntityComponentManager constructs, deletes, and returns components and entities. A component can be of any class which inherits from components::BaseComponent.
Definition: EntityComponentManager.hh:64
uint64_t ComponentTypeId
A unique identifier for a component type. A component type must be derived from components::BaseCompo...
Definition: Types.hh:86
class IGNITION_GAZEBO_HIDDEN EntityComponentManagerPrivate
Definition: EntityComponentManager.hh:49
int ComponentId
A unique identifier for a component instance. The uniqueness of a ComponentId is scoped to the compon...
Definition: Types.hh:81
ComponentState
Possible states for a component.
Definition: Types.hh:63
This library is part of the Ignition Robotics project.
uint64_t Entity
An Entity identifies a single object in simulation such as a model, link, or light. At its core, an Entity is just an identifier.
Definition: Entity.hh:59
Base class for all components.
Definition: Component.hh:230
Component value has suffered a one-time change. This indicates to systems that this change must be pr...