DynaMix
1.3.7
A new take on polymorphism in C++
|
#include <common_mutation_rules.hpp>
Public Member Functions | |
template<typename Mixin > | |
void | set_master () |
virtual void | apply_to (object_type_mutation &mutation) override |
Applies the rule to a mutation. | |
Protected Attributes | |
mixin_id | _master_id |
Private Member Functions | |
template<typename Mixin > | |
bool | has () const |
Checks if a mixin type is present in the collection. | |
bool | has (mixin_id id) const |
template<typename Mixin > | |
void | add () |
Adds a mixin type is to the collection. | |
void | add (mixin_id id) |
template<typename Mixin > | |
void | remove () |
Removes a mixin type from the collection. | |
void | remove (mixin_id id) |
template<typename Feature > | |
bool | implements (const Feature *f) const |
Checks if a feature is implemented by any mixin in the collection. | |
template<typename Feature > | |
void | clear_all_implementing (const Feature *f) |
Clears all mixins implementing a feature from the collection. | |
void | rebuild_from_compact_mixins () |
void | check_valid_mixin (const internal::mixin_type_info &mixin_info) |
void | clear () |
Removes all elements from the collection. | |
bool | empty () const |
Checks if a collection is empty. | |
Private Attributes | |
internal::available_mixins_bitset | _mixins |
internal::mixin_type_info_vector | _compact_mixins |
A mutation rule for mixins dependent on another mixin
If active such rule will cause any mutation that adds the master, to also add the dependencies. Mutations which remove the master will also remove the dependencies.
The differnce between this and bundled_mixins
is that only one mixin is used to determine whether the others are added or removed. Adding or removing any of the dependent mixins explicitly won't add or remove anything else.
|
inline |
Sets the master mixin. If it's added or removed in a mutation, all dependent mixins will also be added or removed from the object.