Class block_metadata

Inheritance Relationships

Base Types

  • public cforaging::metrics::block_transportee_metrics

  • public cosm::repr::colored_entity (Class colored_entity)

Class Documentation

class block_metadata : public cforaging::metrics::block_transportee_metrics, public cosm::repr::colored_entity

Metadata for blocks which robots can carry and manipulate within the arena, including implementation of cfmetrics::blocks::transportee_metrics and what color the block is. This does NOT include the ID of the block, which is part of its core definition.

Public Functions

inline explicit block_metadata(const rutils::color &color, const crepr::block_type &type)

Using this constructor, blocks are assigned the next available id, starting from 0.

Parameters:

color – The color of the block.

~block_metadata(void) override = default
inline void dest_drop_time(const rtypes::timestep &t)

Set the time that the block is dropped at its destination location (e.g. the nest, a structure).

Parameters:

t – The current simulation time.

inline void distribution_time(const rtypes::timestep &t)

Set the time that the block was distributed/dropped in the arena.

Parameters:

t – The current simulation time.

inline void first_pickup_time(const rtypes::timestep &t)

Set the time that the block is picked up for the first time after being distributed in the arena.

Parameters:

t – The current simulation time.

inline rtypes::timestep initial_wait_time(void) const override
inline void metrics_copy(const block_metadata *const other)

Provided to block classes implementing clone() so that they can correctly clone block metadata/metrics.

Note that the robot ID is not copied.

inline void reset_metrics(void) final override
inline void robot_id(const rtypes::type_uuid &id)
inline const rtypes::type_uuid &robot_id(void) const
Returns:

The robot index, or -1 if no robot is currently carrying this block.

inline void robot_id_reset(void)

Reset the the blocks carried/not carried state when it is not carried by a robot anymore, but has not yet made it to its final destination.

inline void robot_pickup_event(const rtypes::type_uuid &robot_id)

Update a block’s state given that it has been picked up by a robot.

  • Increment the # of carries this block has undergone on its way to its final destination.

  • Set its reference to the robot that carries it.

inline rtypes::timestep total_transport_time(void) const override
inline size_t total_transporters(void) const override
inline crepr::block_type type(void) const override