aether::entity_based_user_state_adapter< EntityUserState > Class Template Referenceabstract

#include <user_state.hh>

Public Member Functions

template<typename... Args>
 entity_based_user_state_adapter (const aether_state_type &aether_state, Args &&...args)
 
bool is_empty () const override
 Used for debugging purposes to verify that there are no entities in the cell after the cell has beed deleted. More...
 
bool is_idle () const override
 
void deinitialise_cell (const aether_state_type &aether_state) override
 
void initialise_cell (const aether_state_type &aether_state) override
 
void serialize_to_client (const aether_state_type &aether_state, client_writer_type &writer) override
 
void initialise_world (const aether_state_type &aether_state) override
 
void cell_tick (const aether_state_type &aether_state, float delta_time) override
 
std::vector< subscriber_topic_type > get_topics (const aether_state_type &aether_state) override
 
void receive_messages (const aether_state_type &aether_state, message_reader_type &reader) override
 
void send_messages (const aether_state_type &aether_state, message_writer_type &writer) override
 
float estimate_load (const aether_state_type &aether_state) override
 
virtual std::vector< key_type > get_global_kv_store_queries (const aether::cell_state< octree_traits > &aether_state) override
 override this function to provide a list of keys to be queried More...
 
virtual void global_kv_store_responses (const aether::cell_state< octree_traits > &aether_state, const std::unordered_map< key_type, data_type > &responses) override
 override this function to process the data received from the global_kv_store More...
 
virtual std::unordered_map< key_type, data_type > publish_global_kv_store_data (const aether::cell_state< octree_traits > &aether_state) override
 override this function to update data to the global_kv_store so it is accessible by other workers More...
 
region_type< aether::monostateget_coverage (const aether_state_type &aether_state, const std::optional< cell_type > &old_cell) override
 
std::vector< bool > handover (const aether_state_type &aether_state, size_t num_neighbours, const std::optional< cell_type > *neighbour_cells, aether::neighbour_exchange_context &exchange) override
 
std::unique_ptr< external_storage_ifacebuild_external_storage (const aether::cell_state< octree_traits > &aether_state) override
 
virtual void initialise_cell (const aether::cell_state< octree_traits > &aether_state)=0
 This is called once on creation of the cell. More...
 
virtual void deinitialise_cell (const aether::cell_state< octree_traits > &aether_state)=0
 This is called once when a cell is de-initialised. More...
 
virtual void serialize_to_client (const aether::cell_state< octree_traits > &aether_state, client_writer_type &writer)=0
 This is called by the worker to send messages to the muxer. More...
 
virtual void cell_tick (const aether::cell_state< octree_traits > &aether_state, float delta_time)=0
 This is the basic worker tick function. More...
 
virtual region_type< aether::monostateget_coverage (const aether::cell_state< octree_traits > &aether_state, const std::optional< cell_type > &old_cell)=0
 
virtual std::vector< bool > handover (const aether::cell_state< octree_traits > &aether_state, size_t num_neighbours, const std::optional< cell_type > *neighbour_cells, aether::neighbour_exchange_context &exchange)=0
 
virtual void initialise_world (const aether::cell_state< octree_traits > &aether_state)=0
 This is called to initialise the simulation world. More...
 
virtual std::vector< message::subscriber_topic_typeget_topics (const aether::cell_state< octree_traits > &aether_state)=0
 This is called every tick to specify which messages will be routed to this worker. More...
 
virtual void receive_messages (const aether::cell_state< octree_traits > &aether_state, message_reader_type &reader)=0
 This is called every tick to handle events received from the muxers or other Aether processes. More...
 
virtual void send_messages (const aether::cell_state< octree_traits > &aether_state, message_writer_type &writer)=0
 This function is used to send messages to dispatcher. More...
 
virtual float estimate_load (const aether::cell_state< octree_traits > &aether_state)=0
 The value produced by this is used by the manager to decide if a cell should split or merge. More...
 
virtual std::unique_ptr< external_storage_ifacebuild_external_storage (const aether::cell_state< octree_traits > &aether_state)=0
 Override in order to implement external storage for the cell process. More...
 
virtual std::vector< key_type > get_global_kv_store_queries (const aether::cell_state< octree_traits > &aether_state)=0
 returns a list of keys to querie the value one time More...
 
virtual void global_kv_store_responses (const aether::cell_state< octree_traits > &aether_state, const std::unordered_map< key_type, data_type > &responses)=0
 processess the responses from the global store More...
 
virtual std::unordered_map< key_type, data_type > publish_global_kv_store_data (const aether::cell_state< octree_traits > &aether_state)=0
 publishes data to the store to make it avaliable to other workers More...
 

