Fx2D
A C++20 2D rigid-body physics engine
Loading...
Searching...
No Matches
FxEntityRegistry Class Reference

#include <Registry.h>

+ Inheritance diagram for FxEntityRegistry:
+ Collaboration diagram for FxEntityRegistry:

Public Member Functions

 FxEntityRegistry ()=default
 
 FxEntityRegistry (size_t max_size)
 
bool add (const std::shared_ptr< FxEntity > &entity) override
 
bool remove (const std::string &name) override
 
void clear ()
 
void enable_collision (const std::string &entity1_name, const std::string &entity2_name)
 
void disable_collision (const std::string &entity1_name, const std::string &entity2_name)
 
std::vector< std::pair< size_t, size_t > > get_broad_phase_pairs (float sweep_dt=0.0f) const
 
void get_broad_phase_pairs (std::vector< std::pair< size_t, size_t > > &pairs, float sweep_dt=0.0f, bool sweep_all_movers=false, bool skip_sleeping_pairs=true) const
 
bool sync_broad_phase (float sweep_dt=0.0f, bool sweep_all_movers=false) const
 
void collect_broad_phase_pairs (std::vector< std::pair< size_t, size_t > > &pairs, bool skip_sleeping_pairs=true) const
 
- Public Member Functions inherited from FxNamedRegistry< FxEntity >
 FxNamedRegistry ()=default
 
 FxNamedRegistry (size_t max_size)
 
void reserve (size_t n)
 
size_t size () const noexcept
 
bool empty () const noexcept
 
void set_max_size (size_t n)
 
std::shared_ptr< FxEntity > get (const std::string &name) const
 
FxEntity * get_rawptr (const std::string &name) const noexcept
 
std::string make_unique_name (const std::string &base) const
 
const std::vector< std::shared_ptr< FxEntity > > & items () const noexcept
 
std::vector< std::shared_ptr< FxEntity > > & items () noexcept
 
void clear ()
 
void shrink_to_fit ()
 
void for_each (ExecPolicy &&policy, Func &&func)
 
void transform (ExecPolicy &&policy, Func &&func, std::vector< std::invoke_result_t< Func, std::shared_ptr< FxEntity > > > &results)
 

Additional Inherited Members

- Protected Member Functions inherited from FxNamedRegistry< FxEntity >
bool _add (const std::shared_ptr< FxEntity > &item)
 
bool _remove (const std::string &name)
 
- Protected Attributes inherited from FxNamedRegistry< FxEntity >
std::vector< std::shared_ptr< FxEntity > > m_items_vec
 
std::unordered_map< std::string, size_t > m_name_map
 
size_t m_size_limit
 
size_t m_max_size
 

Detailed Description

Definition at line 221 of file Registry.h.

Constructor & Destructor Documentation

◆ FxEntityRegistry() [1/2]

FxEntityRegistry::FxEntityRegistry ( )
default

◆ FxEntityRegistry() [2/2]

FxEntityRegistry::FxEntityRegistry ( size_t  max_size)
inlineexplicit

Definition at line 263 of file Registry.h.

Member Function Documentation

◆ add()

bool FxEntityRegistry::add ( const std::shared_ptr< FxEntity > &  entity)
inlineoverridevirtual

Reimplemented from FxNamedRegistry< FxEntity >.

Definition at line 270 of file Registry.h.

◆ clear()

void FxEntityRegistry::clear ( )
inline

Definition at line 323 of file Registry.h.

◆ collect_broad_phase_pairs()

void FxEntityRegistry::collect_broad_phase_pairs ( std::vector< std::pair< size_t, size_t > > &  pairs,
bool  skip_sleeping_pairs = true 
) const
inline

Definition at line 439 of file Registry.h.

◆ disable_collision()

void FxEntityRegistry::disable_collision ( const std::string &  entity1_name,
const std::string &  entity2_name 
)
inline

Definition at line 349 of file Registry.h.

◆ enable_collision()

void FxEntityRegistry::enable_collision ( const std::string &  entity1_name,
const std::string &  entity2_name 
)
inline

Definition at line 340 of file Registry.h.

◆ get_broad_phase_pairs() [1/2]

std::vector< std::pair< size_t, size_t > > FxEntityRegistry::get_broad_phase_pairs ( float  sweep_dt = 0.0f) const
inline

Definition at line 360 of file Registry.h.

◆ get_broad_phase_pairs() [2/2]

void FxEntityRegistry::get_broad_phase_pairs ( std::vector< std::pair< size_t, size_t > > &  pairs,
float  sweep_dt = 0.0f,
bool  sweep_all_movers = false,
bool  skip_sleeping_pairs = true 
) const
inline

Definition at line 369 of file Registry.h.

◆ remove()

bool FxEntityRegistry::remove ( const std::string &  name)
inlineoverridevirtual

Reimplemented from FxNamedRegistry< FxEntity >.

Definition at line 293 of file Registry.h.

◆ sync_broad_phase()

bool FxEntityRegistry::sync_broad_phase ( float  sweep_dt = 0.0f,
bool  sweep_all_movers = false 
) const
inline

Definition at line 379 of file Registry.h.


The documentation for this class was generated from the following file: