Live Cells C++
Reactive Programming for C++
Loading...
Searching...
No Matches
live_cells::state_manager Class Reference

Maintains the association between keys and cell states. More...

#include <cell_state.hpp>

Public Member Functions

template<typename S , typename... Args>
std::shared_ptr< Sget (key_ref k, Args... args)
 
void remove (key_ref k)
 

Static Public Member Functions

static state_managerglobal ()
 

Detailed Description

Maintains the association between keys and cell states.

Member Function Documentation

◆ get()

template<typename S , typename... Args>
std::shared_ptr< S > live_cells::state_manager::get ( key_ref k,
Args... args )
inline

Retrieve a cell state associated with a given key, or create a new state if there is no state associated with the given key.

A state of type S is created by passing one argument to its constructor, the key.

If k is a unique_key, or k->is_unique() is true, a new state is always created without associating it with the key.

Parameters
kThe key
argsAdditional arguments to pass to the constructor of the state.
Returns
Reference to the state

◆ global()

static state_manager & live_cells::state_manager::global ( )
inlinestatic

Retrieve the global state_manager instance.

◆ remove()

void live_cells::state_manager::remove ( key_ref k)
inline

Remove the state associated with a given key.

Parameters
kThe key

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