gz/sim/EntityComponentManager.hh
Go to the documentation of this file.
254 ComponentTypeT *CreateComponent(
279 const ComponentTypeT IGN_DEPRECATED(6) * Component(
287 ComponentTypeT IGN_DEPRECATED(6) * Component(
339 const ComponentTypeT IGN_DEPRECATED(6) * First() const;
345 ComponentTypeT IGN_DEPRECATED(6) * First();
562 public: msgs::SerializedState State(
The EntityComponentManager constructs, deletes, and returns components and entities....
Definition: gz/sim/EntityComponentManager.hh:67
EntityComponentManager()
Constructor.
void ProcessRemoveEntityRequests()
Process all entity remove requests. This will remove entities and their components....
void RequestRemoveEntity(const Entity _entity, bool _recursive=true)
Request an entity deletion. This will insert the request into a queue. The queue is processed toward ...
bool HasComponentType(const ComponentTypeId _typeId) const
Get whether a component type has ever been created.
bool HasEntity(const Entity _entity) const
Get whether an Entity exists.
bool HasRemovedComponents() const
Return true if there are components marked for removal.
void SetEntityCreateOffset(uint64_t _offset)
All future entities will have an id that starts at _offset. This can be used to avoid entity id colli...
bool HasEntitiesMarkedForRemoval() const
Get whether there are any entities marked to be removed.
void ChangedState(msgs::SerializedStateMap &_state) const
Get a message with the serialized state of all entities and components that are changing in the curre...
void SetAllComponentsUnchanged()
Mark all components as not changed.
size_t EntityCount() const
Get the number of entities on the server.
void SetState(const msgs::SerializedState &_stateMsg)
Set the absolute state of the ECM from a serialized message. Entities / components that are in the ne...
void RequestRemoveEntities()
Request to remove all entities. This will insert the request into a queue. The queue is processed tow...
void ClearRemovedComponents()
Clear the list of removed components so that a call to RemoveComponent doesn't make the list grow ind...
Entity ParentEntity(const Entity _entity) const
Get the first parent of the given entity.
std::unordered_set< ComponentTypeId > ComponentTypesWithPeriodicChanges() const
Get the components types that are marked as periodic changes.
void SetState(const msgs::SerializedStateMap &_stateMsg)
Set the absolute state of the ECM from a serialized message. Entities / components that are in the ne...
msgs::SerializedState ChangedState() const
Get a message with the serialized state of all entities and components that are changing in the curre...
Entity Clone(Entity _entity, Entity _parent, const std::string &_name, bool _allowRename)
Clone an entity and its components. If the entity has any child entities, they will also be cloned....
void ClearNewlyCreatedEntities()
Clear the list of newly added entities so that a call to EachAdded after this will have no entities t...
bool HasPeriodicComponentChanges() const
Get whether there are periodic component changes. These changes may happen frequently and are process...
void UnpinAllEntities()
Allow all previously pinned entities to be removed.
bool HasNewEntities() const
Get whether there are new entities.
gz::sim::ComponentState ComponentState(const Entity _entity, const ComponentTypeId _typeId) const
Get a component's state.
void PeriodicStateFromCache(msgs::SerializedStateMap &_state, const std::unordered_map< ComponentTypeId, std::unordered_set< Entity >> &_cache) const
Populate a message with relevant changes to the state given a periodic change cache.
void State(msgs::SerializedStateMap &_state, const std::unordered_set< Entity > &_entities={}, const std::unordered_set< ComponentTypeId > &_types={}, bool _full=false) const
Get a message with the serialized state of the given entities and components.
void UpdatePeriodicChangeCache(std::unordered_map< ComponentTypeId, std::unordered_set< Entity >> &) const
Get a cache of components with periodic changes.
void PinEntity(const Entity _entity, bool _recursive=true)
Prevent an entity and optionally its children from being removed.
void UnpinEntity(const Entity _entity, bool _recursive=true)
Allow an entity, and optionally its children, previously marked as pinned to be removed.
bool SetParentEntity(const Entity _child, const Entity _parent)
Set the parent of an entity.
bool HasOneTimeComponentChanges() const
Get whether there are one-time component changes. These changes do not happen frequently and should b...
~EntityComponentManager()
Destructor.
void SetChanged(const Entity _entity, const ComponentTypeId _type, gz::sim::ComponentState _c=ComponentState::OneTimeChange)
Set the changed state of a component.
Base class for all components.
Definition: gz/sim/components/Component.hh:231
class IGNITION_GAZEBO_HIDDEN EntityComponentManagerPrivate
Definition: gz/sim/EntityComponentManager.hh:51
math::graph::DirectedGraph< Entity, bool > EntityGraph
Type alias for the graph that holds entities. Each vertex is an entity, and the direction points from...
Definition: gz/sim/EntityComponentManager.hh:57
void set(msgs::SensorNoise *_msg, const sdf::Noise &_sdf)
Helper function that sets a mutable msgs::SensorNoise object to the values contained in a sdf::Noise ...
uint64_t ComponentTypeId
A unique identifier for a component type. A component type must be derived from components::BaseCompo...
Definition: include/gz/sim/Types.hh:90
uint64_t Entity
An Entity identifies a single object in simulation such as a model, link, or light....
Definition: gz/sim/Entity.hh:58
ComponentState
Possible states for a component.
Definition: include/gz/sim/Types.hh:66
@ OneTimeChange
Component value has suffered a one-time change. This indicates to systems that this change must be pr...
STL namespace.