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;
239 public:
template<
typename ComponentTypeT>
240 bool SetComponentData(
const Entity _entity,
241 const typename ComponentTypeT::Type &_data);
252 public:
template<
typename ComponentTypeT>
253 const ComponentTypeT *First()
const;
258 public:
template<
typename ComponentTypeT>
259 ComponentTypeT *First();
272 public:
template<
typename ...ComponentTypeTs>
273 Entity EntityByComponents(
274 const ComponentTypeTs &..._desiredComponents)
const;
288 public:
template<
typename ...ComponentTypeTs>
290 const ComponentTypeTs &..._desiredComponents)
const;
307 public:
template<
typename ...ComponentTypeTs>
309 const ComponentTypeTs &..._desiredComponents)
const;
312 private:
template <
typename T>
327 public:
template<
typename ...ComponentTypeTs>
329 bool(
const Entity &_entity,
330 const ComponentTypeTs *...)>>::type _f)
const;
344 public:
template<
typename ...ComponentTypeTs>
346 bool(
const Entity &_entity,
347 ComponentTypeTs *...)>>::type _f);
361 public:
template<
typename ...ComponentTypeTs>
363 bool(
const Entity &_entity,
364 const ComponentTypeTs *...)>>::type _f)
const;
378 public:
template<
typename ...ComponentTypeTs>
380 bool(
const Entity &_entity,
381 ComponentTypeTs *...)>>::type _f);
387 public:
template <
class Function,
class... ComponentTypeTs>
388 static void ForEach(Function _f,
const ComponentTypeTs &... _components);
401 public:
template <
typename... ComponentTypeTs>
403 bool(
const Entity &_entity,
404 ComponentTypeTs *...)>>::type _f);
417 public:
template <
typename... ComponentTypeTs>
419 bool(
const Entity &_entity,
420 const ComponentTypeTs *...)>>::type _f)
const;
432 public:
template<
typename ...ComponentTypeTs>
434 bool(
const Entity &_entity,
435 const ComponentTypeTs *...)>>::type _f)
const;
479 public:
bool HasNewEntities()
const;
483 public:
bool HasEntitiesMarkedForRemoval()
const;
488 public:
bool HasOneTimeComponentChanges()
const;
514 bool _full =
false)
const;
547 public:
void SetChanged(
562 public:
void SetEntityCreateOffset(uint64_t _offset);
567 protected:
void ClearNewlyCreatedEntities();
572 protected:
void ProcessRemoveEntityRequests();
575 protected:
void SetAllComponentsUnchanged();
583 private:
bool IsNewEntity(
const Entity _entity)
const;
588 private:
bool IsMarkedForRemoval(
const Entity _entity)
const;
593 private:
bool RemoveEntity(
const Entity _entity);
649 private:
template<
typename FirstComponent,
650 typename ...RemainingComponents,
652 sizeof...(RemainingComponents) == 0,
int>::type = 0>
653 void AddComponentsToView(detail::View &_view,
654 const Entity _entity)
const;
661 private:
template<
typename FirstComponent,
662 typename ...RemainingComponents,
664 sizeof...(RemainingComponents) != 0,
int>::type = 0>
665 void AddComponentsToView(detail::View &_view,
666 const Entity _entity)
const;
672 private:
template<
typename ...ComponentTypeTs>
673 detail::View &FindView()
const;
683 detail::View>::iterator &_iter)
const;
692 detail::View &&_view)
const;
696 private:
void UpdateViews(
const Entity _entity);
728 bool _full =
false)
const;
734 friend class SimulationRunner;
738 friend class NetworkManagerPrimary;
739 friend class NetworkManagerSecondary;
743 friend class detail::View;
749 #include "ignition/gazebo/detail/EntityComponentManager.hh" Responsible for running GUI systems as new states are received from the backend.
Definition: GuiRunner.hh:40
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:87
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:82
ComponentState
Possible states for a component.
Definition: Types.hh:64
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...