17 #ifndef IGNITION_GAZEBO_ENTITYCOMPONENTMANAGER_HH_ 18 #define IGNITION_GAZEBO_ENTITYCOMPONENTMANAGER_HH_ 29 #include <type_traits> 30 #include <unordered_set> 31 #include <unordered_map> 38 #include "ignition/gazebo/Export.hh" 42 #include "ignition/gazebo/detail/View.hh" 49 inline namespace IGNITION_GAZEBO_VERSION_NAMESPACE {
76 public:
Entity CreateEntity();
115 public:
size_t EntityCount()
const;
128 public:
void RequestRemoveEntity(
const Entity _entity,
129 bool _recursive =
true);
146 public:
void PinEntity(
const Entity _entity,
bool _recursive =
true);
154 public:
void UnpinEntity(
const Entity _entity,
bool _recursive =
true);
158 public:
void UnpinAllEntities();
163 public:
void RequestRemoveEntities();
168 public:
bool HasEntity(
const Entity _entity)
const;
188 public:
bool SetParentEntity(
const Entity _child,
const Entity _parent);
207 public:
bool EntityHasComponentType(
const Entity _entity,
214 public:
bool EntityMatches(
Entity _entity,
230 public:
bool RemoveComponent(
238 public:
template<
typename ComponentTypeT>
239 bool RemoveComponent(
Entity _entity);
243 public:
void RebuildViews();
253 public:
template<
typename ComponentTypeT>
254 ComponentTypeT *CreateComponent(
256 const ComponentTypeT &_data);
263 public:
template<
typename ComponentTypeT>
264 const ComponentTypeT *Component(
const Entity _entity)
const;
271 public:
template<
typename ComponentTypeT>
272 ComponentTypeT *Component(
const Entity _entity);
278 public:
template<
typename ComponentTypeT>
286 public:
template<
typename ComponentTypeT>
298 public:
template<
typename ComponentTypeT>
299 ComponentTypeT *ComponentDefault(
Entity _entity,
300 const typename ComponentTypeT::Type &_default =
301 typename ComponentTypeT::Type());
311 public:
template<
typename ComponentTypeT>
312 std::optional<typename ComponentTypeT::Type> ComponentData(
313 const Entity _entity)
const;
325 public:
template<
typename ComponentTypeT>
326 bool SetComponentData(
const Entity _entity,
327 const typename ComponentTypeT::Type &_data);
338 public:
template<
typename ComponentTypeT>
344 public:
template<
typename ComponentTypeT>
358 public:
template<
typename ...ComponentTypeTs>
359 Entity EntityByComponents(
360 const ComponentTypeTs &..._desiredComponents)
const;
374 public:
template<
typename ...ComponentTypeTs>
376 const ComponentTypeTs &..._desiredComponents)
const;
393 public:
template<
typename ...ComponentTypeTs>
395 const ComponentTypeTs &..._desiredComponents)
const;
398 private:
template <
typename T>
428 public:
template<
typename ...ComponentTypeTs>
430 bool(
const Entity &_entity,
431 const ComponentTypeTs *...)>>::type _f)
const;
445 public:
template<
typename ...ComponentTypeTs>
447 bool(
const Entity &_entity,
448 ComponentTypeTs *...)>>::type _f);
462 public:
template<
typename ...ComponentTypeTs>
464 bool(
const Entity &_entity,
465 const ComponentTypeTs *...)>>::type _f)
const;
479 public:
template<
typename ...ComponentTypeTs>
481 bool(
const Entity &_entity,
482 ComponentTypeTs *...)>>::type _f);
488 public:
template <
class Function,
class... ComponentTypeTs>
489 static void ForEach(Function _f,
const ComponentTypeTs &... _components);
505 public:
template <
typename... ComponentTypeTs>
507 bool(
const Entity &_entity,
508 ComponentTypeTs *...)>>::type _f);
522 public:
template <
typename... ComponentTypeTs>
524 bool(
const Entity &_entity,
525 const ComponentTypeTs *...)>>::type _f)
const;
537 public:
template<
typename ...ComponentTypeTs>
539 bool(
const Entity &_entity,
540 const ComponentTypeTs *...)>>::type _f)
const;
582 public:
bool HasNewEntities()
const;
586 public:
bool HasEntitiesMarkedForRemoval()
const;
591 public:
bool HasOneTimeComponentChanges()
const;
597 ComponentTypesWithPeriodicChanges()
const;
624 bool _full =
false)
const;
655 public:
void SetChanged(
670 public:
void SetEntityCreateOffset(uint64_t _offset);
675 protected:
void ClearNewlyCreatedEntities();
679 protected:
void ClearRemovedComponents();
684 protected:
void ProcessRemoveEntityRequests();
687 protected:
void SetAllComponentsUnchanged();
695 private:
bool IsNewEntity(
const Entity _entity)
const;
700 private:
bool IsMarkedForRemoval(
const Entity _entity)
const;
709 private:
bool CreateComponentImplementation(
736 private:
template<
typename ...ComponentTypeTs>
737 detail::View<ComponentTypeTs...> *FindView()
const;
754 private: detail::BaseView *AddView(
755 const detail::ComponentTypeKey &_types,
782 bool _full =
false)
const;
792 private:
void LockAddingEntitiesToViews(
bool _lock);
798 private:
bool LockAddingEntitiesToViews()
const;
803 friend class GuiRunner;
804 friend class SimulationRunner;
808 friend class NetworkManagerPrimary;
809 friend class NetworkManagerSecondary;
815 #include "ignition/gazebo/detail/EntityComponentManager.hh" 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:66
uint64_t ComponentTypeId
A unique identifier for a component type. A component type must be derived from components::BaseCompo...
Definition: Types.hh:90
class IGNITION_GAZEBO_HIDDEN EntityComponentManagerPrivate
Definition: EntityComponentManager.hh:51
#define IGN_DEPRECATED(version)
ComponentState
Possible states for a component.
Definition: Types.hh:65
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...