Constructor & Destructor Documentation

template<typename EntityUserState >
template<typename... Args>
aether::entity_based_user_state_adapter< EntityUserState >::entity_based_user_state_adapter ( const aether_state_type aether_state,
Args &&...  args 
)
inline

Member Function Documentation

virtual std::unique_ptr<external_storage_iface> aether::user_cell_state_interface< EntityUserState::traits_type::octree_traits >::build_external_storage ( const aether::cell_state< octree_traits > &  aether_state)
pure virtualinherited

Override in order to implement external storage for the cell process.

See aether::external_storage_base.

template<typename EntityUserState >
std::unique_ptr<external_storage_iface> aether::entity_based_user_state_adapter< EntityUserState >::build_external_storage ( const aether::cell_state< octree_traits > &  aether_state)
inlineoverride
virtual void aether::user_cell_state_interface< EntityUserState::traits_type::octree_traits >::cell_tick ( const aether::cell_state< octree_traits > &  aether_state,
float  delta_time 
)
pure virtualinherited

This is the basic worker tick function.

Write your main simulation code here.

template<typename EntityUserState >
void aether::entity_based_user_state_adapter< EntityUserState >::cell_tick ( const aether_state_type aether_state,
float  delta_time 
)
inlineoverride
virtual void aether::user_cell_state_interface< EntityUserState::traits_type::octree_traits >::deinitialise_cell ( const aether::cell_state< octree_traits > &  aether_state)
pure virtualinherited

This is called once when a cell is de-initialised.

This can occur as part of a merge, or because the cell is empty.

template<typename EntityUserState >
void aether::entity_based_user_state_adapter< EntityUserState >::deinitialise_cell ( const aether_state_type aether_state)
inlineoverride
virtual float aether::user_cell_state_interface< EntityUserState::traits_type::octree_traits >::estimate_load ( const aether::cell_state< octree_traits > &  aether_state)
pure virtualinherited

The value produced by this is used by the manager to decide if a cell should split or merge.

By default Aether will try to split the cell if load is larger than 1.0, and merge if it's below 0.2.

template<typename EntityUserState >
float aether::entity_based_user_state_adapter< EntityUserState >::estimate_load ( const aether_state_type aether_state)
inlineoverride
virtual region_type<aether::monostate> aether::user_cell_state_interface< EntityUserState::traits_type::octree_traits >::get_coverage ( const aether::cell_state< octree_traits > &  aether_state,
const std::optional< cell_type > &  old_cell 
)
pure virtualinherited
Returns
aether::region representing the area of the cell
template<typename EntityUserState >
region_type<aether::monostate> aether::entity_based_user_state_adapter< EntityUserState >::get_coverage ( const aether_state_type aether_state,
const std::optional< cell_type > &  old_cell 
)
inlineoverride
virtual std::vector<key_type> aether::user_cell_state_interface< EntityUserState::traits_type::octree_traits >::get_global_kv_store_queries ( const aether::cell_state< octree_traits > &  aether_state)
pure virtualinherited

returns a list of keys to querie the value one time

template<typename EntityUserState >
virtual std::vector<key_type> aether::entity_based_user_state_adapter< EntityUserState >::get_global_kv_store_queries ( const aether::cell_state< octree_traits > &  aether_state)
inlineoverridevirtual

override this function to provide a list of keys to be queried

virtual std::vector<message::subscriber_topic_type> aether::user_cell_state_interface< EntityUserState::traits_type::octree_traits >::get_topics ( const aether::cell_state< octree_traits > &  aether_state)
pure virtualinherited

This is called every tick to specify which messages will be routed to this worker.

In addition to messages explicitly directed to this worker, the worker will also receive messages directed to topics this worker has subscribed to, such as messages intended for a particular aether::message::topic::entity_id or aether::message::topic::user_id. Specifying one of more instances of a aether::message::topic::user_id enables this worker to receive messages from the muxer.

Messages for which there are no subscribed Aether processes can be received by specifying the aether::message::topic::unclaimed_events topic.

template<typename EntityUserState >
std::vector<subscriber_topic_type> aether::entity_based_user_state_adapter< EntityUserState >::get_topics ( const aether_state_type aether_state)
inlineoverride
virtual void aether::user_cell_state_interface< EntityUserState::traits_type::octree_traits >::global_kv_store_responses ( const aether::cell_state< octree_traits > &  aether_state,
const std::unordered_map< key_type, data_type > &  responses 
)
pure virtualinherited

processess the responses from the global store

