Class base_block3D

Inheritance Relationships

Base Types

Derived Types

Class Documentation

class base_block3D : public cosm::repr::unicell_movable_entity3D, public rpprototype::clonable<base_block3D>

Base class for representing blocks (i.e. things that robots carry within the arena). Blocks have both real (where they actually live in the world) and discretized locations (where they are mapped to within the arena).

Subclassed by cosm::repr::real_block3D, cosm::repr::sim_block3D

Public Functions

inline base_block3D(const rtypes::type_uuid &id, const rmath::vector3d &dim, const rtypes::discretize_ratio &arena_res, const rutils::color &color, const crepr::block_type &type)
Parameters:
  • dim – 3 element vector of the dimensions of the block.

  • color – The color of the block.

  • type – The type of the block.

  • id – The id of the block.

~base_block3D(void) override = default
inline bool dloccmp(const base_block3D &other) const

Compare two base_block3D objects for equality based on their discrete location by comparing their anchors.

inline bool idcmp(const base_block3D &other) const

Compare two base_block3D objects for equality based on their ID.

inline bool is_carried_by_robot(void) const
inline block_metadata *md(void)
inline const block_metadata *md(void) const
bool operator==(const base_block3D &other) const = delete

Disallow direct object comparisons, because we may want to compare for equality in terms of IDs or object locations, and it is better to require explicit comparisons for BOTH, rather than just one. It also makes it unecessary to have to remember which type the comparison operator==() does for this class.

virtual void update_on_pickup(const rtypes::type_uuid &robot_id, const rtypes::timestep &t, const crops::block_pickup_owner &owner) = 0

Update block state given that it has been picked up.

Protected Functions

inline void clone_impl(base_block3D *const other) const