Class base_distributor
Defined in File base_distributor.hpp
Inheritance Relationships
Base Type
public cfbd::metrics::distributor_metrics
Derived Types
public cosm::foraging::block_dist::cluster_distributor
(Class cluster_distributor)public cosm::foraging::block_dist::multi_cluster_distributor
(Class multi_cluster_distributor)public cosm::foraging::block_dist::powerlaw_distributor
(Class powerlaw_distributor)public cosm::foraging::block_dist::random_distributor
(Class random_distributor)
Class Documentation
-
class base_distributor : public cfbd::metrics::distributor_metrics
Base class for block distributors to enable use of strategy pattern.
Subclassed by cosm::foraging::block_dist::cluster_distributor, cosm::foraging::block_dist::multi_cluster_distributor, cosm::foraging::block_dist::powerlaw_distributor, cosm::foraging::block_dist::random_distributor
Public Types
-
using dist_success_cb_type = std::function<void(const crepr::sim_block3D*)>
Public Functions
-
inline base_distributor(cads::arena_grid *arena_grid, rmath::rng *const rng)
-
base_distributor(const base_distributor&) = default
-
virtual ~base_distributor(void) = default
-
virtual cfds::block3D_cluster_vectorno block_clustersno(void) = 0
-
cfds::block3D_cluster_vectorro block_clustersro(void) const
Return a read-only list of cfrepr::block_cluster objects for capacity checking by external classes.
-
void cluster_update_after_drop(const crepr::sim_block3D *block)
-
void cluster_update_after_pickup(const crepr::sim_block3D *block, const rmath::vector2z &old_loc)
-
void clusters_update(void)
-
virtual dist_status distribute_block(crepr::sim_block3D *block) = 0
Distribute a block in the specified area by trying each random distributor in turn.
- Parameters:
block – The block to distribute.
- Returns:
TRUE
if the block distribution was successful,FALSE
otherwise.
-
inline virtual dist_status distribute_blocks(cds::block3D_vectorno &blocks, bool strict_success)
Calls distribute_block() on each block.
- Returns:
TRUE
iff all block distributions were successful,FALSE
otherwise.
-
base_distributor &operator=(const base_distributor&) = delete
Public Static Attributes
-
static constexpr const size_t kMAX_DIST_TRIES = 100
How many times to attempt to distribute all blocks before giving up, (possibly) causing an assertion failure on distribution.
-
using dist_success_cb_type = std::function<void(const crepr::sim_block3D*)>