Class free_block_drop

Nested Relationships

Nested Types

Inheritance Relationships

Base Types

  • public rer::client< free_block_drop >

  • public cds::operations::cell2D_op

Class Documentation

class free_block_drop : public rer::client<free_block_drop>, public cds::operations::cell2D_op

Created whenever a block is dropped somewhere in the arena to handle block dropping for non-controller entities. Handling the controller side of block dropping in the arena cannot be handled here generically, so we don’t try.

Free block drops can happen when:

  • The loop functions are doing block distribution.

  • A robot aborts its task, and is carrying a block.

This class should never be instantiated, only derived from. To visit non-controller entities to handle block dropping, use free_block_drop_visitor.

Public Types

using visit_typelist = typename visit_typelist_impl::value

Public Functions

free_block_drop(const free_block_drop&) = delete
~free_block_drop(void) override = default
free_block_drop &operator=(const free_block_drop&) = delete
void visit(base_arena_map &map)

Perform actual block drop in the arena, taking/releasing locks as needed.

void visit(caching_arena_map &map)
void visit(cds::cell2D &cell)

Update the cell the block was dropped into. No locking is performed.

void visit(crepr::sim_block3D &block)

Update the dropped block.

  • Reset the ID of the robot carrying the block.

  • Update block location to the location of the drop.

This function does NOT update the distribution time, because it is called both when a robot drops a block AND when a block distribution happens, and the currentl time is very difficult to access in the second case.

Public Static Functions

static free_block_drop for_block(const rmath::vector2z &coord, const rtypes::discretize_ratio &resolution)

If this constructor is used, then the resulting object can ONLY be used to visit blocks; segfaults and/or undefined behavior will occur otherwise.

Parameters:
  • coord – The discrete coordinates of the cell to drop the block in.

  • resolution – The resolution of the arena map.

Protected Functions

free_block_drop(crepr::sim_block3D *block, const rmath::vector2z &coord, const rtypes::discretize_ratio &resolution, const locking &locking)
Parameters:
  • block – The block to drop, which is already part of the vector owned by the arena_map.

  • coord – The discrete coordinates of the cell to drop the block in.

  • resolution – The resolution of the arena map.

  • locking – What locks are currently held by the caller?