template<typename EntityUserState >
virtual void aether::entity_based_user_state_adapter< EntityUserState >::global_kv_store_responses ( const aether::cell_state< octree_traits > &  aether_state,
const std::unordered_map< key_type, data_type > &  responses 
)
inlineoverridevirtual

override this function to process the data received from the global_kv_store

virtual std::vector<bool> aether::user_cell_state_interface< EntityUserState::traits_type::octree_traits >::handover ( const aether::cell_state< octree_traits > &  aether_state,
size_t  num_neighbours,
const std::optional< cell_type > *  neighbour_cells,
aether::neighbour_exchange_context &  exchange 
)
pure virtualinherited
template<typename EntityUserState >
std::vector<bool> aether::entity_based_user_state_adapter< EntityUserState >::handover ( const aether_state_type aether_state,
size_t  num_neighbours,
const std::optional< cell_type > *  neighbour_cells,
aether::neighbour_exchange_context &  exchange 
)
inlineoverride
virtual void aether::user_cell_state_interface< EntityUserState::traits_type::octree_traits >::initialise_cell ( const aether::cell_state< octree_traits > &  aether_state)
pure virtualinherited

This is called once on creation of the cell.

It is not called when a cell changes size.

template<typename EntityUserState >
void aether::entity_based_user_state_adapter< EntityUserState >::initialise_cell ( const aether_state_type aether_state)
inlineoverride
virtual void aether::user_cell_state_interface< EntityUserState::traits_type::octree_traits >::initialise_world ( const aether::cell_state< octree_traits > &  aether_state)
pure virtualinherited

This is called to initialise the simulation world.

It's run only on first worker (and after its cell is initialised).

Example usage: creating the world volume or the initial agents.

template<typename EntityUserState >
void aether::entity_based_user_state_adapter< EntityUserState >::initialise_world ( const aether_state_type aether_state)
inlineoverride
template<typename EntityUserState >
bool aether::entity_based_user_state_adapter< EntityUserState >::is_empty ( ) const
inlineoverridevirtual

Used for debugging purposes to verify that there are no entities in the cell after the cell has beed deleted.

Implements aether::user_cell_state_interface< EntityUserState::traits_type::octree_traits >.

template<typename EntityUserState >
bool aether::entity_based_user_state_adapter< EntityUserState >::is_idle ( ) const
inlineoverridevirtual
Returns
true when the cell can to be deinitialized.

By default the cells are deinitialized when they don't own any agents and there are no ghost agents nearby which could be moved into the cell

Implements aether::user_cell_state_interface< EntityUserState::traits_type::octree_traits >.

virtual std::unordered_map<key_type, data_type> aether::user_cell_state_interface< EntityUserState::traits_type::octree_traits >::publish_global_kv_store_data ( const aether::cell_state< octree_traits > &  aether_state)
pure virtualinherited

publishes data to the store to make it avaliable to other workers

template<typename EntityUserState >
virtual std::unordered_map<key_type, data_type> aether::entity_based_user_state_adapter< EntityUserState >::publish_global_kv_store_data ( const aether::cell_state< octree_traits > &  aether_state)
inlineoverridevirtual

override this function to update data to the global_kv_store so it is accessible by other workers

virtual void aether::user_cell_state_interface< EntityUserState::traits_type::octree_traits >::receive_messages ( const aether::cell_state< octree_traits > &  aether_state,
message_reader_type &  reader 
)
pure virtualinherited

This is called every tick to handle events received from the muxers or other Aether processes.

It's up to the user code to distinguish between the two. The reader enables the user code to read multiple messages.

template<typename EntityUserState >
void aether::entity_based_user_state_adapter< EntityUserState >::receive_messages ( const aether_state_type aether_state,
message_reader_type &  reader 
)
inlineoverride
virtual void aether::user_cell_state_interface< EntityUserState::traits_type::octree_traits >::send_messages ( const aether::cell_state< octree_traits > &  aether_state,
message_writer_type &  writer 
)
pure virtualinherited

This function is used to send messages to dispatcher.

It might be used for example to communicate with Global State.

template<typename EntityUserState >
void aether::entity_based_user_state_adapter< EntityUserState >::send_messages ( const aether_state_type aether_state,
message_writer_type &  writer 
)
inlineoverride
virtual void aether::user_cell_state_interface< EntityUserState::traits_type::octree_traits >::serialize_to_client ( const aether::cell_state< octree_traits > &  aether_state,
client_writer_type &  writer 
)
pure virtualinherited

This is called by the worker to send messages to the muxer.

This is used to send information to the clients.

template<typename EntityUserState >
void aether::entity_based_user_state_adapter< EntityUserState >::serialize_to_client ( const aether_state_type aether_state,
client_writer_type &  writer 
)
inlineoverride