17 #ifndef GZ_SIM_ENTITYCOMPONENTMANAGER_HH_
18 #define GZ_SIM_ENTITYCOMPONENTMANAGER_HH_
20 #include <gz/msgs/serialized.pb.h>
21 #include <gz/msgs/serialized_map.pb.h>
29 #include <type_traits>
30 #include <unordered_set>
31 #include <unordered_map>
35 #include <gz/common/Console.hh>
36 #include <gz/math/graph/Graph.hh>
38 #include "gz/sim/Export.hh"
42 #include "gz/sim/detail/View.hh"
49 inline namespace GZ_SIM_VERSION_NAMESPACE {
52 class EntityComponentManagerDiff;
138 bool _recursive =
true);
232 public:
template<
typename ComponentTypeT>
247 public:
template<
typename ComponentTypeT>
250 const ComponentTypeT &_data);
257 public:
template<
typename ComponentTypeT>
265 public:
template<
typename ComponentTypeT>
276 public:
template<
typename ComponentTypeT>
278 const typename ComponentTypeT::Type &_default =
279 typename ComponentTypeT::Type());
289 public:
template<
typename ComponentTypeT>
291 const Entity _entity)
const;
303 public:
template<
typename ComponentTypeT>
305 const typename ComponentTypeT::Type &_data);
324 public:
template<
typename ...ComponentTypeTs>
326 const ComponentTypeTs &..._desiredComponents)
const;
340 public:
template<
typename ...ComponentTypeTs>
342 const ComponentTypeTs &..._desiredComponents)
const;
359 public:
template<
typename ...ComponentTypeTs>
361 const ComponentTypeTs &..._desiredComponents)
const;
364 private:
template <
typename T>
394 public:
template<
typename ...ComponentTypeTs>
396 bool(
const Entity &_entity,
397 const ComponentTypeTs *...)>>::type _f)
const;
411 public:
template<
typename ...ComponentTypeTs>
413 bool(
const Entity &_entity,
414 ComponentTypeTs *...)>>::type _f);
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);
454 public:
template <
class Function,
class... ComponentTypeTs>
455 static void ForEach(Function _f,
const ComponentTypeTs &... _components);
471 public:
template <
typename... ComponentTypeTs>
473 bool(
const Entity &_entity,
474 ComponentTypeTs *...)>>::type _f);
488 public:
template <
typename... ComponentTypeTs>
490 bool(
const Entity &_entity,
491 const ComponentTypeTs *...)>>::type _f)
const;
503 public:
template<
typename ...ComponentTypeTs>
505 bool(
const Entity &_entity,
506 const ComponentTypeTs *...)>>::type _f)
const;
528 public: msgs::SerializedState
State(
589 public:
void SetState(
const msgs::SerializedState &_stateMsg);
603 msgs::SerializedStateMap &_state,
606 bool _full =
false)
const;
617 msgs::SerializedStateMap &_state,
644 public:
void SetState(
const msgs::SerializedStateMap &_stateMsg);
720 const EntityComponentManagerDiff &_diff);
728 private:
bool IsNewEntity(
const Entity _entity)
const;
733 private:
bool IsMarkedForRemoval(
const Entity _entity)
const;
742 private:
bool CreateComponentImplementation(
769 private:
template<
typename ...ComponentTypeTs>
770 detail::View *FindView()
const;
787 private: detail::BaseView *AddView(
788 const detail::ComponentTypeKey &_types,
796 private:
void AddEntityToMessage(msgs::SerializedState &_msg,
812 private:
void AddEntityToMessage(msgs::SerializedStateMap &_msg,
815 bool _full =
false)
const;
825 private:
void LockAddingEntitiesToViews(
bool _lock);
831 private:
bool LockAddingEntitiesToViews()
const;
836 friend class GuiRunner;
837 friend class SimulationRunner;
840 friend class SystemManager;
844 friend class NetworkManagerPrimary;
845 friend class NetworkManagerSecondary;
851 #include "gz/sim/detail/EntityComponentManager.hh"